[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master bcc6468: Fix Bug#34847
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] master bcc6468: Fix Bug#34847 |
Date: |
Sat, 6 Apr 2019 05:36:42 -0400 (EDT) |
branch: master
commit bcc6468b39916de6a3756c98e744ed5d0534eb40
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
Fix Bug#34847
* lisp/autorevert.el (auto-revert-remove-current-buffer):
Add optional argument BUFFER.
(auto-revert-notify-rm-watch): Remove local hook.
(auto-revert-buffers): Check `buffer-live-p' in time. (Bug#34847)
---
lisp/autorevert.el | 52 +++++++++++++++++++++++++++-------------------------
1 file changed, 27 insertions(+), 25 deletions(-)
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index bc7c616..e6dfafc 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -343,10 +343,11 @@ This has been reported by a file notification event.")
;; Functions:
-(defun auto-revert-remove-current-buffer ()
- "Remove dead buffer from `auto-revert-buffer-list'."
+(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 (current-buffer) auto-revert-buffer-list)))
+ (delq (or buffer (current-buffer)) auto-revert-buffer-list)))
;;;###autoload
(define-minor-mode auto-revert-mode
@@ -509,7 +510,7 @@ will use an up-to-date value of `auto-revert-interval'"
(ignore-errors
(file-notify-rm-watch auto-revert-notify-watch-descriptor)))))
auto-revert-notify-watch-descriptor-hash-list)
- (remove-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch))
+ (remove-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch t))
(setq auto-revert-notify-watch-descriptor nil
auto-revert-notify-modified-p nil))
@@ -772,10 +773,12 @@ the timer when no buffers need to be checked."
(setq bufs (delq nil
(mapcar
(lambda (buf)
- (with-current-buffer buf
- (and (or (not (file-remote-p default-directory))
- (file-remote-p default-directory nil t))
- buf)))
+ (and (buffer-live-p buf)
+ (with-current-buffer buf
+ (and
+ (or (not (file-remote-p default-directory))
+ (file-remote-p default-directory nil t))
+ buf))))
bufs)))
;; Partition `bufs' into two halves depending on whether or not
;; the buffers are in `auto-revert-remaining-buffers'. The two
@@ -792,24 +795,23 @@ the timer when no buffers need to be checked."
(not (and auto-revert-stop-on-user-input
(input-pending-p))))
(let ((buf (car bufs)))
- (with-current-buffer buf
- (if (buffer-live-p buf)
- (progn
- ;; Test if someone has turned off Auto-Revert Mode
- ;; in a non-standard way, for example by changing
- ;; major mode.
- (if (and (not auto-revert-mode)
- (not auto-revert-tail-mode)
- (memq buf auto-revert-buffer-list))
- (auto-revert-remove-current-buffer))
- (when (auto-revert-active-p)
- ;; Enable file notification.
- (when (and auto-revert-use-notify
- (not auto-revert-notify-watch-descriptor))
- (auto-revert-notify-add-watch))
- (auto-revert-handler)))
+ (if (not (buffer-live-p buf))
;; Remove dead buffer from `auto-revert-buffer-list'.
- (auto-revert-remove-current-buffer))))
+ (auto-revert-remove-current-buffer buf)
+ (with-current-buffer buf
+ ;; Test if someone has turned off Auto-Revert Mode
+ ;; in a non-standard way, for example by changing
+ ;; major mode.
+ (if (and (not auto-revert-mode)
+ (not auto-revert-tail-mode)
+ (memq buf auto-revert-buffer-list))
+ (auto-revert-remove-current-buffer))
+ (when (auto-revert-active-p)
+ ;; Enable file notification.
+ (when (and auto-revert-use-notify
+ (not auto-revert-notify-watch-descriptor))
+ (auto-revert-notify-add-watch))
+ (auto-revert-handler)))))
(setq bufs (cdr bufs)))
(setq auto-revert-remaining-buffers bufs)
;; Check if we should cancel the timer.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master bcc6468: Fix Bug#34847,
Michael Albinus <=