aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2013-11-27 18:03:02 +0200
committerEli Zaretskii2013-11-27 18:03:02 +0200
commitfb6a5d68e3cbb993a9c72f0bf20e74951e873e72 (patch)
treeaa04b16d9963e2720f629634993fd6d1400ea6cf
parent1baa1e49d84061e964802eba34713052804185f8 (diff)
downloademacs-fb6a5d68e3cbb993a9c72f0bf20e74951e873e72.tar.gz
emacs-fb6a5d68e3cbb993a9c72f0bf20e74951e873e72.zip
Fix watching directories using w32notify.c.
src/w32notify.c (Fw32notify_add_watch): If the argument FILE is a directory, watch it and not its parent. (add_watch): Allow empty string in FILE. lisp/filenotify.el (file-notify-add-watch): Don't special-case w32notify when computing the directory to watch.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/filenotify.el3
-rw-r--r--src/ChangeLog6
-rw-r--r--src/w32notify.c22
4 files changed, 27 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 50f587d1126..3ff0a40b2e4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12013-11-27 Eli Zaretskii <eliz@gnu.org>
2
3 * filenotify.el (file-notify-add-watch): Don't special-case
4 w32notify when computing the directory to watch.
5
12013-11-27 Glenn Morris <rgm@gnu.org> 62013-11-27 Glenn Morris <rgm@gnu.org>
2 7
3 Make bootstrap without generated uni-*.el files possible again. 8 Make bootstrap without generated uni-*.el files possible again.
diff --git a/lisp/filenotify.el b/lisp/filenotify.el
index c980d720714..72ee0ced785 100644
--- a/lisp/filenotify.el
+++ b/lisp/filenotify.el
@@ -237,8 +237,7 @@ FILE is the name of the file whose event is being reported."
237 237
238 (let* ((handler (find-file-name-handler file 'file-notify-add-watch)) 238 (let* ((handler (find-file-name-handler file 'file-notify-add-watch))
239 (dir (directory-file-name 239 (dir (directory-file-name
240 (if (or (and (not handler) (eq file-notify--library 'w32notify)) 240 (if (file-directory-p file)
241 (file-directory-p file))
242 file 241 file
243 (file-name-directory file)))) 242 (file-name-directory file))))
244 desc func l-flags) 243 desc func l-flags)
diff --git a/src/ChangeLog b/src/ChangeLog
index 7b518fdc239..b43f758cec4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12013-11-27 Eli Zaretskii <eliz@gnu.org>
2
3 * w32notify.c (Fw32notify_add_watch): If the argument FILE is a
4 directory, watch it and not its parent.
5 (add_watch): Allow empty string in FILE.
6
12013-11-27 Martin Rudalics <rudalics@gmx.at> 72013-11-27 Martin Rudalics <rudalics@gmx.at>
2 8
3 * window.c (Fset_window_start, window_resize_apply) 9 * window.c (Fset_window_start, window_resize_apply)
diff --git a/src/w32notify.c b/src/w32notify.c
index a48a83daf53..1f2ef83b2fd 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -324,7 +324,7 @@ add_watch (const char *parent_dir, const char *file, BOOL subdirs, DWORD flags)
324 HANDLE hdir; 324 HANDLE hdir;
325 struct notification *dirwatch = NULL; 325 struct notification *dirwatch = NULL;
326 326
327 if (!file || !*file) 327 if (!file)
328 return NULL; 328 return NULL;
329 329
330 hdir = CreateFile (parent_dir, 330 hdir = CreateFile (parent_dir,
@@ -526,13 +526,21 @@ generate notifications correctly, though. */)
526 report_file_error ("GetFullPathName failed", 526 report_file_error ("GetFullPathName failed",
527 Fcons (lisp_errstr, Fcons (file, Qnil))); 527 Fcons (lisp_errstr, Fcons (file, Qnil)));
528 } 528 }
529 /* We need the parent directory without the slash that follows it. 529 /* filenotify.el always passes us a directory, either the parent
530 If BASENAME is NULL, the argument was the root directory on its 530 directory of a file to be watched, or the directory to be
531 drive. */ 531 watched. */
532 if (basename) 532 if (file_directory_p (parent_dir))
533 basename[-1] = '\0'; 533 basename = "";
534 else 534 else
535 subdirs = TRUE; 535 {
536 /* This should only happen if we are called directly, not via
537 filenotify.el. If BASENAME is NULL, the argument was the
538 root directory on its drive. */
539 if (basename)
540 basename[-1] = '\0';
541 else
542 subdirs = TRUE;
543 }
536 544
537 if (!NILP (Fmember (Qsubtree, filter))) 545 if (!NILP (Fmember (Qsubtree, filter)))
538 subdirs = TRUE; 546 subdirs = TRUE;