emacs-devel
[Top][All Lists]
Advanced

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

Suggestion for autorevert.el


From: Eric Hanchrow
Subject: Suggestion for autorevert.el
Date: Wed, 24 Mar 2004 07:14:16 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux)

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"}





reply via email to

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