diff options
Diffstat (limited to 'lisp/autorevert.el')
-rw-r--r-- | lisp/autorevert.el | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/lisp/autorevert.el b/lisp/autorevert.el index 978a834cb4..0e2b6f32cf 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -531,7 +531,7 @@ will use an up-to-date value of `auto-revert-interval'" (defun auto-revert-notify-handler (event) "Handle an EVENT returned from file notification." - (ignore-errors + (with-demoted-errors (let* ((descriptor (car event)) (action (nth 1 event)) (file (nth 2 event)) @@ -541,28 +541,31 @@ will use an up-to-date value of `auto-revert-interval'" ;; Check, that event is meant for us. (cl-assert descriptor) ;; We do not handle `deleted', because nothing has to be refreshed. - (cl-assert (memq action '(attribute-changed changed created renamed)) t) - ;; Since we watch a directory, a file name must be returned. - (cl-assert (stringp file)) - (when (eq action 'renamed) (cl-assert (stringp file1))) - ;; Loop over all buffers, in order to find the intended one. - (dolist (buffer buffers) - (when (buffer-live-p buffer) - (with-current-buffer buffer - (when (and (stringp buffer-file-name) - (or - (and (memq action '(attribute-changed changed created)) - (string-equal - (file-name-nondirectory file) - (file-name-nondirectory buffer-file-name))) - (and (eq action 'renamed) - (string-equal - (file-name-nondirectory file1) - (file-name-nondirectory buffer-file-name))))) - ;; Mark buffer modified. - (setq auto-revert-notify-modified-p t) - ;; No need to check other buffers. - (cl-return)))))))) + (unless (eq action 'deleted) + (cl-assert (memq action '(attribute-changed changed created renamed)) + t) + ;; Since we watch a directory, a file name must be returned. + (cl-assert (stringp file)) + (when (eq action 'renamed) (cl-assert (stringp file1))) + ;; Loop over all buffers, in order to find the intended one. + (dolist (buffer buffers) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (when (and (stringp buffer-file-name) + (or + (and (memq action '(attribute-changed changed + created)) + (string-equal + (file-name-nondirectory file) + (file-name-nondirectory buffer-file-name))) + (and (eq action 'renamed) + (string-equal + (file-name-nondirectory file1) + (file-name-nondirectory buffer-file-name))))) + ;; Mark buffer modified. + (setq auto-revert-notify-modified-p t) + ;; No need to check other buffers. + (cl-return))))))))) (defun auto-revert-active-p () "Check if auto-revert is active (in current buffer or globally)." |