unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] autorevert.el -- revert fix for Windows platform
@ 2007-03-22 11:27 Jari Aalto
  2007-03-22 15:00 ` Chong Yidong
  2007-03-22 22:50 ` Richard Stallman
  0 siblings, 2 replies; 32+ messages in thread
From: Jari Aalto @ 2007-03-22 11:27 UTC (permalink / raw)
  To: emacs-devel


For some reason the `verify-visited-file-modtime' test in
auto-revert-buffers is not enough to notice a file change under
Windows / native Emacs 21.3. Here is patch to compare the bufer size
against files size on disk. It cures the revert problem.

The patch is against CVS 2007-03-22

2007-03-22 Thu Jari Aalto <jari aalto A T cante net>

	* autorevert.el
	(auto-revert-size-equal-p): New function.
	(auto-revert-handler): Use `auto-revert-size-equal-p' to
	test file change as well.

=== modified file 'autorevert.el'
--- autorevert.el       2007-03-22 11:05:43 +0000
+++ autorevert.el       2007-03-22 11:24:06 +0000
@@ -302,7 +302,6 @@
     (auto-revert-buffers)
     (setq auto-revert-tail-mode nil)))

-
 ;;;###autoload
 (defun turn-on-auto-revert-mode ()
   "Turn on Auto-Revert Mode.
@@ -396,6 +395,11 @@
        (not (memq major-mode
                  global-auto-revert-ignore-modes)))))

+(defun auto-revert-size-equal-p ()
+  (let ((bsize (buffer-size))
+        (fsize (nth 7 (file-attributes (buffer-file-name)))))
+    (eq bsize fsize)))
+
 (defun auto-revert-handler ()
   "Revert current buffer, if appropriate.
 This is an internal function used by Auto-Revert Mode."
@@ -405,7 +409,9 @@
            (or (and buffer-file-name
                     (not (file-remote-p buffer-file-name))
                     (file-readable-p buffer-file-name)
-                    (not (verify-visited-file-modtime buffer)))
+                     (or
+                      (not (verify-visited-file-modtime buffer))
+                      (not (auto-revert-size-equal-p))))
                (and (or auto-revert-mode
                         global-auto-revert-non-file-buffers)
                     revert-buffer-function

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2007-03-25 19:09 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-22 11:27 [PATCH] autorevert.el -- revert fix for Windows platform Jari Aalto
2007-03-22 15:00 ` Chong Yidong
2007-03-22 15:56   ` Lennart Borgman (gmail)
2007-03-22 17:49     ` Jason Rumney
2007-03-23 13:26       ` Eli Zaretskii
2007-03-23 17:31         ` Jari Aalto
2007-03-23 20:36           ` Jason Rumney
2007-03-23 23:07             ` Jason Rumney
2007-03-24 10:52               ` martin rudalics
2007-03-24 11:11                 ` Jason Rumney
2007-03-24 11:25                   ` Johan Bockgård
2007-03-24 11:46                     ` Jason Rumney
2007-03-24 11:32                   ` martin rudalics
2007-03-24 18:21             ` Eli Zaretskii
2007-03-24 22:56               ` Kim F. Storm
2007-03-25  4:13                 ` Eli Zaretskii
2007-03-24 14:46           ` Eli Zaretskii
2007-03-23  7:03   ` Jari Aalto
2007-03-23 14:10     ` Eli Zaretskii
2007-03-23 15:47       ` Kim F. Storm
2007-03-23 16:51         ` Jason Rumney
2007-03-23 18:48           ` Luc Teirlinck
2007-03-24 14:59             ` Eli Zaretskii
2007-03-23 22:41           ` Stefan Monnier
2007-03-24 23:50             ` Kim F. Storm
2007-03-25  0:24               ` Luc Teirlinck
2007-03-25  1:09                 ` Kim F. Storm
2007-03-25 19:09                   ` Stefan Monnier
2007-03-23 16:57         ` Stefan Monnier
2007-03-24 14:49         ` Eli Zaretskii
2007-03-23 13:25   ` Eli Zaretskii
2007-03-22 22:50 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).