]> git.eshelyaron.com Git - emacs.git/commitdiff
esh-mode.el: Refrain from hiding buffer modifications (bug#70966)
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 28 May 2024 21:42:27 +0000 (17:42 -0400)
committerEshel Yaron <me@eshelyaron.com>
Wed, 29 May 2024 10:12:29 +0000 (12:12 +0200)
We have not been able to discover why these functions let-bound
`inhibit-modification-hooks`, but these let-bindings are
undesired effects on other modes such as `diff-mode` which
need to keep track of buffer modifications.  Let's remove those
let-bindings and hope for the best.

* lisp/eshell/esh-mode.el (eshell-send-input)
(eshell-interactive-filter): Don't bind `inhibit-modification-hooks`.

(cherry picked from commit 647de5e952c6ba806d3c36373cf8eb4f11034650)

lisp/eshell/esh-mode.el

index 78a448a41a5c6926a68644fb68850d87d83cd002..c4ae55afe3f846814ebe5d7d49b8286cf7da939d 100644 (file)
@@ -622,8 +622,7 @@ newline."
   (interactive "P")
   ;; Note that the input string does not include its terminal newline.
   (let* ((proc-running-p (eshell-head-process))
-         (send-to-process-p (and proc-running-p (not queue-p)))
-         (inhibit-modification-hooks t))
+         (send-to-process-p (and proc-running-p (not queue-p))))
     (unless (and send-to-process-p
                 (not (eq (process-status
                           (eshell-head-process))
@@ -710,41 +709,40 @@ This is done after all necessary filtering has been done."
   (unless buffer
     (setq buffer (current-buffer)))
   (when (and string (buffer-live-p buffer))
-    (let ((inhibit-modification-hooks t))
-      (with-current-buffer buffer
-        (let ((functions eshell-preoutput-filter-functions))
-          (while (and functions string)
-            (setq string (funcall (car functions) string))
-            (setq functions (cdr functions))))
-        (when string
-          (let (opoint obeg oend)
-            (setq opoint (point))
-            (setq obeg (point-min))
-            (setq oend (point-max))
-            (let ((buffer-read-only nil)
-                  (nchars (length string))
-                  (ostart nil))
-              (widen)
-              (goto-char eshell-last-output-end)
-              (setq ostart (point))
-              (if (<= (point) opoint)
-                  (setq opoint (+ opoint nchars)))
-              (if (< (point) obeg)
-                  (setq obeg (+ obeg nchars)))
-              (if (<= (point) oend)
-                  (setq oend (+ oend nchars)))
-              ;; Let the ansi-color overlay hooks run.
-              (let ((inhibit-modification-hooks nil))
-                (insert string))
-              (if (= (window-start) (point))
-                  (set-window-start (selected-window)
-                                    (- (point) nchars)))
-              (set-marker eshell-last-output-start ostart)
-              (set-marker eshell-last-output-end (point))
-              (force-mode-line-update))
-            (narrow-to-region obeg oend)
-            (goto-char opoint)
-            (eshell-run-output-filters)))))))
+    (with-current-buffer buffer
+      (let ((functions eshell-preoutput-filter-functions))
+        (while (and functions string)
+          (setq string (funcall (car functions) string))
+          (setq functions (cdr functions))))
+      (when string
+        (let (opoint obeg oend)
+          (setq opoint (point))
+          (setq obeg (point-min))
+          (setq oend (point-max))
+          (let ((buffer-read-only nil)
+                (nchars (length string))
+                (ostart nil))
+            (widen)
+            (goto-char eshell-last-output-end)
+            (setq ostart (point))
+            (if (<= (point) opoint)
+                (setq opoint (+ opoint nchars)))
+            (if (< (point) obeg)
+                (setq obeg (+ obeg nchars)))
+            (if (<= (point) oend)
+                (setq oend (+ oend nchars)))
+            ;; Let the ansi-color overlay hooks run.
+            (let ((inhibit-modification-hooks nil))
+              (insert string))
+            (if (= (window-start) (point))
+                (set-window-start (selected-window)
+                                  (- (point) nchars)))
+            (set-marker eshell-last-output-start ostart)
+            (set-marker eshell-last-output-end (point))
+            (force-mode-line-update))
+          (narrow-to-region obeg oend)
+          (goto-char opoint)
+          (eshell-run-output-filters))))))
 
 (defun eshell-run-output-filters ()
   "Run the `eshell-output-filter-functions' on the current output."