From: Andrea Corallo <akrl@sdf.org>
Cc: defun.foo@proton.me, 56643@debbugs.gnu.org, @mx.sdf.org, eliz@gnu.org
Subject: bug#56643: 29.0.50; Help-mode bookmarks not loading with native compilation
Date: Wed, 20 Jul 2022 09:51:17 +0000 [thread overview]
Message-ID: <xjfo7xknmcq.fsf@ma.sdf.org> (raw)
In-Reply-To: <lzjXW3vhXW--IOZJXTmU5Xl0TSm-nz50UZUhGmiff-7ImxbKPu6OjfMV73fSTGAqKai-qvHKZkc9KOIUz8hhgleZfdcZtIuUA7Y87lSXsP8=@proton.me> (defun foo's message of "Tue, 19 Jul 2022 22:22:57 +0000")
"defun.foo--- via \"Bug reports for GNU Emacs, the Swiss army knife of
text editors\"" <bug-gnu-emacs@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>
> (("\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.
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
next prev parent reply other threads:[~2022-07-20 9:51 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
2022-07-20 9:51 ` Andrea Corallo [this message]
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=xjfo7xknmcq.fsf@ma.sdf.org \
--to=akrl@sdf.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).