aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2016-02-22 22:05:00 +0100
committerMichael Albinus2016-02-22 22:05:00 +0100
commit1bc0e0a5b7184cf78ae94bb7d46f25f1c2a02654 (patch)
treecd3431df2c0bf9f5744924a39754958999609fc7
parenta9c48d5c9e3cb5952aab1c6e8821677d49068a74 (diff)
downloademacs-1bc0e0a5b7184cf78ae94bb7d46f25f1c2a02654.tar.gz
emacs-1bc0e0a5b7184cf78ae94bb7d46f25f1c2a02654.zip
Minor fixes in filenotify.el
* lisp/filenotify.el (top): Require 'cl-lib. (file-notify--rm-descriptor) (file-notify--event-watched-file): Use cl-caadr. (file-notify-callback): Handle also `ignore' events from inotify.
-rw-r--r--lisp/filenotify.el19
1 files changed, 10 insertions, 9 deletions
diff --git a/lisp/filenotify.el b/lisp/filenotify.el
index 21046a85a7a..f8a53631135 100644
--- a/lisp/filenotify.el
+++ b/lisp/filenotify.el
@@ -27,8 +27,7 @@
27 27
28;;; Code: 28;;; Code:
29 29
30(eval-when-compile 30(require 'cl-lib)
31 (require 'cl))
32 31
33(defconst file-notify--library 32(defconst file-notify--library
34 (cond 33 (cond
@@ -58,7 +57,7 @@ DESCRIPTOR should be an object returned by `file-notify-add-watch'.
58If it is registered in `file-notify-descriptors', a stopped event is sent." 57If it is registered in `file-notify-descriptors', a stopped event is sent."
59 (let* ((desc (if (consp descriptor) (car descriptor) descriptor)) 58 (let* ((desc (if (consp descriptor) (car descriptor) descriptor))
60 (registered (gethash desc file-notify-descriptors)) 59 (registered (gethash desc file-notify-descriptors))
61 (file (if (consp descriptor) (cdr descriptor) (caadr registered))) 60 (file (if (consp descriptor) (cdr descriptor) (cl-caadr registered)))
62 (dir (car registered))) 61 (dir (car registered)))
63 62
64 (when (consp registered) 63 (when (consp registered)
@@ -104,7 +103,7 @@ It is a form ((DESCRIPTOR ACTION FILE [FILE1-OR-COOKIE]) CALLBACK).")
104Could be different from the directory watched by the backend library." 103Could be different from the directory watched by the backend library."
105 (let* ((desc (if (consp (car event)) (caar event) (car event))) 104 (let* ((desc (if (consp (car event)) (caar event) (car event)))
106 (registered (gethash desc file-notify-descriptors)) 105 (registered (gethash desc file-notify-descriptors))
107 (file (if (consp (car event)) (cdar event) (caadr registered))) 106 (file (if (consp (car event)) (cdar event) (cl-caadr registered)))
108 (dir (car registered))) 107 (dir (car registered)))
109 (if file (expand-file-name file dir) dir))) 108 (if file (expand-file-name file dir) dir)))
110 109
@@ -274,11 +273,13 @@ EVENT is the cadr of the event in `file-notify-handle-event'
274 `(,(file-notify--descriptor desc (car entry)) ,action ,file)))) 273 `(,(file-notify--descriptor desc (car entry)) ,action ,file))))
275 274
276 ;; Send `stopped' event. 275 ;; Send `stopped' event.
277 (when (and (memq action '(deleted renamed)) 276 (when (or stopped
278 ;; Not, when a file is backed up. 277 (and (memq action '(deleted renamed))
279 (not (and (stringp file1) (backup-file-name-p file1))) 278 ;; Not, when a file is backed up.
280 ;; Watched file or directory is concerned. 279 (not (and (stringp file1) (backup-file-name-p file1)))
281 (string-equal file (file-notify--event-watched-file event))) 280 ;; Watched file or directory is concerned.
281 (string-equal
282 file (file-notify--event-watched-file event))))
282 (file-notify-rm-watch (file-notify--descriptor desc (car entry)))))))) 283 (file-notify-rm-watch (file-notify--descriptor desc (car entry))))))))
283 284
284;; `kqueue', `gfilenotify' and `w32notify' return a unique descriptor 285;; `kqueue', `gfilenotify' and `w32notify' return a unique descriptor