Function: treemacs-select-directory

treemacs-select-directory is an autoloaded, interactive and byte-compiled function defined in treemacs.el.

Signature

(treemacs-select-directory)

Documentation

Select a directory to open in treemacs.

This command will open *just* the selected directory in treemacs. If there are other projects in the workspace they will be removed.

To *add* a project to the current workspace use treemacs-add-project-to-workspace or treemacs-add-and-display-current-project instead.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs.el
;;;###autoload
(defun treemacs-select-directory ()
  "Select a directory to open in treemacs.
This command will open *just* the selected directory in treemacs.  If there are
other projects in the workspace they will be removed.

To *add* a project to the current workspace use
`treemacs-add-project-to-workspace' or
`treemacs-add-and-display-current-project' instead."
  (interactive)
  (treemacs-block
   (let* ((path (-> "Directory: "
                    (read-directory-name)
                    (treemacs-canonical-path)))
          (name (treemacs--filename path))
          (ws (treemacs-current-workspace)))
     (treemacs-return-if
         (and (= 1 (length (treemacs-workspace->projects ws)))
              (string= path (-> ws
                                (treemacs-workspace->projects)
                                (car)
                                (treemacs-project->path))))
       (treemacs-select-window))
     (treemacs--show-single-project path name)
     (treemacs-pulse-on-success "Now showing %s"
       (propertize path 'face 'font-lock-string-face)))))