From 2eb15d4b1c53fb1f55bf5727e0afa95a68f6e95b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 12 May 2025 17:49:02 -0400 Subject: [PATCH] help.el: Don't abuse `inhibit-modification-hooks` * lisp/help.el (substitute-command-keys): Set `inhibit-modification-hooks` locally so it doesn't affect downstream function. (help--window-setup): Don't let-bind `inhibit-modification-hooks`. It was introduced accidentally in commit cd87a5c7a18e. (cherry picked from commit 40559bf71cd5efdf4c88ab43bc7e55abf3a66c20) --- lisp/help.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/help.el b/lisp/help.el index 09081af6148..213b5de4c50 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -293,6 +293,8 @@ specifies what to do when the user exits the help buffer. Do not call this in the scope of `with-help-window'." (and (not (get-buffer-window standard-output)) + ;; FIXME: Call this code *after* we display the buffer, so we can + ;; detect reliably whether it's been put in its own frame or what. (let ((first-message (cond ((or pop-up-frames @@ -319,7 +321,7 @@ Do not call this in the scope of `with-help-window'." (list (selected-window) (window-buffer) (window-start) (window-point))) "Type \\[switch-to-buffer] RET to remove help window.")))) - (funcall (or function 'message) + (funcall (or function #'message) (concat (if first-message (substitute-command-keys first-message)) @@ -1529,10 +1531,10 @@ Otherwise, return a new string." ;; overriding-local-map, or from a \\ construct in STRING ;; itself. (let ((keymap overriding-local-map) - (inhibit-modification-hooks t) (inhibit-read-only t) (orig-buf (current-buffer))) (with-temp-buffer + (setq-local inhibit-modification-hooks t) ;; For speed. (insert string) (goto-char (point-min)) (while (< (point) (point-max)) @@ -2291,8 +2293,7 @@ The `temp-buffer-window-setup-hook' hook is called." buffer-file-name nil) (setq-local help-mode--current-data nil) (buffer-disable-undo) - (let ((inhibit-read-only t) - (inhibit-modification-hooks t)) + (let ((inhibit-read-only t)) (erase-buffer) (delete-all-overlays) (prog1 -- 2.39.5