diff options
| author | Michael Albinus | 2016-02-21 09:58:55 +0100 |
|---|---|---|
| committer | Michael Albinus | 2016-02-21 09:58:55 +0100 |
| commit | 5baa001cecbeb3081fb8a9293d45cfe9f19ef844 (patch) | |
| tree | ea0dcbb2928afdcae93631b22b31c0c3b7a949ff | |
| parent | 72613557e02d493f195a1c0894ec736b19069f4c (diff) | |
| download | emacs-5baa001cecbeb3081fb8a9293d45cfe9f19ef844.tar.gz emacs-5baa001cecbeb3081fb8a9293d45cfe9f19ef844.zip | |
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'.
| -rw-r--r-- | lisp/filenotify.el | 8 | ||||
| -rw-r--r-- | 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' | |||
| 273 | (nth 0 entry) (file-name-nondirectory file1))))) | 273 | (nth 0 entry) (file-name-nondirectory file1))))) |
| 274 | ;;(message | 274 | ;;(message |
| 275 | ;;"file-notify-callback %S %S %S %S %S" | 275 | ;;"file-notify-callback %S %S %S %S %S" |
| 276 | ;;(file-notify--descriptor desc file) action file file1 registered) | 276 | ;;(file-notify--descriptor desc (car entry)) |
| 277 | ;;action file file1 registered) | ||
| 277 | (if file1 | 278 | (if file1 |
| 278 | (funcall | 279 | (funcall |
| 279 | callback | 280 | callback |
| 280 | `(,(file-notify--descriptor desc file) ,action ,file ,file1)) | 281 | `(,(file-notify--descriptor desc (car entry)) |
| 282 | ,action ,file ,file1)) | ||
| 281 | (funcall | 283 | (funcall |
| 282 | callback | 284 | callback |
| 283 | `(,(file-notify--descriptor desc file) ,action ,file))))) | 285 | `(,(file-notify--descriptor desc (car entry)) ,action ,file))))) |
| 284 | 286 | ||
| 285 | ;; Modify `file-notify-descriptors'. | 287 | ;; Modify `file-notify-descriptors'. |
| 286 | (when stopped | 288 | (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'." | |||
| 281 | (unless (string-match | 281 | (unless (string-match |
| 282 | (regexp-quote ".#") | 282 | (regexp-quote ".#") |
| 283 | (file-notify--event-file-name file-notify--test-event)) | 283 | (file-notify--event-file-name file-notify--test-event)) |
| 284 | (message "file-notify--test-event-handler result: %s event: %S" | 284 | ;;(message "file-notify--test-event-handler result: %s event: %S" |
| 285 | (null (ert-test-failed-p result)) file-notify--test-event) | 285 | ;;(null (ert-test-failed-p result)) file-notify--test-event) |
| 286 | (setq file-notify--test-events | 286 | (setq file-notify--test-events |
| 287 | (append file-notify--test-events `(,file-notify--test-event)) | 287 | (append file-notify--test-events `(,file-notify--test-event)) |
| 288 | file-notify--test-results | 288 | file-notify--test-results |
| @@ -963,11 +963,11 @@ the file watch." | |||
| 963 | (let ((temporary-file-directory file-notify--test-tmpfile)) | 963 | (let ((temporary-file-directory file-notify--test-tmpfile)) |
| 964 | (make-temp-file "file"))) | 964 | (make-temp-file "file"))) |
| 965 | (cl-flet ((dir-callback (event) | 965 | (cl-flet ((dir-callback (event) |
| 966 | (message "dir-callback %s" event) | 966 | (let ((file-notify--test-desc file-notify--test-desc1) |
| 967 | (let ((file-notify--test-desc file-notify--test-desc1)) | 967 | (file-notify--test-tmpfile |
| 968 | (file-notify--event-file-name event))) | ||
| 968 | (file-notify--test-event-handler event))) | 969 | (file-notify--test-event-handler event))) |
| 969 | (file-callback (event) | 970 | (file-callback (event) |
| 970 | (message "file-callback %s" event) | ||
| 971 | (let ((file-notify--test-desc file-notify--test-desc2)) | 971 | (let ((file-notify--test-desc file-notify--test-desc2)) |
| 972 | (file-notify--test-event-handler event)))) | 972 | (file-notify--test-event-handler event)))) |
| 973 | (should | 973 | (should |
| @@ -989,7 +989,6 @@ the file watch." | |||
| 989 | "any text" nil file-notify--test-tmpfile1 t 'no-message) | 989 | "any text" nil file-notify--test-tmpfile1 t 'no-message) |
| 990 | (let ((temporary-file-directory file-notify--test-tmpfile)) | 990 | (let ((temporary-file-directory file-notify--test-tmpfile)) |
| 991 | (make-temp-file "fileX")))) | 991 | (make-temp-file "fileX")))) |
| 992 | ;; After saving the buffer, the descriptor is still valid. | ||
| 993 | (should (file-notify-valid-p file-notify--test-desc1)) | 992 | (should (file-notify-valid-p file-notify--test-desc1)) |
| 994 | (should (file-notify-valid-p file-notify--test-desc2)) | 993 | (should (file-notify-valid-p file-notify--test-desc2)) |
| 995 | (delete-file file-notify--test-tmpfile1) | 994 | (delete-file file-notify--test-tmpfile1) |