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'.
This commit is contained in:
Michael Albinus 2016-02-21 09:58:55 +01:00
parent 72613557e0
commit 5baa001cec
2 changed files with 10 additions and 9 deletions

View file

@ -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

View file

@ -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)