Make file-notify--call-handler more robust

* lisp/filenotify.el (file-notify--call-handler): Make it more
robust.  (Bug#78712)
This commit is contained in:
Michael Albinus 2025-06-11 19:20:43 +02:00
parent 7e62c2cf3a
commit 81a3e4e511

View file

@ -233,16 +233,18 @@ It is nil or a `file-notify--rename' defstruct where the cookie can be nil.")
(and (stringp file1) (and (stringp file1)
(string-equal (file-notify--watch-filename watch) (string-equal (file-notify--watch-filename watch)
(file-name-nondirectory file1)))) (file-name-nondirectory file1))))
(when file-notify-debug ;; The callback could have removed in `file-notify--rm-descriptor'.
(message (when (file-notify--watch-callback watch)
"file-notify-callback %S %S %S %S %S %S %S" (when file-notify-debug
desc action file file1 watch (message
(file-notify--watch-absolute-filename watch) "file-notify-callback %S %S %S %S %S %S %S"
(file-notify--watch-directory watch))) desc action file file1 watch
(funcall (file-notify--watch-callback watch) (file-notify--watch-absolute-filename watch)
(if file1 (file-notify--watch-directory watch)))
(list desc action file file1) (funcall (file-notify--watch-callback watch)
(list desc action file))))) (if file1
(list desc action file file1)
(list desc action file))))))
(defun file-notify--handle-event (desc actions file file1-or-cookie) (defun file-notify--handle-event (desc actions file file1-or-cookie)
"Handle an event returned from file notification. "Handle an event returned from file notification.