emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master ef85d54 3/3: Merge branch 'master' of git.savannah.


From: Eli Zaretskii
Subject: [Emacs-diffs] master ef85d54 3/3: Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
Date: Sat, 27 Jul 2019 07:12:14 -0400 (EDT)

branch: master
commit ef85d54ca1e154088acd6b8f41c1312146edcc8f
Merge: 51443b9 b41a763
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
---
 etc/NEWS           |  5 +++++
 lisp/autorevert.el | 11 +++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index c970a3c..9d8b23b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1696,6 +1696,11 @@ the new variable 'buffer-auto-revert-by-notification' to 
a non-nil
 value.  Auto Revert mode can use this information to avoid polling the
 buffer periodically when 'auto-revert-avoid-polling' is non-nil.
 
+---
+*** `global-auto-revert-ignore-buffer' can now also be a predicate
+function that can be used for more fine-grained control of which
+buffers to auto-revert.
+
 ** auth-source-pass
 
 +++
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 5c79a7e..6cdc1d3 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -266,7 +266,10 @@ buffers.  CPU usage depends on the version control system."
 
 (defvar-local global-auto-revert-ignore-buffer nil
   "When non-nil, Global Auto-Revert Mode will not revert this buffer.
-This variable becomes buffer local when set in any fashion.")
+This variable can also be a predicate function, in which case
+it'll be called with one parameter (the buffer in question), and
+it should return non-nil to make Global Auto-Revert Mode not
+revert this buffer.")
 
 (defcustom auto-revert-remote-files nil
   "If non-nil remote files are also reverted."
@@ -541,7 +544,11 @@ specifies in the mode line."
                       (not (eq buffer-stale-function
                                #'buffer-stale--default-function))))
              (not (memq 'major-mode global-auto-revert-ignore-modes))
-             (not global-auto-revert-ignore-buffer))
+             (or (null global-auto-revert-ignore-buffer)
+                 (if (functionp global-auto-revert-ignore-buffer)
+                     (not (funcall global-auto-revert-ignore-buffer
+                                   (current-buffer)))
+                   nil)))
     (setq auto-revert--global-mode t)))
 
 (defun auto-revert--global-adopt-current-buffer ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]