]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't overwrite variables set by callback in help--window-setup
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 13 May 2022 15:14:21 +0000 (17:14 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 13 May 2022 15:14:36 +0000 (17:14 +0200)
* lisp/help.el (help--window-setup): Initialize the buffer in the
correct order to avoid resetting variables set by the callback.

lisp/help.el

index 83782a847750348146a00afddc8500c5ee59cdb2..8727b60bfdc33ece144d47d575beaa291950a57d 100644 (file)
@@ -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.