From: Lars Ingebrigtsen Date: Fri, 13 May 2022 15:14:21 +0000 (+0200) Subject: Don't overwrite variables set by callback in help--window-setup X-Git-Tag: emacs-29.0.90~1910^2~723 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bd464297bde2357bbcc96773355ae439fb567b31;p=emacs.git Don't overwrite variables set by callback in help--window-setup * lisp/help.el (help--window-setup): Initialize the buffer in the correct order to avoid resetting variables set by the callback. --- diff --git a/lisp/help.el b/lisp/help.el index 83782a84775..8727b60bfdc 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1954,8 +1954,11 @@ The `temp-buffer-window-setup-hook' hook is called." ;; where this should be set to a buffer position is within BODY. (set-marker help-window-point-marker nil) (with-current-buffer (get-buffer-create buffer) + (unless (derived-mode-p 'help-mode) + (help-mode)) (setq buffer-read-only t buffer-file-name nil) + (setq-local help-mode--current-data nil) (buffer-disable-undo) (let ((inhibit-read-only t) (inhibit-modification-hooks t)) @@ -1966,8 +1969,6 @@ The `temp-buffer-window-setup-hook' hook is called." (funcall callback) (run-hooks 'temp-buffer-window-setup-hook)) (help-window-setup (temp-buffer-window-show (current-buffer))) - (unless (derived-mode-p 'help-mode) - (help-mode)) (help-make-xrefs (current-buffer)))))) ;; Called from C, on encountering `help-char' when reading a char.