Function: treemacs-git-mode
treemacs-git-mode is an interactive and byte-compiled function defined
in treemacs-async.el.
Signature
(treemacs-git-mode &optional ARG)
Documentation
Toggle treemacs-git-mode(var)/treemacs-git-mode(fun).
When enabled treemacs will check files' git status and highlight them accordingly. This git integration is available in 3 variants: simple, extended and deferred.
The simple variant will start a git status process whose output is parsed in elisp. This version is simpler and slightly faster, but incomplete - it will highlight only files, not directories.
The extended variant requires a non-trivial amount of parsing to be done, which is achieved with python (specifically python3). It is slightly slower, but complete - both files and directories will be highlighted according to their git status.
The deferred variant is the same is extended, except the tasks of rendering
nodes and highlighting them are separated. The former happens immediately, the
latter after treemacs-deferred-git-apply-delay seconds of idle time. This may
be faster (if not in truth then at least in appearance) as the git process is
given a much greater amount of time to finish. The downside is that the effect
of nodes changing their colours may be somewhat jarring, though this issue is
largely mitigated due to the use of a caching layer.
All versions run asynchronously and are optimised for not doing more work than is necessary, so their performance cost should, for the most part, be the constant time needed to fork a subprocess.
This is a global minor mode. If called interactively, toggle the
Treemacs-Git mode mode. If the prefix argument is positive, enable
the mode, and if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is toggle. Enable the
mode if ARG is nil, omitted, or is a positive number. Disable the mode
if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate (default-value \=treemacs-git-mode)'.
The mode's hook is called both when the mode is enabled and when it is disabled.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-async.el
(define-minor-mode treemacs-git-mode
"Toggle `treemacs-git-mode'.
When enabled treemacs will check files' git status and highlight them
accordingly. This git integration is available in 3 variants: simple, extended
and deferred.
The simple variant will start a git status process whose output is parsed in
elisp. This version is simpler and slightly faster, but incomplete - it will
highlight only files, not directories.
The extended variant requires a non-trivial amount of parsing to be done, which
is achieved with python (specifically python3). It is slightly slower, but
complete - both files and directories will be highlighted according to their git
status.
The deferred variant is the same is extended, except the tasks of rendering
nodes and highlighting them are separated. The former happens immediately, the
latter after `treemacs-deferred-git-apply-delay' seconds of idle time. This may
be faster (if not in truth then at least in appearance) as the git process is
given a much greater amount of time to finish. The downside is that the effect
of nodes changing their colours may be somewhat jarring, though this issue is
largely mitigated due to the use of a caching layer.
All versions run asynchronously and are optimised for not doing more work than
is necessary, so their performance cost should, for the most part, be the
constant time needed to fork a subprocess."
:init-value nil
:global t
:lighter nil
:group 'treemacs-git
;; case when the mode is re-activated by `custom-set-minor-mode'
(when (and (equal arg 1) treemacs--git-mode)
(setf arg treemacs--git-mode))
(if treemacs-git-mode
(if (memq arg '(simple extended deferred))
(treemacs--setup-git-mode arg)
(call-interactively 'treemacs--setup-git-mode))
(treemacs--tear-down-git-mode)))