aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2013-11-27 18:03:02 +0200
committerEli Zaretskii2013-11-27 18:03:02 +0200
commitfb6a5d68e3cbb993a9c72f0bf20e74951e873e72 (patch)
treeaa04b16d9963e2720f629634993fd6d1400ea6cf /src
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/w32notify.c22
2 files changed, 21 insertions, 7 deletions
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;