Variable: treemacs-hide-gitignored-files-mode-hook

treemacs-hide-gitignored-files-mode-hook is a customizable variable defined in treemacs-async.el.

Value

nil

Documentation

Hook run after entering or leaving treemacs-hide-gitignored-files-mode(var)/treemacs-hide-gitignored-files-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-async.el
(define-minor-mode treemacs-hide-gitignored-files-mode
  "Toggle `treemacs-hide-gitignored-files-mode'.

When enabled treemacs will hide files that are ignored by git.

Some form of `treemacs-git-mode' *must* be enabled, otherwise this feature will
have no effect.

Both `extended' and `deferred' git-mode settings will work in full (in case of
`deferred' git-mode treemacs will pre-load the list of ignored files so they
will be hidden even on the first run).  The limitations of `simple' git-mode
apply here as well: since it only knows about files and not directories only
files will be hidden."
  :init-value nil
  :global     t
  :lighter    nil
  :group      'treemacs-git
  (if treemacs-hide-gitignored-files-mode
      (progn
        (add-to-list 'treemacs-pre-file-insert-predicates
                     #'treemacs-is-file-git-ignored?)
        (when (and (eq 'deferred treemacs--git-mode)
                   (not (get 'treemacs-hide-gitignored-files-mode
                             :prefetch-done)))
          (treemacs--prefetch-gitignore-cache 'all)
          (put 'treemacs-hide-gitignored-files-mode :prefetch-done t)))
    (setf treemacs-pre-file-insert-predicates
          (delete #'treemacs-is-file-git-ignored?
                  treemacs-pre-file-insert-predicates)))
  (treemacs-run-in-every-buffer
   (treemacs--do-refresh (current-buffer) 'all))
  (when (called-interactively-p 'interactive)
    (treemacs-pulse-on-success "Git-ignored files will now be %s"
      (propertize
       (if treemacs-hide-gitignored-files-mode "hidden." "displayed.")
       'face 'font-lock-constant-face))) )