all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: emacs-devel@gnu.org
Subject: Re: autorevert.el
Date: Wed, 3 Mar 2004 23:08:33 -0600 (CST)	[thread overview]
Message-ID: <200403040508.i2458W811551@raven.dms.auburn.edu> (raw)
In-Reply-To: <jwvsmgq1323.fsf-monnier+emacs/devel@asado.iro.umontreal.ca> (message from Stefan Monnier on 03 Mar 2004 08:24:58 -0500)

Stefan Monnier wrote:

   Most of the patch looks right (the list-diff thing was just horrendous and
   showed a serious misunderstanding), except I'd try to merge a bit more the
   dired and non-dired checks since both check the modtime.

Not all parts of the function check the modtime and the two parts
where the modtime gets checked do it in different ways (dired can not
use `verify-visited-file-modtime', because it is not visiting a file).
It seems that the only thing that is done unconditionally in all cases
is check (buffer-modified-p), so I changed the function to first check
this before splitting into cases.

   Also, I'd use file-remote-p rather than (string-match "@"),
   especially since remote files might not include any @.

You are right.  I kept this from the original code.  I did not check
this carefully enough.  Note that I neither checked the code
of the vc-part of the original patch, not tested it.

   As for the auto-revert-flag thingy, I find it truly ugly because I don't
   like dired knowing about auto-revert just for the sake of verbosity control.
   There's got to be a better way.

Like what?  I need some way to tell not only dired, but other non-file
buffers as well, not to display the revert messages they usually do.
The only real way I see is using a flag variable and I need one
variable for all non-file buffers.  The only alternative I see would
be a similar variable inhibiting revert messages not "overtly" tied to
auto-revert.el.  I do not believe that would make a lot of difference
in practice, but it could be done.  Note that the code in question
first checks: (boundp 'auto-revert-flag), so if autoreverting is not
already in use, auto-revert.el will not be loaded (that would indeed
be terribly ugly).

I do not know whether you question the usefulness of the verbosity
control itself.  I implemented this because I felt a definite need for
it.  Constant gratuitous echo area messages are a distracting
nuisance, not to mention being overshouted by them while trying to use
the minibuffer and just hesitating slightly too long.

Here are the changes I propose to my original autorevert.el patch.
Essentially, I replaced the three separate (buffer-modified-p) checks
by one single one at the very start and used file-remote-p instead of
(string-match "@").  I could change the auto-revert-flag stuff once I
understand your concrete objections better.  Would a
not-officially-linked-to-autorevert.el flag variable disabling revert
messages (when set) in various non-file buffers, including dired
buffers, take care of your objections?  That would be easy to do.
However, I definitely want to keep the functionality as a user option,
disabled by default.

Diff with previous version of the patch:

===File ~/auto-revert-newdiff===============================
diff -c /home/teirllm/autorevert.prev.el /home/teirllm/emacscvsdir/emacs/lisp/autorevert.el
*** /home/teirllm/autorevert.prev.el	Wed Mar  3 17:38:24 2004
--- /home/teirllm/emacscvsdir/emacs/lisp/autorevert.el	Wed Mar  3 17:44:23 2004
***************
*** 278,312 ****
    "Check if current buffer should be reverted."
    ;;  - Always include VC buffers to list.  It would be too expensive
    ;;  to test the "revert" status here each time timer launches.
!   (or (and (eq major-mode 'dired-mode)
! 	   (or (and global-auto-revert-mode
! 		    global-auto-revert-non-file-buffers)
! 	       auto-revert-mode)
! 	   (not (buffer-modified-p))
! 	   (stringp dired-directory)
! 	   ;; Exclude remote buffers, would be too slow for user
! 	   ;; modem, timeouts, network lag ... all is possible
! 	   (not (string-match "@" dired-directory))
! 	   (file-directory-p dired-directory)
!            (file-readable-p dired-directory)
! 	   (not (let ((attributes (file-attributes dired-directory))
! 		      (modtime (visited-file-modtime)))
! 		  (or (eq modtime 0)
! 		      (not (eq (car attributes) t))
! 		      (and (= (car (nth 5 attributes)) (car modtime))
! 			   (= (nth 1 (nth 5 attributes)) (cdr modtime)))))))
!       (and (not (eq major-mode 'dired-mode))
! 	   (not (buffer-modified-p))
! 	   (auto-revert-vc-buffer-p))
!       (and (not (eq major-mode 'dired-mode))
! 	   (not (buffer-modified-p))
! 	   (if (buffer-file-name)
! 	       (and (file-readable-p (buffer-file-name))
! 		    (not (verify-visited-file-modtime (current-buffer))))
! 	     (and revert-buffer-function
! 		  (or (and global-auto-revert-mode
! 			   global-auto-revert-non-file-buffers)
! 		      auto-revert-mode))))))
  
  (defun auto-revert-vc-cvs-file-version (file)
    "Get version of FILE by reading control file on disk."
--- 278,310 ----
    "Check if current buffer should be reverted."
    ;;  - Always include VC buffers to list.  It would be too expensive
    ;;  to test the "revert" status here each time timer launches.
!   (unless (buffer-modified-p)
!     (or (and (eq major-mode 'dired-mode)
! 	     (or (and global-auto-revert-mode
! 		      global-auto-revert-non-file-buffers)
! 		 auto-revert-mode)
! 	     (stringp dired-directory)
! 	     ;; Exclude remote buffers, would be too slow for user
! 	     ;; modem, timeouts, network lag ... all is possible
! 	     (not (file-remote-p dired-directory))
! 	     (file-directory-p dired-directory)
! 	     (file-readable-p dired-directory)
! 	     (not (let ((attributes (file-attributes dired-directory))
! 			(modtime (visited-file-modtime)))
! 		    (or (eq modtime 0)
! 			(not (eq (car attributes) t))
! 			(and (= (car (nth 5 attributes)) (car modtime))
! 			     (= (nth 1 (nth 5 attributes)) (cdr modtime)))))))
! 	(and (not (eq major-mode 'dired-mode))
! 	     (auto-revert-vc-buffer-p))
! 	(and (not (eq major-mode 'dired-mode))
! 	     (if (buffer-file-name)
! 		 (and (file-readable-p (buffer-file-name))
! 		      (not (verify-visited-file-modtime (current-buffer))))
! 	       (and revert-buffer-function
! 		    (or (and global-auto-revert-mode
! 			     global-auto-revert-non-file-buffers)
! 			auto-revert-mode)))))))
  
  (defun auto-revert-vc-cvs-file-version (file)
    "Get version of FILE by reading control file on disk."

Diff finished.  Wed Mar  3 21:57:57 2004
============================================================

  reply	other threads:[~2004-03-04  5:08 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-02 23:19 autorevert.el Luc Teirlinck
2004-03-03 13:24 ` autorevert.el Stefan Monnier
2004-03-04  5:08   ` Luc Teirlinck [this message]
2004-03-04 20:43     ` autorevert.el Stefan Monnier
2004-03-05  4:00       ` autorevert.el Luc Teirlinck
2004-03-13  3:10         ` autorevert.el Luc Teirlinck
2004-03-13 11:29           ` autorevert.el Kai Grossjohann
2004-03-14 23:15           ` autorevert.el Stefan Monnier
2004-03-15  0:08             ` autorevert.el Luc Teirlinck
2004-03-15  2:58               ` autorevert.el Stefan Monnier
2004-03-15  7:04               ` autorevert.el Eli Zaretskii
2004-03-16  4:56                 ` autorevert.el Luc Teirlinck
2004-03-16 19:40                   ` autorevert.el Eli Zaretskii
2004-03-19  4:48                     ` autorevert.el Luc Teirlinck
2004-03-19  6:06                       ` autorevert.el Stefan Monnier
2004-03-21  2:42                         ` autorevert.el Luc Teirlinck
2004-03-23 15:26                           ` autorevert.el Stefan Monnier
2004-03-24  4:20                             ` autorevert.el Luc Teirlinck
2004-03-24  4:25                               ` autorevert.el Luc Teirlinck
2004-03-21  4:19                         ` autorevert.el Luc Teirlinck
2004-03-19 10:19                     ` autorevert.el Kim F. Storm
2004-03-19 14:46                       ` autorevert.el Eli Zaretskii
2004-03-21  3:26                         ` autorevert.el Luc Teirlinck
2004-03-21  6:46                           ` autorevert.el Eli Zaretskii
2004-03-22  2:44                             ` autorevert.el Luc Teirlinck
2004-03-22  6:51                               ` autorevert.el Eli Zaretskii
2004-03-22 19:39                                 ` autorevert.el Luc Teirlinck
2004-03-23 19:40                                   ` autorevert.el Eli Zaretskii
2004-03-23 20:09                                     ` autorevert.el Stefan Monnier
2004-03-24  4:10                                     ` autorevert.el Luc Teirlinck
2004-03-24  6:58                                       ` autorevert.el Eli Zaretskii
2004-03-24 18:03                                         ` autorevert.el Stefan Monnier
2004-03-25  6:56                                           ` autorevert.el Eli Zaretskii
2004-03-25 17:01                                             ` autorevert.el Stefan Monnier
2004-03-24 18:56                                         ` autorevert.el Luc Teirlinck
2004-03-25  6:20                                         ` autorevert.el Luc Teirlinck
2004-03-25  6:49                                           ` autorevert.el Luc Teirlinck
2004-03-25  7:21                                           ` autorevert.el Eli Zaretskii
2004-03-22 19:47                                 ` autorevert.el Luc Teirlinck
2004-03-22 16:23                               ` autorevert.el Stefan Monnier
2004-03-23  4:24                                 ` autorevert.el Eli Zaretskii
2004-03-21 19:22                           ` autorevert.el Richard Stallman
2004-03-16  5:06                 ` autorevert.el Luc Teirlinck
2004-03-05  4:25       ` autorevert.el Luc Teirlinck
2004-03-05  5:55       ` autorevert.el Luc Teirlinck
2004-03-04  5:34   ` autorevert.el Luc Teirlinck

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=200403040508.i2458W811551@raven.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    --cc=emacs-devel@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.