From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: autorevert and excessive verbosity. Date: Mon, 29 Mar 2004 20:43:45 -0600 (CST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200403300243.i2U2hjv11763@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1080614860 15321 80.91.224.253 (30 Mar 2004 02:47:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 30 Mar 2004 02:47:40 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Mar 30 04:47:36 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B89Hs-0008K1-00 for ; Tue, 30 Mar 2004 04:47:36 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B89Hr-0008Am-00 for ; Tue, 30 Mar 2004 04:47:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B89HW-0001rC-24 for emacs-devel@quimby.gnus.org; Mon, 29 Mar 2004 21:47:14 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B89Gq-0001qA-3O for emacs-devel@gnu.org; Mon, 29 Mar 2004 21:46:32 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B89GB-0001DY-WF for emacs-devel@gnu.org; Mon, 29 Mar 2004 21:46:23 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B89GB-0001DU-KN for emacs-devel@gnu.org; Mon, 29 Mar 2004 21:45:51 -0500 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id i2U2joKt024990 for ; Mon, 29 Mar 2004 20:45:51 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id i2U2hjv11763; Mon, 29 Mar 2004 20:43:45 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:21075 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:21075 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)) ============================================================