Function: treemacs-add-and-display-current-project-exclusively

treemacs-add-and-display-current-project-exclusively is an autoloaded, interactive and byte-compiled function defined in treemacs.el.

Signature

(treemacs-add-and-display-current-project-exclusively)

Documentation

Display the current project, and *only* the current project.

Like treemacs-add-and-display-current-project this will add the current project to treemacs based on either projectile, the built-in project.el, or the current working directory.

However the 'exclusive' part means that it will make the current project the only project, all other projects *will be removed* from the current workspace.

Key Bindings

Aliases

treemacs-display-current-project-exclusively (obsolete since v2.9)

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs.el
;;;###autoload
(defun treemacs-add-and-display-current-project-exclusively ()
  "Display the current project, and *only* the current project.
Like `treemacs-add-and-display-current-project' this will add the current
project to treemacs based on either projectile, the built-in project.el, or the
current working directory.

However the \\='exclusive\\=' part means that it will make the current project
the only project, all other projects *will be removed* from the current
workspace."
  (interactive)
  (treemacs-block
   (treemacs-unless-let (root (treemacs--find-current-user-project))
       (treemacs-error-return-if (null root)
         "Not in a project.")
     (let* ((path (treemacs-canonical-path root))
            (name (treemacs--filename path))
            (ws (treemacs-current-workspace)))
       (treemacs-return-if
           (-let [projects (treemacs-workspace->projects ws)]
             (and (= 1 (length projects))
                  (string=
                   path
                   (treemacs-project->path (car projects)))))
         (treemacs-select-window))
       (treemacs--show-single-project path name)
       (treemacs-pulse-on-success "Now showing %s"
         (propertize path 'face 'font-lock-string-face))))))