Function: treemacs--stop-watching

treemacs--stop-watching is a byte-compiled function defined in treemacs-filewatch-mode.el.

Signature

(treemacs--stop-watching PATH &optional ALL)

Documentation

Stop watching PATH for file events.

This also means stopping the watch over all dirs below path. Must be called inside the treemacs buffer since it will remove current-buffer from PATH's watch list. Does not apply if this is called in reaction to a file being deleted. In this case ALL is t and all buffers watching PATH will be removed from the filewatch hashes.

PATH: Filepath ALL: Bool

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-filewatch-mode.el
(define-inline treemacs--stop-watching (path &optional all)
  "Stop watching PATH for file events.
This also means stopping the watch over all dirs below path.
Must be called inside the treemacs buffer since it will remove `current-buffer'
from PATH's watch list.  Does not apply if this is called in reaction to a file
being deleted.  In this case ALL is t and all buffers watching PATH will be
removed from the filewatch hashes.

PATH: Filepath
ALL: Bool"
  (inline-letevals (path all)
    (inline-quote
     (let (to-remove)
       (treemacs--maphash treemacs--filewatch-index (watched-path watch-info)
         (when (treemacs-is-path watched-path :in ,path)
           (let ((watching-buffers (car watch-info))
                 (watch-descr (cdr watch-info)))
             (if ,all
                 (progn
                   (file-notify-rm-watch watch-descr)
                   (ht-remove! treemacs--collapsed-filewatch-index watched-path)
                   (push watched-path to-remove))
               (when (memq (current-buffer) watching-buffers)
                 (if (cdr watching-buffers)
                     (setcar watch-info (delq (current-buffer) watching-buffers))
                   (file-notify-rm-watch watch-descr)
                   (ht-remove! treemacs--collapsed-filewatch-index watched-path)
                   (push watched-path to-remove)))))))
       (dolist (it to-remove)
         (ht-remove! treemacs--filewatch-index it))))))