Function: treemacs-select-window

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

Signature

(treemacs-select-window &optional ARG)

Documentation

Select the treemacs window if it is visible.

Bring it to the foreground if it is not visible. Initialise a new treemacs buffer as calling treemacs would if there is no treemacs buffer for this frame.

In case treemacs is already selected behaviour will depend on treemacs-select-when-already-in-treemacs.

A non-nil prefix ARG will also force a workspace switch.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs.el
;;;###autoload
(defun treemacs-select-window (&optional arg)
  "Select the treemacs window if it is visible.
Bring it to the foreground if it is not visible.
Initialise a new treemacs buffer as calling `treemacs' would if there is no
treemacs buffer for this frame.

In case treemacs is already selected behaviour will depend on
`treemacs-select-when-already-in-treemacs'.

A non-nil prefix ARG will also force a workspace switch."
  (interactive "P")
  (pcase (treemacs-current-visibility)
    ((guard arg)
     (treemacs-do-switch-workspace (treemacs--select-workspace-by-name))
     (treemacs-select-window))
    ('exists  (treemacs--select-not-visible-window))
    ('none    (treemacs--init))
    ('visible
     (if (not (eq treemacs--in-this-buffer t))
         (treemacs--select-visible-window)
       (pcase-exhaustive treemacs-select-when-already-in-treemacs
         ('stay
          (ignore))
         ('close
          (treemacs-quit))
         ('goto-next
          (treemacs--jump-to-next-treemacs-window))
         ('next-or-back
          (or
           (treemacs--jump-to-next-treemacs-window)
           (-if-let (mru-window (get-mru-window (selected-frame) nil :not-selected))
               (select-window mru-window)
             (treemacs-log-failure "get-mru-window could not find the last used window."))))
         ('move-back
          (select-window (get-mru-window (selected-frame) nil :not-selected))))))))