aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/filenotify.el33
1 files changed, 17 insertions, 16 deletions
diff --git a/lisp/filenotify.el b/lisp/filenotify.el
index d48d3f94bc6..a07f99adcbf 100644
--- a/lisp/filenotify.el
+++ b/lisp/filenotify.el
@@ -327,30 +327,31 @@ DESCRIPTOR should be an object returned by `file-notify-add-watch'."
327 (let* ((desc (if (consp descriptor) (car descriptor) descriptor)) 327 (let* ((desc (if (consp descriptor) (car descriptor) descriptor))
328 (file (if (consp descriptor) (cdr descriptor))) 328 (file (if (consp descriptor) (cdr descriptor)))
329 (dir (car (gethash desc file-notify-descriptors))) 329 (dir (car (gethash desc file-notify-descriptors)))
330 handler registered) 330 (handler (and (stringp dir)
331 (find-file-name-handler dir 'file-notify-rm-watch)))
332 (registered (gethash desc file-notify-descriptors)))
331 333
332 (when (stringp dir) 334 (when (stringp dir)
333 ;; Call low-level function. 335 ;; Call low-level function.
334 (setq handler (find-file-name-handler dir 'file-notify-rm-watch)) 336 (when (null (cdr registered))
335 (condition-case nil 337 (condition-case nil
336 (if handler 338 (if handler
337 ;; A file name handler could exist even if there is no 339 ;; A file name handler could exist even if there is no local
338 ;; local file notification support. 340 ;; file notification support.
339 (funcall handler 'file-notify-rm-watch desc) 341 (funcall handler 'file-notify-rm-watch desc)
340 342
341 (funcall 343 (funcall
342 (cond 344 (cond
343 ((eq file-notify--library 'gfilenotify) 'gfile-rm-watch) 345 ((eq file-notify--library 'gfilenotify) 'gfile-rm-watch)
344 ((eq file-notify--library 'inotify) 'inotify-rm-watch) 346 ((eq file-notify--library 'inotify) 'inotify-rm-watch)
345 ((eq file-notify--library 'w32notify) 'w32notify-rm-watch)) 347 ((eq file-notify--library 'w32notify) 'w32notify-rm-watch))
346 desc)) 348 desc))
347 (file-notify-error nil)) 349 (file-notify-error nil)))
348 350
349 ;; Modify `file-notify-descriptors'. 351 ;; Modify `file-notify-descriptors'.
350 (if (not file) 352 (if (not file)
351 (remhash desc file-notify-descriptors) 353 (remhash desc file-notify-descriptors)
352 354
353 (setq registered (gethash desc file-notify-descriptors))
354 (setcdr registered 355 (setcdr registered
355 (delete (assoc file (cdr registered)) (cdr registered))) 356 (delete (assoc file (cdr registered)) (cdr registered)))
356 (if (null (cdr registered)) 357 (if (null (cdr registered))