mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-30 12:21:25 -08:00
Add auto-revert-buffer-in-progress-p
* doc/lispref/backups.texi (Reverting): Add auto-revert-buffer-in-progress-p. * etc/NEWS: Mention auto-revert-buffer-in-progress-p. * lisp/autorevert.el (auto-revert-buffer-in-progress-p): New autoloaded variable. (auto-revert-buffer): Let-bind it. (Bug#79145) * lisp/dired-x.el (dired-omit-expunge): Suppress messages when in auto-revert.
This commit is contained in:
parent
560aee2fb2
commit
be4be3eb09
4 changed files with 39 additions and 20 deletions
|
|
@ -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
|
||||
|
|
|
|||
6
etc/NEWS
6
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
|
||||
|
||||
--
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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..."))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue