Function: treemacs--select-file-from-btn
treemacs--select-file-from-btn is a byte-compiled function defined in
treemacs-file-management.el.
Signature
(treemacs--select-file-from-btn BTN PROMPT &optional DIR-ONLY)
Documentation
Select the file at BTN for file management.
Offer a specifying dialogue with PROMPT when the button is flattened. Pick only directories when DIR-ONLY is non-nil.
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-file-management.el
(defun treemacs--select-file-from-btn (btn prompt &optional dir-only)
"Select the file at BTN for file management.
Offer a specifying dialogue with PROMPT when the button is flattened.
Pick only directories when DIR-ONLY is non-nil."
(declare (side-effect-free t))
(let* ((path (and btn (treemacs-button-get btn :path)))
(collapse-info (and btn (treemacs-button-get btn :collapsed)))
(is-str (and path (stringp path)))
(is-dir (and is-str (file-directory-p path)))
(is-file (and is-str (file-regular-p path))))
(cond
(collapse-info
(completing-read prompt collapse-info nil :require-match))
(is-dir
path)
((and is-file dir-only)
(treemacs--parent-dir path))
(is-file
path)
(t
(expand-file-name "~")))))