[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: File watch support in autorevert.el
From: |
Michael Albinus |
Subject: |
Re: File watch support in autorevert.el |
Date: |
Sat, 12 Jan 2013 14:08:42 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Eli Zaretskii <address@hidden> writes:
> I needed to make 2 changes to get this to work on Windows, see trunk
> revision 111499. Actually, I don't understand how it worked with
> inotify before my changes, since you were looking for 'modify' in the
> descriptor rather than in the action. Did I miss something?
You're right, I've introduced a bug here at the very end of my tests
last night.
> Btw, should we perhaps do something more sophisticated than
> string-equal to compare file names? On Windows, we probably should
> compare case-insensitively, but what about file-truename and friends
> on Posix platforms?
What about `file-equal-p'? Like
--8<---------------cut here---------------start------------->8---
~/src/emacs> bzr diff lisp/autorevert.el
=== modified file 'lisp/autorevert.el'
--- lisp/autorevert.el 2013-01-12 11:25:39 +0000
+++ lisp/autorevert.el 2013-01-12 13:06:19 +0000
@@ -531,17 +531,11 @@
(when (featurep 'inotify) (cl-assert (memq 'modify action)))
(when (featurep 'w32notify) (cl-assert (eq 'modified action)))
(cl-assert (bufferp buffer))
- (when (stringp file)
- (cl-assert (string-equal
- ;; w32notify returns the basename of the file
- ;; without its leading directories; inotify
- ;; returns its full absolute file name.
- (file-name-nondirectory (directory-file-name file))
- (file-name-nondirectory (directory-file-name
- (buffer-file-name buffer))))))
-
- ;; Mark buffer modified.
(with-current-buffer buffer
+ (when (and (stringp file) (stringp buffer-file-name))
+ (cl-assert (file-equal file buffer-file-name)))
+
+ ;; Mark buffer modified.
(setq auto-revert-notify-modified-p t))))))
(defun auto-revert-active-p ()
--8<---------------cut here---------------end--------------->8---
The disadvantage might be performance, because `file-equal-p' performs
operations on the filesystem, like `file-attributes' etc. When all files
in a directory are watched, there will be a lot of events to be ignored.
Is this acceptable?
Best regards, Michael.
- Re: File watch support in autorevert.el, (continued)
- Re: File watch support in autorevert.el, Eli Zaretskii, 2013/01/11
- Re: File watch support in autorevert.el, Stefan Monnier, 2013/01/11
- Re: File watch support in autorevert.el, Michael Albinus, 2013/01/11
- Re: File watch support in autorevert.el, Eli Zaretskii, 2013/01/12
- Re: File watch support in autorevert.el, Michael Albinus, 2013/01/12
- Re: File watch support in autorevert.el, Eli Zaretskii, 2013/01/12
- Re: File watch support in autorevert.el, Michael Albinus, 2013/01/12
Re: File watch support in autorevert.el, Michael Albinus, 2013/01/11
Re: File watch support in autorevert.el, Michael Albinus, 2013/01/11
- Re: File watch support in autorevert.el, Eli Zaretskii, 2013/01/12
- Re: File watch support in autorevert.el,
Michael Albinus <=
- Re: File watch support in autorevert.el, Michael Albinus, 2013/01/12
- Re: File watch support in autorevert.el, Eli Zaretskii, 2013/01/12
- Re: File watch support in autorevert.el, Michael Albinus, 2013/01/12
- Re: File watch support in autorevert.el, Eli Zaretskii, 2013/01/12
- Re: File watch support in autorevert.el, Michael Albinus, 2013/01/12