Function: treemacs-toggle-node
treemacs-toggle-node is an interactive and byte-compiled function
defined in treemacs-interface.el.
Signature
(treemacs-toggle-node &optional ARG)
Documentation
Expand or close the current node.
If a prefix ARG is provided the open/close process is done recursively. When opening directories that means that all sub-directories are opened as well. When opening files all their tag sections will be opened. Recursively closing any kind of node means that treemacs will forget about everything that was expanded below that node.
Since tags cannot be opened or closed a goto definition action will called on them instead.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-interface.el
(defun treemacs-toggle-node (&optional arg)
"Expand or close the current node.
If a prefix ARG is provided the open/close process is done recursively. When
opening directories that means that all sub-directories are opened as well.
When opening files all their tag sections will be opened.
Recursively closing any kind of node means that treemacs will forget about
everything that was expanded below that node.
Since tags cannot be opened or closed a goto definition action will called on
them instead."
(interactive "P")
(treemacs-do-for-button-state
:on-root-node-open (treemacs--collapse-root-node btn arg)
:on-root-node-closed (treemacs--expand-root-node btn arg)
:on-dir-node-open (treemacs--collapse-dir-node btn arg)
:on-dir-node-closed (treemacs--expand-dir-node btn :recursive arg)
:on-file-node-open (treemacs--collapse-file-node btn arg)
:on-file-node-closed (treemacs--expand-file-node btn arg)
:on-tag-node-open (treemacs--collapse-tag-node btn arg)
:on-tag-node-closed (treemacs--expand-tag-node btn arg)
:on-tag-node-leaf (progn (other-window 1) (treemacs--goto-tag btn))
:on-nil (treemacs-pulse-on-failure "There is nothing to do here.")
:fallback (treemacs-TAB-action)))