* lisp/autorevert.el (auto-revert-notify-handler): Explicitly ignore

`deleted'.  Don't drop errors silently.
This commit is contained in:
Stefan Monnier 2013-09-04 16:56:54 -04:00
parent 6629638eb3
commit abae272cce
2 changed files with 30 additions and 24 deletions

View file

@ -1,5 +1,8 @@
2013-09-04 Stefan Monnier <monnier@iro.umontreal.ca>
* autorevert.el (auto-revert-notify-handler): Explicitly ignore
`deleted'. Don't drop errors silently.
* emacs-lisp/gv.el (gv-get): Warn about CL-compiled places.
2013-09-04 Xue Fuqiao <xfq.free@gmail.com>
@ -15,7 +18,7 @@
2013-09-03 Stefan Monnier <monnier@iro.umontreal.ca>
* net/tramp-gvfs.el (tramp-gvfs-mount-spec, tramp-synce-list-devices):
* net/tramp-gvfs.el (tramp-gvfs-mount-spec, tramp-synce-list-devices):
* net/tramp-smb.el (tramp-smb-get-file-entries):
* net/tramp-sh.el (tramp-sh-handle-insert-directory)
(tramp-compute-multi-hops): Fix misuses of `add-to-list'.

View file

@ -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)."