Function: smart-treemacs-modeline
smart-treemacs-modeline is an autoloaded and byte-compiled function
defined in hui-treemacs.el.
Signature
(smart-treemacs-modeline)
Documentation
Toggle display of Treemacs from Smart Action Key click on a modeline.
When pressed on the Treemacs buffer modeline or Treemacs is displaying the default directory of the buffer modeline clicked upon, then quit/hide the Treemacs window. Otherwise, display the Treemacs window with the default directory of the buffer modeline clicked upon.
Suitable for use as a value of action-key-modeline-buffer-id-function.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui-treemacs.el
;;;###autoload
(defun smart-treemacs-modeline ()
"Toggle display of Treemacs from Smart Action Key click on a modeline.
When pressed on the Treemacs buffer modeline or Treemacs is displaying
the default directory of the buffer modeline clicked upon, then
quit/hide the Treemacs window. Otherwise, display the Treemacs window
with the default directory of the buffer modeline clicked upon.
Suitable for use as a value of `action-key-modeline-buffer-id-function'."
(cond
;; Clicked on Treemacs buffer id
((if action-key-depress-window
(treemacs-is-treemacs-window? action-key-depress-window)
(hact 'string-match " Treemacs " (format-mode-line mode-line-format)))
;; Quit/hide treemacs.
(hact 'treemacs-quit))
;;
;; Treemacs is visible and displaying the same dir as
;; the default dir of the clicked on modeline.
((and (eq (treemacs-current-visibility) 'visible)
(string-equal (expand-file-name default-directory)
(with-selected-window (treemacs-get-local-window)
(save-excursion
(goto-char (point-min))
default-directory))))
;; Quit/hide treemacs.
(hact 'smart-treemacs-quit))
;;
;; Otherwise, invoke treemacs on the default dir of the clicked on modeline.
(t (hact 'smart-treemacs-edit))))