From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Eric Hanchrow Newsgroups: gmane.emacs.devel Subject: Suggestion for autorevert.el Date: Wed, 24 Mar 2004 07:14:16 -0800 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87zna6l1kn.fsf@offby1.atm01.sea.blarg.net> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1080142409 29735 80.91.224.253 (24 Mar 2004 15:33:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 24 Mar 2004 15:33:29 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Mar 24 16:33:13 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 1B6ANV-0000TX-00 for ; Wed, 24 Mar 2004 16:33:13 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B6ANU-0002Ok-00 for ; Wed, 24 Mar 2004 16:33:12 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B6A6c-0006iL-R7 for emacs-devel@quimby.gnus.org; Wed, 24 Mar 2004 10:15:46 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B6A5p-0006hg-KW for emacs-devel@gnu.org; Wed, 24 Mar 2004 10:14:57 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B6A5J-0006cS-E7 for emacs-devel@gnu.org; Wed, 24 Mar 2004 10:14:56 -0500 Original-Received: from [80.91.224.249] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B6A5I-0006c1-U6 for emacs-devel@gnu.org; Wed, 24 Mar 2004 10:14:25 -0500 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1B6A5D-0002um-00 for ; Wed, 24 Mar 2004 16:14:19 +0100 Original-Received: from offby1.atm01.sea.blarg.net ([206.124.138.125]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 24 Mar 2004 16:14:19 +0100 Original-Received: from offby1 by offby1.atm01.sea.blarg.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 24 Mar 2004 16:14:19 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 44 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: offby1.atm01.sea.blarg.net User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:+yff0WxL64EARgPcaReX208cNk8= 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:20850 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20850 I often use `autorevert' to do what `tail' does -- namely, watch the end of a constantly-growing file. However, the current code doesn't make that easy, because point never moves. So here's an idea for keeping point at the end of the buffer. You'll note I have a question: the new variable auto-revert-tail seems like it ought to be buffer-local, but it's not clear to me how to make it so if I use `defcustom'. I was tempted to use `defvar' instead, since a few other variables in autorevert.el are themselves defined with `defvar' ... but I'm not sure why. diff -bu /usr/local/src/emacs-cvs/lisp/autorevert.el.\~1.22.\~ /usr/local/src/emacs-cvs/lisp/autorevert.el --- /usr/local/src/emacs-cvs/lisp/autorevert.el.~1.22.~ 2004-03-20 17:00:11.000000000 -0800 +++ /usr/local/src/emacs-cvs/lisp/autorevert.el 2004-03-23 18:24:19.000000000 -0800 @@ -176,6 +176,12 @@ :group 'auto-revert :type 'boolean) +;; should this be buffer-local? +(defcustom auto-revert-tail nil + "When non-nil, move point to the end of the buffer after reverting." + :group 'auto-revert + :type 'boolean) + (defcustom global-auto-revert-ignore-modes '() "List of major modes Global Auto-Revert Mode should not check." :group 'auto-revert @@ -401,7 +407,9 @@ (if (eq revert 'vc) (vc-mode-line buffer-file-name)) (if auto-revert-verbose - (message "Reverting buffer `%s'." (buffer-name)))))) + (message "Reverting buffer `%s'." (buffer-name))) + (if auto-revert-tail + (goto-char (point-max)))))) (defun auto-revert-buffers () "Revert buffers as specified by Auto-Revert and Global Auto-Revert Mode. Diff finished. Tue Mar 23 18:34:41 2004 -- Hamburgers! The cornerstone of any nutritious breakfast. -- Jules {From "Pulp Fiction"}