From bd464297bde2357bbcc96773355ae439fb567b31 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 13 May 2022 17:14:21 +0200 Subject: [PATCH] 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. --- lisp/help.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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. -- 2.39.2