aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMichael Albinus2015-09-23 20:34:22 +0200
committerMichael Albinus2015-09-23 20:34:22 +0200
commitcad8aef3241efa0873fb0c003b563cf31a4c0f2e (patch)
tree1649ac34fcef3f59900b6860360460d230e3f7b6 /lisp
parent4c0fed13e5ca1826bab52cd9c3fc31ad0e5c765c (diff)
downloademacs-cad8aef3241efa0873fb0c003b563cf31a4c0f2e.tar.gz
emacs-cad8aef3241efa0873fb0c003b563cf31a4c0f2e.zip
Continue gfilenotify.c implementation of missing parts
* lisp/filenotify.el (file-notify-add-watch): Append `flags' to `gfile-add-watch' call. (file-notify-rm-watch): Modify `file-notify-descriptors' only after calling the low level functions. * src/gfilenotify.c (dir_monitor_callback): Check, whether event_type is expected. (Fgfile_add_watch): Allow also `change'and `attribute-change' for FLAGS. (Fgfile_rm_watch): Fix typo. (syms_of_gfilenotify): Declare Qchange and Qattribute_change.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/filenotify.el34
1 files changed, 16 insertions, 18 deletions
diff --git a/lisp/filenotify.el b/lisp/filenotify.el
index e2c0af0d1b7..d48d3f94bc6 100644
--- a/lisp/filenotify.el
+++ b/lisp/filenotify.el
@@ -291,7 +291,7 @@ FILE is the name of the file whose event is being reported."
291 291
292 ;; Determine respective flags. 292 ;; Determine respective flags.
293 (if (eq file-notify--library 'gfilenotify) 293 (if (eq file-notify--library 'gfilenotify)
294 (setq l-flags '(watch-mounts send-moved)) 294 (setq l-flags (append '(watch-mounts send-moved) flags))
295 (when (memq 'change flags) 295 (when (memq 'change flags)
296 (setq 296 (setq
297 l-flags 297 l-flags
@@ -330,7 +330,21 @@ DESCRIPTOR should be an object returned by `file-notify-add-watch'."
330 handler registered) 330 handler registered)
331 331
332 (when (stringp dir) 332 (when (stringp dir)
333 ;; Call low-level function.
333 (setq handler (find-file-name-handler dir 'file-notify-rm-watch)) 334 (setq handler (find-file-name-handler dir 'file-notify-rm-watch))
335 (condition-case nil
336 (if handler
337 ;; A file name handler could exist even if there is no
338 ;; local file notification support.
339 (funcall handler 'file-notify-rm-watch desc)
340
341 (funcall
342 (cond
343 ((eq file-notify--library 'gfilenotify) 'gfile-rm-watch)
344 ((eq file-notify--library 'inotify) 'inotify-rm-watch)
345 ((eq file-notify--library 'w32notify) 'w32notify-rm-watch))
346 desc))
347 (file-notify-error nil))
334 348
335 ;; Modify `file-notify-descriptors'. 349 ;; Modify `file-notify-descriptors'.
336 (if (not file) 350 (if (not file)
@@ -341,23 +355,7 @@ DESCRIPTOR should be an object returned by `file-notify-add-watch'."
341 (delete (assoc file (cdr registered)) (cdr registered))) 355 (delete (assoc file (cdr registered)) (cdr registered)))
342 (if (null (cdr registered)) 356 (if (null (cdr registered))
343 (remhash desc file-notify-descriptors) 357 (remhash desc file-notify-descriptors)
344 (puthash desc registered file-notify-descriptors))) 358 (puthash desc registered file-notify-descriptors))))))
345
346 ;; Call low-level function.
347 (when (null (cdr registered))
348 (condition-case nil
349 (if handler
350 ;; A file name handler could exist even if there is no local
351 ;; file notification support.
352 (funcall handler 'file-notify-rm-watch desc)
353
354 (funcall
355 (cond
356 ((eq file-notify--library 'gfilenotify) 'gfile-rm-watch)
357 ((eq file-notify--library 'inotify) 'inotify-rm-watch)
358 ((eq file-notify--library 'w32notify) 'w32notify-rm-watch))
359 desc))
360 (file-notify-error nil))))))
361 359
362(defun file-notify-valid-p (descriptor) 360(defun file-notify-valid-p (descriptor)
363 "Check a watch specified by its DESCRIPTOR. 361 "Check a watch specified by its DESCRIPTOR.