bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56643: 29.0.50; Help-mode bookmarks not loading with native compilat


From: defun . foo
Subject: bug#56643: 29.0.50; Help-mode bookmarks not loading with native compilation
Date: Tue, 19 Jul 2022 22:22:57 +0000

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.

------- Original Message -------
On Tuesday, July 19th, 2022 at 12:49 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
> Thanks.
>
> I started looking into this, but gave up when I got to help-mode.el
> (which is where the bookmark support for Help lives, and which is
> where we signal an error trying to read an unreadable object.)
>
> We basically have no usable documentation for what bookmark support in
> help-mode does. Someone who knows what that code does will have to
> see how to process a help-fn that is a natively-compiled function.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]