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)
This commit is contained in:
Eli Zaretskii 2022-07-23 11:11:47 +03:00
parent ba7a75e052
commit 7263631dca
2 changed files with 17 additions and 11 deletions

View file

@ -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)

View file

@ -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))))