]> git.eshelyaron.com Git - emacs.git/commitdiff
help.el: Don't abuse `inhibit-modification-hooks`
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 12 May 2025 21:49:02 +0000 (17:49 -0400)
committerEshel Yaron <me@eshelyaron.com>
Wed, 14 May 2025 12:33:54 +0000 (14:33 +0200)
* 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

index 09081af614835eaeff93d6deeaccc6aca1c62c74..213b5de4c50570a9a90ca821617576bde09aae91 100644 (file)
@@ -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 \\<mapname> 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