diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2015-09-23 20:34:22 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2015-09-23 20:34:22 +0200 |
commit | cad8aef3241efa0873fb0c003b563cf31a4c0f2e (patch) | |
tree | 1649ac34fcef3f59900b6860360460d230e3f7b6 /lisp/filenotify.el | |
parent | 4c0fed13e5ca1826bab52cd9c3fc31ad0e5c765c (diff) | |
download | emacs-cad8aef3241efa0873fb0c003b563cf31a4c0f2e.tar.gz |
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/filenotify.el')
-rw-r--r-- | lisp/filenotify.el | 34 |
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." ;; Determine respective flags. (if (eq file-notify--library 'gfilenotify) - (setq l-flags '(watch-mounts send-moved)) + (setq l-flags (append '(watch-mounts send-moved) flags)) (when (memq 'change flags) (setq l-flags @@ -330,7 +330,21 @@ DESCRIPTOR should be an object returned by `file-notify-add-watch'." handler registered) (when (stringp dir) + ;; Call low-level function. (setq handler (find-file-name-handler dir 'file-notify-rm-watch)) + (condition-case nil + (if handler + ;; A file name handler could exist even if there is no + ;; local file notification support. + (funcall handler 'file-notify-rm-watch desc) + + (funcall + (cond + ((eq file-notify--library 'gfilenotify) 'gfile-rm-watch) + ((eq file-notify--library 'inotify) 'inotify-rm-watch) + ((eq file-notify--library 'w32notify) 'w32notify-rm-watch)) + desc)) + (file-notify-error nil)) ;; Modify `file-notify-descriptors'. (if (not file) @@ -341,23 +355,7 @@ DESCRIPTOR should be an object returned by `file-notify-add-watch'." (delete (assoc file (cdr registered)) (cdr registered))) (if (null (cdr registered)) (remhash desc file-notify-descriptors) - (puthash desc registered file-notify-descriptors))) - - ;; Call low-level function. - (when (null (cdr registered)) - (condition-case nil - (if handler - ;; A file name handler could exist even if there is no local - ;; file notification support. - (funcall handler 'file-notify-rm-watch desc) - - (funcall - (cond - ((eq file-notify--library 'gfilenotify) 'gfile-rm-watch) - ((eq file-notify--library 'inotify) 'inotify-rm-watch) - ((eq file-notify--library 'w32notify) 'w32notify-rm-watch)) - desc)) - (file-notify-error nil)))))) + (puthash desc registered file-notify-descriptors)))))) (defun file-notify-valid-p (descriptor) "Check a watch specified by its DESCRIPTOR. |