all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: offby1@blarg.net, emacs-devel@gnu.org, monnier@iro.umontreal.ca,
	rms@gnu.org
Subject: Re: Suggestion for autorevert.el
Date: Fri, 2 Apr 2004 17:46:52 -0600 (CST)	[thread overview]
Message-ID: <200404022346.i32Nkqp26746@raven.dms.auburn.edu> (raw)
In-Reply-To: <200404021602.i32G2jX25019@raven.dms.auburn.edu> (message from Luc Teirlinck on Fri, 2 Apr 2004 10:02:45 -0600 (CST))

>From my previous message:

   The added code, which calls the non-primitive and non-optimized
   `get-buffer-window-list'

I do not know what I was worrying about, because `get-buffer-window-list'
does by no means appear to be as slow as I assumed (I mistakenly
deduced that from comments in the source code saying that it really
should be a primitive).  Apparently one would need several thousands
of constantly reverting buffers for these calls to add up to something
and in such a situation, there would presumably be other things to
worry about.

Anyway, the following patch would appear to be better than the one I
submitted yesterday (there is no difference in behavior, it just
appears to be somewhat more efficient):

===File ~/autorevert-newdiff================================
*** autorevert.el	31 Mar 2004 10:03:44 -0600	1.28
--- autorevert.el	02 Apr 2004 17:15:25 -0600	
***************
*** 44,49 ****
--- 44,60 ----
  ;; seconds.  The check is aborted whenever the user actually uses
  ;; Emacs.  You should never even notice that this package is active
  ;; (except that your buffers will be reverted, of course).
+ ;;
+ ;; After reverting a file buffer, Auto Revert Mode normally puts point
+ ;; at the same position that a regular manual revert would.  However,
+ ;; there is one exception to this rule.  If point is at the end of the
+ ;; buffer before reverting, it stays at the end.  Similarly if point
+ ;; is displayed at the end of a file buffer in any window, it will stay
+ ;; at the end of the buffer in that window, even if the window is not
+ ;; selected.  This way, you can use Auto Revert Mode to `tail' a file.
+ ;; Just put point at the end of the buffer and it will stay there.
+ ;; These rules apply to file buffers. For non-file buffers, the
+ ;; behavior may be mode dependent.
  
  ;; Usage:
  ;;
***************
*** 298,307 ****
    "Revert current buffer, if appropriate.
  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
--- 309,318 ----
    "Revert current buffer, if appropriate.
  This is an internal function used by Auto-Revert Mode."
    (unless (buffer-modified-p)
!     (let ((buffer (current-buffer)) revert eob eoblist)
!       (or (and buffer-file-name
! 	       (file-readable-p buffer-file-name)
! 	       (not (verify-visited-file-modtime buffer))
  	       (setq revert t))
  	  (and (or auto-revert-mode global-auto-revert-non-file-buffers)
  	       revert-buffer-function
***************
*** 312,318 ****
  	(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
        ;; do want to reset the mode for VC, so we do it manually.
        (when (or revert auto-revert-check-vc-info)
--- 323,341 ----
  	(when (and auto-revert-verbose
  		   (not (eq revert 'fast)))
  	  (message "Reverting buffer `%s'." (buffer-name)))
! 	(when buffer-file-name
! 	  (setq eob (eobp))
! 	  (walk-windows
! 	   #'(lambda (window)
! 	       (and (eq (window-buffer window) buffer)
! 		    (= (window-point window) (point-max))
! 		    (push window eoblist)))
! 	   'no-mini t))
! 	(revert-buffer 'ignore-auto 'dont-ask 'preserve-modes)
! 	(when buffer-file-name
! 	  (when eob (goto-char (point-max)))
! 	  (dolist (window eoblist)
! 	    (set-window-point window (point-max)))))
        ;; `preserve-modes' avoids changing the (minor) modes.  But we
        ;; do want to reset the mode for VC, so we do it manually.
        (when (or revert auto-revert-check-vc-info)
============================================================

  reply	other threads:[~2004-04-02 23:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-24 15:14 Suggestion for autorevert.el Eric Hanchrow
2004-03-25  4:06 ` Luc Teirlinck
2004-03-25  7:49 ` Richard Stallman
2004-04-01  3:30   ` Luc Teirlinck
2004-04-01  8:00     ` Juanma Barranquero
2004-04-01 17:34     ` Richard Stallman
2004-04-02  4:09       ` Luc Teirlinck
2004-04-02  4:28         ` Luc Teirlinck
2004-04-02  5:02         ` Stefan Monnier
2004-04-02 16:02           ` Luc Teirlinck
2004-04-02 23:46             ` Luc Teirlinck [this message]
     [not found]   ` <87vfktj86f.fsf@offby1.atm01.sea.blarg.net>
2004-04-02  0:11     ` Luc Teirlinck
2004-04-03  1:30       ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200404022346.i32Nkqp26746@raven.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=offby1@blarg.net \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.