]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Bug#22736
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 21 Feb 2016 08:58:55 +0000 (09:58 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 21 Feb 2016 08:58:55 +0000 (09:58 +0100)
* 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
test/automated/file-notify-tests.el

index 66e7fd7a315204a98536b826fabf3ee05e7996bb..ba76baca3b4ad1cc10528623e10db269fe066686 100644 (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
index 346120e276c8d631793ab70ab9481a60bc831c90..ac33d680a1071998a2d1d350083f1af40d23ffc2 100644 (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)