GNU bug report logs -
#71424
29.3; auto-revert-use-notify buggy interaction with indirect buffers
Previous Next
Reported by: z <at> bcc32.com
Date: Sat, 8 Jun 2024 04:45:02 UTC
Severity: normal
Found in version 29.3
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #17 received at 71424 <at> debbugs.gnu.org (full text, mbox):
> Date: Sat, 08 Jun 2024 11:30:08 -0400
> From: "Aaron Zeng" <z <at> bcc32.com>
> Cc: 71424 <at> debbugs.gnu.org
>
> On Sat, Jun 8, 2024, at 03:03, Eli Zaretskii wrote:
>
> > To see that at least the basic functionality works in Emacs, I did the
> > following:
> >
> > emacs -Q
> > C-x C-f SOME-FILE RET
> > M-x global-auto-revert-mode RET
> > M-x clone-indirect-buffer RET
> >
> > Then, outside Emacs, typed from the shell prompt
> >
> > $ cat OTHER-FILE >> SOME-FILE
> >
> > where OTHER-FILE is some other existing file. After that, I saw both
> > the base buffer's text and that of its indirect clone change to
> > reflect the appended text.
>
> Indeed, while the indirect buffer is live, everything works fine. However, after you kill the indirect buffer, then the buffer no longer gets auto-reverted when you modify SOME-FILE outside Emacs.
Right. Michael, is the below the correct fix?
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index a23d536..ab69add 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -378,8 +378,11 @@ auto-revert-debug
(defun auto-revert-remove-current-buffer (&optional buffer)
"Remove BUFFER from `auto-revert-buffer-list'.
BUFFER defaults to `current-buffer'."
- (setq auto-revert-buffer-list
- (delq (or buffer (current-buffer)) auto-revert-buffer-list)))
+ (let ((buf (or buffer (current-buffer))))
+ ;; Don't remove the watch if we are killing an indirect buffer.
+ (or (buffer-base-buffer buf)
+ (setq auto-revert-buffer-list
+ (delq buf auto-revert-buffer-list)))))
;;;###autoload
(define-minor-mode auto-revert-mode
@@ -639,7 +642,9 @@ auto-revert-set-timer
(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
+ (and (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
This bug report was last modified 1 year and 60 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.