GNU bug report logs - #56643
29.0.50; Help-mode bookmarks not loading with native compilation

Previous Next

Package: emacs;

Reported by: defun.foo <at> proton.me

Date: Tue, 19 Jul 2022 16:12:02 UTC

Severity: normal

Found in version 29.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 56643 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: defun.foo <at> proton.me
Cc: Eli Zaretskii <eliz <at> gnu.org>, 56643 <at> debbugs.gnu.org
Subject: Re: bug#56643: 29.0.50; Help-mode bookmarks not loading with native
 compilation
Date: Wed, 20 Jul 2022 11:21:06 +0000
"defun.foo--- via \"Bug reports for GNU Emacs, the Swiss army knife of
text editors\"" <bug-gnu-emacs <at> gnu.org> writes:

> I dug into that a little when I was trying to find a work-around. It looks like help-mode maintains a stack of previously-visited help items which is what enables users to jump back and forth between different items they've viewed. From "C-h v help-xref-stack":
>
> "A stack of ways by which to return to help buffers after following xrefs.
> Used by ‘help-follow-symbol’ and ‘help-xref-go-back’.
> An element looks like (POSITION FUNCTION ARGS...).
> To use the element, do (apply FUNCTION ARGS) then goto the point."
>
> So basically the FUNCTION element is a recipe for recreating a specific help item, and "help-bookmark-make-record" just drops that FUNCTION element intact into "help-fn" when creating a bookmark:
>
> `(,@(bookmark-make-record-default 'NO-FILE 'NO-CONTEXT)
>       (help-fn     . ,(car help-xref-stack-item))
>       (help-args   . ,(mapcar (lambda (a)
>                                 (if (bufferp a) (buffer-name a) a))
>                               (cdr help-xref-stack-item)))
>       (position    . ,(point))
>       (handler     . help-bookmark-jump))
>
> The catch is that every function that generates a help buffer also defines its own way of setting up an xref stack item. Some pass in a symbol while some pass in a lambda, so after a while the stack might end up looking like this:
>
> ((1 #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_20>
>     (("" .
>       [24 3]))
>     #<buffer *Help*>)
>  (232 describe-variable help-xref-stack #<buffer *Help*>)
>  (1 #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_7> describe-package #<buffer *Help*>))
>
> Then when bookmark.el saves all the bookmarks ("bookmark-write-file"), it just calls "pp" on each one:
>
> (dolist (i bookmark-alist) (pp i (current-buffer)))
>
> which apparently is able to create a readable representation of byte-compiled lambdas, but not native-compiled ones.
>
> And that's where my knowledge ends. :) I have very little C programming experience and have no idea if it's even possible to serialize a compiled thing into something the reader can understand, or whether there's some processing help-mode could do on each function before it even becomes part of a bookmark.

It is unfortunatelly not possible to serialize native compiled code so
that the reader can read it back.  Native code can only stay in shared
libraries (eln files) and be loaded from there.

Not sure if help-mode can use a different strategy.

BR

  Andrea




This bug report was last modified 2 years and 361 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.