Variable: treemacs-filewatch-mode-hook

treemacs-filewatch-mode-hook is a customizable variable defined in treemacs-filewatch-mode.el.

Value

nil

Documentation

Hook run after entering or leaving treemacs-filewatch-mode(var)/treemacs-filewatch-mode(fun).

No problems result if this variable is not bound. add-hook automatically binds it. (This is true for all hook variables.)

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-filewatch-mode.el
(define-minor-mode treemacs-filewatch-mode
  "Minor mode to let treemacs auto-refresh itself on file system changes.
Activating this mode enables treemacs to watch the files it is displaying (and
only those) for changes and automatically refresh its view when it detects a
change that it decides is relevant.

A file change event is relevant for treemacs if a new file has been created or
deleted or a file has been changed and `treemacs-git-mode' is enabled.  Events
caused by files that are ignored as per `treemacs-ignored-file-predicates' are
counted as not relevant.

The refresh is not called immediately after an event was received, treemacs
instead waits `treemacs-file-event-delay' ms to see if any more files have
changed to avoid having to refresh multiple times over a short period of time.

Due to limitations in the underlying kqueue library this mode may not be able to
track file modifications on MacOS, making it miss potentially useful updates
when used in combination with `treemacs-git-mode.'

The watch mechanism only applies to directories opened *after* this mode has
been activated.  This means that to enable file watching in an already existing
treemacs buffer it needs to be torn down and rebuilt by calling `treemacs' or
`treemacs-projectile'.

Turning off this mode is, on the other hand, instantaneous - it will immediately
turn off all existing file watch processes and outstanding refresh actions."
  :init-value nil
  :global     t
  :lighter    nil
  :group      'treemacs
  (unless treemacs-filewatch-mode
    (treemacs--tear-down-filewatch-mode)))