emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115258: Fix watching directories using w32notify.c.


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r115258: Fix watching directories using w32notify.c.
Date: Wed, 27 Nov 2013 16:03:42 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115258
revision-id: address@hidden
parent: address@hidden
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Wed 2013-11-27 18:03:02 +0200
message:
  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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/filenotify.el             filenotify.el-20130625113410-31so8z8hgotqv5s4-1
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/w32notify.c                w32notify.c-20121007123611-xyh65j2ka2vm684f-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-11-27 08:21:19 +0000
+++ b/lisp/ChangeLog    2013-11-27 16:03:02 +0000
@@ -1,3 +1,8 @@
+2013-11-27  Eli Zaretskii  <address@hidden>
+
+       * filenotify.el (file-notify-add-watch): Don't special-case
+       w32notify when computing the directory to watch.
+
 2013-11-27  Glenn Morris  <address@hidden>
 
        Make bootstrap without generated uni-*.el files possible again.

=== modified file 'lisp/filenotify.el'
--- a/lisp/filenotify.el        2013-11-19 09:47:02 +0000
+++ b/lisp/filenotify.el        2013-11-27 16:03:02 +0000
@@ -237,8 +237,7 @@
 
   (let* ((handler (find-file-name-handler file 'file-notify-add-watch))
         (dir (directory-file-name
-              (if (or (and (not handler) (eq file-notify--library 'w32notify))
-                      (file-directory-p file))
+              (if (file-directory-p file)
                   file
                 (file-name-directory file))))
        desc func l-flags)

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-11-27 07:44:48 +0000
+++ b/src/ChangeLog     2013-11-27 16:03:02 +0000
@@ -1,3 +1,9 @@
+2013-11-27  Eli Zaretskii  <address@hidden>
+
+       * 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.
+
 2013-11-27  Martin Rudalics  <address@hidden>
 
        * window.c (Fset_window_start, window_resize_apply)

=== modified file 'src/w32notify.c'
--- a/src/w32notify.c   2013-08-03 03:29:03 +0000
+++ b/src/w32notify.c   2013-11-27 16:03:02 +0000
@@ -324,7 +324,7 @@
   HANDLE hdir;
   struct notification *dirwatch = NULL;
 
-  if (!file || !*file)
+  if (!file)
     return NULL;
 
   hdir = CreateFile (parent_dir,
@@ -526,13 +526,21 @@
       report_file_error ("GetFullPathName failed",
                         Fcons (lisp_errstr, Fcons (file, Qnil)));
     }
-  /* We need the parent directory without the slash that follows it.
-     If BASENAME is NULL, the argument was the root directory on its
-     drive.  */
-  if (basename)
-    basename[-1] = '\0';
+  /* filenotify.el always passes us a directory, either the parent
+     directory of a file to be watched, or the directory to be
+     watched.  */
+  if (file_directory_p (parent_dir))
+    basename = "";
   else
-    subdirs = TRUE;
+    {
+      /* This should only happen if we are called directly, not via
+        filenotify.el.  If BASENAME is NULL, the argument was the
+        root directory on its drive.  */
+      if (basename)
+       basename[-1] = '\0';
+      else
+       subdirs = TRUE;
+    }
 
   if (!NILP (Fmember (Qsubtree, filter)))
     subdirs = TRUE;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]