diff --git a/doc/lispref/backups.texi b/doc/lispref/backups.texi index f3f0902f364..a1df26230aa 100644 --- a/doc/lispref/backups.texi +++ b/doc/lispref/backups.texi @@ -852,6 +852,13 @@ It is important to assure that point does not continuously jump around as a consequence of auto-reverting. Of course, moving point might be inevitable if the buffer radically changes. +@defvar auto-revert-buffer-in-progress-p +@code{auto-revert-buffer} binds this variable to a non-@code{nil} value +while it is working. This can be used by major mode +@code{revert-buffer-function} implementations to suppress messages in +Auto Revert modes, for example. +@end defvar + @defvar inhibit-auto-revert-buffers When the current buffer is member of this variable (a list of buffers), auto-reverting is suppressed for that buffer. This is useful if serious diff --git a/etc/NEWS b/etc/NEWS index eee62da981e..ba215d519ba 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2209,6 +2209,12 @@ This macro adds the current buffer to 'inhibit-auto-revert-buffers', runs its body, and removes the current buffer from 'inhibit-auto-revert-buffers' afterwards. ++++ +*** New variable 'auto-revert-buffer-in-progress-p'. +'auto-revert-buffer' binds this variable to a non-nil value while it is +working. This can be used by major mode 'revert-buffer-function' +implementations to suppress messages in Auto Revert modes, for example. + ** Strokes -- diff --git a/lisp/autorevert.el b/lisp/autorevert.el index 2fae74ddc57..30ec8dc2480 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -329,6 +329,10 @@ seconds, in addition to using notification for those files." ;; Internal variables: +;;;###autoload +(defvar auto-revert-buffer-in-progress-p nil "\ +Non-nil if a `auto-revert-buffer' operation is in progress, nil otherwise.") + (defvar auto-revert-buffer-list () "List of buffers in Auto-Revert Mode. @@ -933,25 +937,25 @@ buffers not reverted last time due to user interruption." This is performed as specified by Auto-Revert and Global Auto-Revert Modes." - (if (not (buffer-live-p buf)) - (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. - (when (and (not auto-revert-mode) - (not auto-revert-tail-mode)) - (auto-revert-remove-current-buffer)) - (when (auto-revert-active-p) - ;; Enable file notification. - ;; Don't bother creating a notifier for non-file buffers - ;; unless it explicitly indicates that this works. - (when (and auto-revert-use-notify - (not auto-revert-notify-watch-descriptor) - (or buffer-file-name - buffer-auto-revert-by-notification)) - (auto-revert-notify-add-watch)) - (auto-revert-handler))))) + (let ((auto-revert-buffer-in-progress-p t)) + (if (not (buffer-live-p buf)) + (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. + (when (and (not auto-revert-mode) + (not auto-revert-tail-mode)) + (auto-revert-remove-current-buffer)) + (when (auto-revert-active-p) + ;; Enable file notification. + ;; Don't bother creating a notifier for non-file buffers + ;; unless it explicitly indicates that this works. + (when (and auto-revert-use-notify + (not auto-revert-notify-watch-descriptor) + (or buffer-file-name + buffer-auto-revert-by-notification)) + (auto-revert-notify-add-watch)) + (auto-revert-handler)))))) (defun auto-revert-buffers () "Revert buffers as specified by Auto-Revert and Global Auto-Revert Mode. diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 59668f79bd7..016b97d34a2 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -475,7 +475,9 @@ status message." nil))) (let ((omit-re (or regexp (dired-omit-regexp))) (old-modified-p (buffer-modified-p)) - (count (or init-count 0))) + (count (or init-count 0)) + (dired-omit-verbose + (and dired-omit-verbose (not auto-revert-buffer-in-progress-p)))) (unless (string= omit-re "") (let ((dired-marker-char dired-omit-marker-char)) (when dired-omit-verbose (message "Omitting..."))