unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: defun.foo--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 56643@debbugs.gnu.org
Subject: bug#56643: 29.0.50; Help-mode bookmarks not loading with native compilation
Date: Tue, 19 Jul 2022 22:22:57 +0000	[thread overview]
Message-ID: <lzjXW3vhXW--IOZJXTmU5Xl0TSm-nz50UZUhGmiff-7ImxbKPu6OjfMV73fSTGAqKai-qvHKZkc9KOIUz8hhgleZfdcZtIuUA7Y87lSXsP8=@proton.me> (raw)
In-Reply-To: <83k089m4j0.fsf@gnu.org>

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>
    (("\x18\x03" .
      [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	other threads:[~2022-07-19 22:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19 13:45 bug#56643: 29.0.50; Help-mode bookmarks not loading with native compilation defun.foo--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-19 16:49 ` Eli Zaretskii
2022-07-19 22:22   ` defun.foo--- via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-07-20  9:51     ` Andrea Corallo
2022-07-20 11:21     ` Andrea Corallo
2022-07-20 11:45       ` Eli Zaretskii
2022-07-20 18:31         ` Andrea Corallo
2022-07-20 19:16           ` Eli Zaretskii
2022-07-20 22:47             ` Michael Heerdegen
2022-07-21  5:13               ` Eli Zaretskii
2022-07-21 10:01                 ` defun.foo--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-21 12:33                   ` Eli Zaretskii
2022-07-22 13:40                     ` Eli Zaretskii
2022-07-22 13:41                     ` Andrea Corallo
2022-07-22 14:40                       ` Eli Zaretskii
2022-07-23  9:57                         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='lzjXW3vhXW--IOZJXTmU5Xl0TSm-nz50UZUhGmiff-7ImxbKPu6OjfMV73fSTGAqKai-qvHKZkc9KOIUz8hhgleZfdcZtIuUA7Y87lSXsP8=@proton.me' \
    --to=bug-gnu-emacs@gnu.org \
    --cc=56643@debbugs.gnu.org \
    --cc=defun.foo@proton.me \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).