aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Albinus2015-11-25 15:00:06 +0100
committerMichael Albinus2015-11-25 15:07:12 +0100
commitbec57a486a2a40d7c770dab72a34cf6a4d17a5d0 (patch)
treeab824a9c680a488764c8a7bcb975c2b3015c9d5a /src
parent0247489fed0f70b2abf960de48bc4432381a581b (diff)
downloademacs-bec57a486a2a40d7c770dab72a34cf6a4d17a5d0.tar.gz
emacs-bec57a486a2a40d7c770dab72a34cf6a4d17a5d0.zip
Some final fixes in file notification before merging with master
* lisp/filenotify.el (file-notify--rm-descriptor): Remove WHAT arg. (file-notify-callback): Improve check for `stopped' event. Call `file-notify-rm-watch' rather than `file-notify--rm-descriptor'. (file-notify-add-watch): In case FILE is not a directory, call the file monitor for the kqueue backend. Otherwise, call the directory monitor for the upper directory. * src/inotify.c (inotifyevent_to_event): Extract file name from watch_object if the event doesn't provide it. (Finotify_add_watch): Add file name to watch_object. * test/automated/file-notify-tests.el (file-notify--test-timeout): Use different timeouts for different libraries. (file-notify--test-with-events): Suppress lock files. Flush outstanding events before running the body. (file-notify-test02-events, file-notify-test04-file-validity): Do not skip cygwin tests. Add additional test for file creation. Adapt expected result for different backends. (file-notify-test03-autorevert): Some of the tests don't work for w32notify. (file-notify-test06-many-events): Rename into both directions.
Diffstat (limited to 'src')
-rw-r--r--src/inotify.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/inotify.c b/src/inotify.c
index d1a80bbad1b..6577ee28cd1 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -46,8 +46,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
46static int inotifyfd = -1; 46static int inotifyfd = -1;
47 47
48/* Assoc list of files being watched. 48/* Assoc list of files being watched.
49 Format: 49 Format: (watch-descriptor name callback)
50 (watch-descriptor . callback)
51 */ 50 */
52static Lisp_Object watch_list; 51static Lisp_Object watch_list;
53 52
@@ -106,12 +105,14 @@ inotifyevent_to_event (Lisp_Object watch_object, struct inotify_event const *ev)
106 name = make_unibyte_string (ev->name, min (len, ev->len)); 105 name = make_unibyte_string (ev->name, min (len, ev->len));
107 name = DECODE_FILE (name); 106 name = DECODE_FILE (name);
108 } 107 }
108 else
109 name = XCAR (XCDR (watch_object));
109 110
110 return list2 (list4 (make_watch_descriptor (ev->wd), 111 return list2 (list4 (make_watch_descriptor (ev->wd),
111 mask_to_aspects (ev->mask), 112 mask_to_aspects (ev->mask),
112 name, 113 name,
113 make_number (ev->cookie)), 114 make_number (ev->cookie)),
114 XCDR (watch_object)); 115 Fnth (make_number (2), watch_object));
115} 116}
116 117
117/* This callback is called when the FD is available for read. The inotify 118/* This callback is called when the FD is available for read. The inotify
@@ -325,7 +326,7 @@ is managed internally and there is no corresponding inotify_init. Use
325 watch_list = Fdelete (watch_object, watch_list); 326 watch_list = Fdelete (watch_object, watch_list);
326 327
327 /* Store watch object in watch list. */ 328 /* Store watch object in watch list. */
328 watch_object = Fcons (watch_descriptor, callback); 329 watch_object = list3 (watch_descriptor, encoded_file_name, callback);
329 watch_list = Fcons (watch_object, watch_list); 330 watch_list = Fcons (watch_object, watch_list);
330 331
331 return watch_descriptor; 332 return watch_descriptor;