Variable: treemacs-pre-file-insert-predicates

treemacs-pre-file-insert-predicates is a customizable variable defined in treemacs-customization.el.

Value

nil

Documentation

List of predicates to test for files and directories that shouldn't be shown.

The difference between this and treemacs-ignored-file-predicates is that the functions in this list will be called on files just before they would be rendered, when the files' git status information is now available. This for example allows to make files ignored by git invisible (however this particular use-case is already covered by treemacs-hide-gitignored-files-mode(var)/treemacs-hide-gitignored-files-mode(fun)).

The functions in this list are therefore expected to have a different signature: They must take two arguments - a file's absolute path and a hash table that maps files to their git status. The files' paths are the table's keys, its values are characters (and not strings) indicating the file's git condition. The chars map map as follows: (the pattern is derived from 'git status --porcelain')

 * M - file is modified
 * U - file is in conflict
 * ? - file is untracked
 * ! - file is ignored
 * A - file is added to index
 * other - file is unchanged

Otherwise the behaviour is the same as treemacs-ignored-file-predicates, in that any one function returning t for a file means that this file will not be rendered.

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-customization.el
(defcustom treemacs-pre-file-insert-predicates nil
  "List of predicates to test for files and directories that shouldn't be shown.
The difference between this and `treemacs-ignored-file-predicates' is that the
functions in this list will be called on files just before they would be
rendered, when the files' git status information is now available.  This for
example allows to make files ignored by git invisible (however this particular
use-case is already covered by `treemacs-hide-gitignored-files-mode').

The functions in this list are therefore expected to have a different signature:
They must take two arguments - a file's absolute path and a hash table that maps
files to their git status.  The files' paths are the table's keys, its values
are characters (and not strings) indicating the file's git condition.  The chars
map map as follows: (the pattern is derived from \\='git status --porcelain\\=')

 * M - file is modified
 * U - file is in conflict
 * ? - file is untracked
 * ! - file is ignored
 * A - file is added to index
 * other - file is unchanged

Otherwise the behaviour is the same as `treemacs-ignored-file-predicates', in
that any one function returning t for a file means that this file will not
be rendered."
  :type '(list function)
  :group 'treemacs)