Function: file-notify--rm-descriptor

file-notify--rm-descriptor is a byte-compiled function defined in filenotify.el.gz.

Signature

(file-notify--rm-descriptor DESCRIPTOR)

Documentation

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.

Source Code

;; Defined in /usr/src/emacs/lisp/filenotify.el.gz
(defun file-notify--rm-descriptor (descriptor)
  "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)))
    (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)
      (remhash descriptor file-notify-descriptors))))