Function: treemacs-collapse-all-projects

treemacs-collapse-all-projects is an interactive and byte-compiled function defined in treemacs-interface.el.

Signature

(treemacs-collapse-all-projects &optional ARG)

Documentation

Collapses all projects.

With a prefix ARG remember which nodes were expanded.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-interface.el
(defun treemacs-collapse-all-projects (&optional arg)
  "Collapses all projects.
With a prefix ARG remember which nodes were expanded."
  (interactive "P")
  (-when-let (buffer (treemacs-get-local-buffer))
    (with-current-buffer buffer
      (save-excursion
        (dolist (project (treemacs-workspace->projects (treemacs-current-workspace)))
          (-when-let (pos (treemacs-project->position project))
            (when (eq 'root-node-open (treemacs-button-get pos :state))
              (goto-char pos)
              (treemacs--collapse-root-node pos (not arg))))))
      (treemacs--maybe-recenter 'on-distance)
      (treemacs-pulse-on-success "Collapsed all projects"))))