Function: treemacs--filewatch-callback
treemacs--filewatch-callback is a byte-compiled function defined in
treemacs-filewatch-mode.el.
Signature
(treemacs--filewatch-callback EVENT)
Documentation
Add EVENT to the list of file change events.
Do nothing if this event's file is irrelevant as per
treemacs--is-event-relevant?. Otherwise start a timer to process the
collected events if it has not been started already. Also immediately remove
the changed file from caches if it has been deleted instead of waiting for file
processing.
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-filewatch-mode.el
(defun treemacs--filewatch-callback (event)
"Add EVENT to the list of file change events.
Do nothing if this event's file is irrelevant as per
`treemacs--is-event-relevant?'. Otherwise start a timer to process the
collected events if it has not been started already. Also immediately remove
the changed file from caches if it has been deleted instead of waiting for file
processing."
(when (treemacs--is-event-relevant? event)
(-let [(_ event-type path) event]
(when (eq 'deleted event-type)
(treemacs--on-file-deletion path :no-buffer-delete))
(if (eq 'renamed event-type)
(let ((old-name path)
(new-name (cadddr event)))
(treemacs-run-in-every-buffer
(treemacs--on-rename old-name new-name (with-no-warnings treemacs-filewatch-mode)))
(treemacs--set-refresh-flags (treemacs--parent old-name) 'deleted old-name)
(when (--none? (funcall it (treemacs--filename new-name) new-name) treemacs-ignored-file-predicates)
(treemacs--set-refresh-flags (treemacs--parent new-name) 'created new-name)))
(treemacs--set-refresh-flags (treemacs--parent path) event-type path)))))