Function: treemacs-find-file
treemacs-find-file is an autoloaded, interactive and byte-compiled
function defined in treemacs.el.
Signature
(treemacs-find-file &optional ARG)
Documentation
Find and focus the current file in the treemacs window.
If the current buffer visits no file or with a prefix ARG ask for the
file instead.
Will show/create a treemacs buffers if it is not visible/does not exist.
For the most part only useful when treemacs-follow-mode(var)/treemacs-follow-mode(fun) is not active.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs.el
;;;###autoload
(defun treemacs-find-file (&optional arg)
"Find and focus the current file in the treemacs window.
If the current buffer visits no file or with a prefix ARG ask for the
file instead.
Will show/create a treemacs buffers if it is not visible/does not exist.
For the most part only useful when `treemacs-follow-mode' is not active."
(interactive "P")
(let ((path (unless arg (buffer-file-name (current-buffer))))
(manually-entered nil))
(unless path
(setq manually-entered t
path (->> (--if-let (treemacs-current-button) (treemacs--nearest-path it))
(read-file-name "File to find: ")
(treemacs-canonical-path))))
(treemacs-unless-let (project (treemacs--find-project-for-path path))
(treemacs-pulse-on-failure (format "%s does not fall under any project in the workspace."
(propertize path 'face 'font-lock-string-face)))
(save-selected-window
(pcase (treemacs-current-visibility)
('visible (treemacs--select-visible-window))
('exists (treemacs--select-not-visible-window))
('none (treemacs--init)))
(treemacs-goto-file-node path project)
(when manually-entered (treemacs-pulse-on-success))))))