summaryrefslogtreecommitdiff
path: root/lisp/filenotify.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/filenotify.el')
-rw-r--r--lisp/filenotify.el29
1 files changed, 16 insertions, 13 deletions
diff --git a/lisp/filenotify.el b/lisp/filenotify.el
index 21c9cc23df9..a133f9ea7ec 100644
--- a/lisp/filenotify.el
+++ b/lisp/filenotify.el
@@ -45,11 +45,11 @@ could use another implementation.")
(:constructor nil)
(:constructor
file-notify--watch-make (directory filename callback)))
- ;; Watched directory
+ ;; Watched directory.
directory
;; Watched relative filename, nil if watching the directory.
filename
- ;; Function to propagate events to
+ ;; Function to propagate events to.
callback)
(defun file-notify--watch-absolute-filename (watch)
@@ -242,11 +242,10 @@ EVENT is the cadr of the event in `file-notify-handle-event'
;;(message
;;"file-notify-callback %S %S %S %S %S"
;;desc action file file1 watch)
- (if file1
- (funcall (file-notify--watch-callback watch)
- `(,desc ,action ,file ,file1))
- (funcall (file-notify--watch-callback watch)
- `(,desc ,action ,file))))
+ (funcall (file-notify--watch-callback watch)
+ (if file1
+ `(,desc ,action ,file ,file1)
+ `(,desc ,action ,file))))
;; Send `stopped' event.
(when (or stopped
@@ -307,12 +306,12 @@ FILE is the name of the file whose event is being reported."
(unless (functionp callback)
(signal 'wrong-type-argument `(,callback)))
- (let* ((handler (find-file-name-handler file 'file-notify-add-watch))
- (dir (directory-file-name
- (if (file-directory-p file)
- file
- (file-name-directory file))))
- desc func l-flags)
+ (let ((handler (find-file-name-handler file 'file-notify-add-watch))
+ (dir (directory-file-name
+ (if (file-directory-p file)
+ file
+ (file-name-directory file))))
+ desc func l-flags)
(unless (file-directory-p dir)
(signal 'file-notify-error `("Directory does not exist" ,dir)))
@@ -363,6 +362,10 @@ FILE is the name of the file whose event is being reported."
func (if (eq file-notify--library 'kqueue) file dir)
l-flags 'file-notify-callback)))
+ ;; We do not want to enter quoted file names into the hash.
+ (setq file (file-name-unquote file)
+ dir (file-name-unquote dir))
+
;; Modify `file-notify-descriptors'.
(let ((watch (file-notify--watch-make
dir