[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
autorevert and excessive verbosity.
From: |
Luc Teirlinck |
Subject: |
autorevert and excessive verbosity. |
Date: |
Mon, 29 Mar 2004 20:43:45 -0600 (CST) |
If global-auto-revert-mode _and_ global-auto-revert-non-file-buffers
are enabled, the buffer-menu updates automatically every
auto-revert-interval seconds. A buffer-stale-function which does that
should _never_ cause auto-revert-mode to print revert messages even if
auto-revert-verbose is t. Otherwise Emacs becomes essentially
unusable. Hence I propose the following patches to autorevert.el,
files.el and buff-menu.el, which are essentially just changes to my
own prior changes. They would allow for a special return value `fast'
of buffer-stale-function, indicating that the function just returned
non-nil without really checking the need for reverting, because
reverting is fast anyway. If there are no objections, I will install
these patches.
autorevert-diff2 assumes that autorevert-diff1 has been applied. (See
the related thread autorevert and vc.)
===File ~/autorevert-diff2==================================
diff -c /home/teirllm/emacscvsdir/emacs/lisp/autorevert.el
/home/teirllm/autorevert.latest.el
*** /home/teirllm/emacscvsdir/emacs/lisp/autorevert.el Mon Mar 29 19:39:15 2004
--- /home/teirllm/autorevert.latest.el Mon Mar 29 19:30:48 2004
***************
*** 293,309 ****
This is an internal function used by Auto-Revert Mode."
(unless (buffer-modified-p)
(let (revert)
! (when (or (and (buffer-file-name)
! (file-readable-p (buffer-file-name))
! (not (verify-visited-file-modtime (current-buffer))))
! (and (or auto-revert-mode global-auto-revert-non-file-buffers)
! revert-buffer-function
! (boundp 'buffer-stale-function)
! (functionp buffer-stale-function)
! (funcall buffer-stale-function t)))
! (setq revert t))
(when revert
! (when auto-revert-verbose
(message "Reverting buffer `%s'." (buffer-name)))
(revert-buffer 'ignore-auto 'dont-ask 'preserve-modes))
;; `preserve-modes' avoids changing the (minor) modes. But we
--- 293,310 ----
This is an internal function used by Auto-Revert Mode."
(unless (buffer-modified-p)
(let (revert)
! (or (and (buffer-file-name)
! (file-readable-p (buffer-file-name))
! (not (verify-visited-file-modtime (current-buffer)))
! (setq revert t))
! (and (or auto-revert-mode global-auto-revert-non-file-buffers)
! revert-buffer-function
! (boundp 'buffer-stale-function)
! (functionp buffer-stale-function)
! (setq revert (funcall buffer-stale-function t))))
(when revert
! (when (and auto-revert-verbose
! (not (eq revert 'fast)))
(message "Reverting buffer `%s'." (buffer-name)))
(revert-buffer 'ignore-auto 'dont-ask 'preserve-modes))
;; `preserve-modes' avoids changing the (minor) modes. But we
Diff finished. Mon Mar 29 19:41:32 2004
============================================================
===File ~/files.el-diff=====================================
*** files.el 26 Mar 2004 21:55:58 -0600 1.686
--- files.el 29 Mar 2004 19:51:38 -0600
***************
*** 3458,3465 ****
"Function to check whether a non-file buffer needs reverting.
This should be a function with one optional argument NOCONFIRM.
Auto Revert Mode sets NOCONFIRM to t. The function should return
! non-nil if the buffer should be reverted. The buffer is current
! when this function is called.
The idea behind the NOCONFIRM argument is that it should be
non-nil if the buffer is going to be reverted without asking the
--- 3458,3467 ----
"Function to check whether a non-file buffer needs reverting.
This should be a function with one optional argument NOCONFIRM.
Auto Revert Mode sets NOCONFIRM to t. The function should return
! non-nil if the buffer should be reverted. A return value of
! `fast' means that the need for reverting was not checked, but
! that reverting the buffer is fast. The buffer is current when
! this function is called.
The idea behind the NOCONFIRM argument is that it should be
non-nil if the buffer is going to be reverted without asking the
============================================================
===File ~/buff-menu.el-diff=================================
*** buff-menu.el 26 Mar 2004 19:53:00 -0600 1.65
--- buff-menu.el 29 Mar 2004 19:48:59 -0600
***************
*** 185,191 ****
(set (make-local-variable 'revert-buffer-function)
'Buffer-menu-revert-function)
(set (make-local-variable 'buffer-stale-function)
! #'(lambda (&optional noconfirm) t))
(setq truncate-lines t)
(setq buffer-read-only t)
(run-hooks 'buffer-menu-mode-hook))
--- 185,191 ----
(set (make-local-variable 'revert-buffer-function)
'Buffer-menu-revert-function)
(set (make-local-variable 'buffer-stale-function)
! #'(lambda (&optional noconfirm) 'fast))
(setq truncate-lines t)
(setq buffer-read-only t)
(run-hooks 'buffer-menu-mode-hook))
============================================================
- autorevert and excessive verbosity.,
Luc Teirlinck <=