From 7263631dca6145354e994d84c9ff3e09c450739b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Jul 2022 11:11:47 +0300 Subject: [PATCH] Fix bookmark support for Help functions in native-compilation builds * lisp/help.el (describe-key--helper, describe-function--helper): New helper functions. (describe-key): Call 'describe-key--helper' instead of a lambda-function. * lisp/help-fns.el (describe-function): Call 'describe-function--helper' instead of a lambda-function. (Bug#56643) --- lisp/help-fns.el | 10 +++------- lisp/help.el | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 6a7951d160e..656e7b7da24 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -251,13 +251,9 @@ handling of autoloaded functions." (or describe-function-orig-buffer (current-buffer)))) - (help-setup-xref - (list (lambda (function buffer) - (let ((describe-function-orig-buffer - (if (buffer-live-p buffer) buffer))) - (describe-function function))) - function describe-function-orig-buffer) - (called-interactively-p 'interactive)) + (help-setup-xref (list #'describe-function--helper + function describe-function-orig-buffer) + (called-interactively-p 'interactive)) (save-excursion (with-help-window (help-buffer) diff --git a/lisp/help.el b/lisp/help.el index fd331ac0d48..0701bf178aa 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -881,6 +881,19 @@ Describe the following key, mouse click, or menu item: " (setq yank-menu (copy-sequence saved-yank-menu)) (fset 'yank-menu (cons 'keymap yank-menu)))))) +;; These two are named functions because lambda-functions cannot be +;; serialized in a native-compilation build, which breaks bookmark +;; support in help-mode.el. +(defun describe-key--helper (key-list buf) + (describe-key key-list + (if (buffer-live-p buf) buf))) + +(defvar describe-function-orig-buffer) +(defun describe-function--helper (func buf) + (let ((describe-function-orig-buffer + (if (buffer-live-p buf) buf))) + (describe-function func))) + (defun describe-key (&optional key-list buffer up-event) "Display documentation of the function invoked by KEY-LIST. KEY-LIST can be any kind of a key sequence; it can include keyboard events, @@ -926,10 +939,7 @@ current buffer." `(,seq ,brief-desc ,defn ,locus))) key-list)) 2))) - (help-setup-xref (list (lambda (key-list buf) - (describe-key key-list - (if (buffer-live-p buf) buf))) - key-list buf) + (help-setup-xref (list #'describe-key--helper key-list buf) (called-interactively-p 'interactive)) (if (and (<= (length info-list) 1) (help--binding-undefined-p (nth 2 (car info-list)))) -- 2.39.2