]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix killing indirect buffers under auto-revert-mode
authorEli Zaretskii <eliz@gnu.org>
Sat, 8 Jun 2024 17:43:55 +0000 (20:43 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sun, 9 Jun 2024 05:30:57 +0000 (07:30 +0200)
* lisp/autorevert.el (auto-revert-mode): Don't add indirect
buffers to 'auto-revert-buffer-list'.
(auto-revert-notify-rm-watch): Don't disable file notifications
when killing an indirect buffer.  (Bug#71424)

(cherry picked from commit 772fb960a948b6951f24442b372ce6833887669b)

lisp/autorevert.el

index a23d536879d6c489c43e1e79f22fef2b25301c8b..0fdab6ffc9f9f996052ed98a1e67c205c718e735 100644 (file)
@@ -401,7 +401,8 @@ Use `auto-revert-tail-mode' if you know that the file will only grow
 without being changed in the part that is already in the buffer."
   :group 'auto-revert :lighter auto-revert-mode-text
   (if auto-revert-mode
-      (when (not (memq (current-buffer) auto-revert-buffer-list))
+      (when (and (not (buffer-base-buffer (current-buffer)))
+                 (not (memq (current-buffer) auto-revert-buffer-list)))
         (push (current-buffer) auto-revert-buffer-list)
         (add-hook
          'kill-buffer-hook
@@ -639,7 +640,10 @@ will use an up-to-date value of `auto-revert-interval'."
 
 (defun auto-revert-notify-rm-watch ()
   "Disable file notification for current buffer's associated file."
-  (when-let ((desc auto-revert-notify-watch-descriptor))
+  (when-let ((desc
+              ;; Don't disable notifications if this is an indirect buffer.
+              (and (null (buffer-base-buffer))
+                   auto-revert-notify-watch-descriptor)))
     (setq auto-revert--buffer-by-watch-descriptor
           (assoc-delete-all desc auto-revert--buffer-by-watch-descriptor))
     (ignore-errors