Function: treemacs-project-follow-mode
treemacs-project-follow-mode is an autoloaded, interactive and
byte-compiled function defined in treemacs-project-follow-mode.el.
Signature
(treemacs-project-follow-mode &optional ARG)
Documentation
Toggle treemacs-only-current-project-mode.
This is a minor mode. If called interactively, toggle the
Treemacs-Project-Follow 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-project-follow-mode)'.
The mode's hook is called both when the mode is enabled and when it is disabled.
This is a minor mode meant for those who do not care about treemacs' workspace
features, or its preference to work with multiple projects simultaneously. When
enabled it will function as an automated version of
treemacs-display-current-project-exclusively, making sure that, after a small
idle delay, the current project, and *only* the current project, is displayed in
treemacs.
The project detection is based on the current buffer, and will try to determine the project using the following methods, in the order they are listed:
- the current projectile.el project, if treemacs-projectile is installed
- the current project.el project
- the current default-directory
The update will only happen when treemacs is in the foreground, meaning a treemacs window must exist in the current scope.
This mode requires at least Emacs version 27 since it relies on
window-buffer-change-functions and window-selection-change-functions.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-project-follow-mode.el
;;;###autoload
(define-minor-mode treemacs-project-follow-mode
"Toggle `treemacs-only-current-project-mode'.
This is a minor mode meant for those who do not care about treemacs' workspace
features, or its preference to work with multiple projects simultaneously. When
enabled it will function as an automated version of
`treemacs-display-current-project-exclusively', making sure that, after a small
idle delay, the current project, and *only* the current project, is displayed in
treemacs.
The project detection is based on the current buffer, and will try to determine
the project using the following methods, in the order they are listed:
- the current projectile.el project, if `treemacs-projectile' is installed
- the current project.el project
- the current `default-directory'
The update will only happen when treemacs is in the foreground, meaning a
treemacs window must exist in the current scope.
This mode requires at least Emacs version 27 since it relies on
`window-buffer-change-functions' and `window-selection-change-functions'."
:init-value nil
:global t
:lighter nil
:group 'treemacs
(if treemacs-project-follow-mode
(progn
(unless (and (boundp 'window-buffer-change-functions)
(boundp 'window-selection-change-functions))
(user-error "%s %s"
"Project-Follow-Mode is only available in Emacs"
"versions that support `window-buffer-change-functions'"))
(treemacs--setup-project-follow-mode))
(treemacs--tear-down-project-follow-mode)))