From 5baa001cecbeb3081fb8a9293d45cfe9f19ef844 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 21 Feb 2016 09:58:55 +0100 Subject: [PATCH] Fix Bug#22736 * lisp/filenotify.el (file-notify-callback): Use the proper descriptor when calling the callback. (Bug#22736) * test/automated/file-notify-tests.el (file-notify--test-event-handler): Deactivate trace. (file-notify-test08-watched-file-in-watched-dir): Bind `file-notify--test-tmpfile' temporarily in `dir-callback'. --- lisp/filenotify.el | 8 +++++--- test/automated/file-notify-tests.el | 11 +++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lisp/filenotify.el b/lisp/filenotify.el index 66e7fd7a315..ba76baca3b4 100644 --- a/lisp/filenotify.el +++ b/lisp/filenotify.el @@ -273,14 +273,16 @@ EVENT is the cadr of the event in `file-notify-handle-event' (nth 0 entry) (file-name-nondirectory file1))))) ;;(message ;;"file-notify-callback %S %S %S %S %S" - ;;(file-notify--descriptor desc file) action file file1 registered) + ;;(file-notify--descriptor desc (car entry)) + ;;action file file1 registered) (if file1 (funcall callback - `(,(file-notify--descriptor desc file) ,action ,file ,file1)) + `(,(file-notify--descriptor desc (car entry)) + ,action ,file ,file1)) (funcall callback - `(,(file-notify--descriptor desc file) ,action ,file))))) + `(,(file-notify--descriptor desc (car entry)) ,action ,file))))) ;; Modify `file-notify-descriptors'. (when stopped diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el index 346120e276c..ac33d680a10 100644 --- a/test/automated/file-notify-tests.el +++ b/test/automated/file-notify-tests.el @@ -281,8 +281,8 @@ and the event to `file-notify--test-events'." (unless (string-match (regexp-quote ".#") (file-notify--event-file-name file-notify--test-event)) - (message "file-notify--test-event-handler result: %s event: %S" - (null (ert-test-failed-p result)) file-notify--test-event) + ;;(message "file-notify--test-event-handler result: %s event: %S" + ;;(null (ert-test-failed-p result)) file-notify--test-event) (setq file-notify--test-events (append file-notify--test-events `(,file-notify--test-event)) file-notify--test-results @@ -963,11 +963,11 @@ the file watch." (let ((temporary-file-directory file-notify--test-tmpfile)) (make-temp-file "file"))) (cl-flet ((dir-callback (event) - (message "dir-callback %s" event) - (let ((file-notify--test-desc file-notify--test-desc1)) + (let ((file-notify--test-desc file-notify--test-desc1) + (file-notify--test-tmpfile + (file-notify--event-file-name event))) (file-notify--test-event-handler event))) (file-callback (event) - (message "file-callback %s" event) (let ((file-notify--test-desc file-notify--test-desc2)) (file-notify--test-event-handler event)))) (should @@ -989,7 +989,6 @@ the file watch." "any text" nil file-notify--test-tmpfile1 t 'no-message) (let ((temporary-file-directory file-notify--test-tmpfile)) (make-temp-file "fileX")))) - ;; After saving the buffer, the descriptor is still valid. (should (file-notify-valid-p file-notify--test-desc1)) (should (file-notify-valid-p file-notify--test-desc2)) (delete-file file-notify--test-tmpfile1) -- 2.39.2