From: Michael Albinus <michael.albinus@gmx.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: File watch support in autorevert.el
Date: Sat, 12 Jan 2013 14:08:42 +0100 [thread overview]
Message-ID: <87d2xatup1.fsf@gmx.de> (raw)
In-Reply-To: <837gnitz6o.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 12 Jan 2013 13:31:43 +0200")
Eli Zaretskii <eliz@gnu.org> 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.
next prev parent reply other threads:[~2013-01-12 13:08 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-10 14:28 File watch support in autorevert.el Michael Albinus
2013-01-10 17:11 ` Stefan Monnier
2013-01-10 17:14 ` Lennart Borgman
2013-01-10 20:38 ` Michael Albinus
2013-01-11 10:05 ` Eli Zaretskii
2013-01-11 14:34 ` Stefan Monnier
2013-01-11 14:43 ` Eli Zaretskii
2013-01-11 15:01 ` Michael Albinus
2013-01-11 15:50 ` Eli Zaretskii
2013-01-11 16:09 ` Michael Albinus
2013-01-11 19:19 ` Eli Zaretskii
2013-01-11 16:19 ` Michael Albinus
2013-01-11 16:39 ` Stefan Monnier
2013-01-11 22:43 ` Michael Albinus
2013-01-12 11:28 ` Eli Zaretskii
2013-01-12 13:34 ` Michael Albinus
2013-01-12 15:09 ` Eli Zaretskii
2013-01-12 19:08 ` Michael Albinus
2013-01-17 9:38 ` Michael Albinus
2013-01-17 16:54 ` Eli Zaretskii
2013-01-17 19:19 ` Michael Albinus
2013-01-17 19:39 ` Eli Zaretskii
2013-01-11 15:57 ` Stefan Monnier
2013-01-11 15:18 ` Michael Albinus
2013-01-11 15:57 ` Eli Zaretskii
2013-01-11 16:31 ` Michael Albinus
2013-01-11 18:47 ` Eli Zaretskii
2013-01-11 16:44 ` Stefan Monnier
2013-01-11 22:47 ` Michael Albinus
2013-01-12 11:36 ` Eli Zaretskii
2013-01-12 13:14 ` Michael Albinus
2013-01-12 14:06 ` Eli Zaretskii
2013-01-12 14:16 ` Michael Albinus
2013-01-11 22:39 ` Michael Albinus
2013-01-11 23:01 ` Michael Albinus
2013-01-12 11:31 ` Eli Zaretskii
2013-01-12 13:08 ` Michael Albinus [this message]
2013-01-12 13:26 ` Michael Albinus
2013-01-12 14:03 ` Eli Zaretskii
2013-01-12 14:12 ` Michael Albinus
2013-01-12 14:39 ` Eli Zaretskii
2013-01-12 19:04 ` Michael Albinus
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d2xatup1.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=eliz@gnu.org \
--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 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).