emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 07a276d 1/2: Simplify `file-notify--rm-descriptor'


From: Michael Albinus
Subject: master 07a276d 1/2: Simplify `file-notify--rm-descriptor'
Date: Mon, 27 Sep 2021 14:36:22 -0400 (EDT)

branch: master
commit 07a276da6f2721e34c4edc9bbfeb22ba83d008cd
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Simplify `file-notify--rm-descriptor'
    
    * lisp/filenotify.el (file-notify--rm-descriptor):
    Use `file-notify-handle-event'.
---
 lisp/filenotify.el | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/lisp/filenotify.el b/lisp/filenotify.el
index a0c3758..e0dceb7 100644
--- a/lisp/filenotify.el
+++ b/lisp/filenotify.el
@@ -76,16 +76,17 @@ struct.")
   "Remove DESCRIPTOR from `file-notify-descriptors'.
 DESCRIPTOR should be an object returned by `file-notify-add-watch'.
 If it is registered in `file-notify-descriptors', a `stopped' event is sent."
-  (when-let* ((watch (gethash descriptor file-notify-descriptors)))
-    (let ((callback (file-notify--watch-callback watch)))
-      ;; Make sure this is the last time the callback is invoked.
+  (when-let ((watch (gethash descriptor file-notify-descriptors)))
+    (unwind-protect
+        ;; Send `stopped' event.
+        (file-notify-handle-event
+         (make-file-notify
+          :-event `(,descriptor stopped
+                    ,(file-notify--watch-absolute-filename watch))
+          :-callback (file-notify--watch-callback watch)))
+      ;; Make sure this is the last time the callback was invoked.
       (setf (file-notify--watch-callback watch) nil)
-      ;; Send `stopped' event.
-      (unwind-protect
-          (funcall
-           callback
-           `(,descriptor stopped ,(file-notify--watch-absolute-filename 
watch)))
-        (remhash descriptor file-notify-descriptors)))))
+      (remhash descriptor file-notify-descriptors))))
 
 (cl-defstruct (file-notify (:type list) :named)
   "A file system monitoring event, coming from the backends."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]