Function: smart-treemacs

smart-treemacs is an autoloaded, interactive and byte-compiled function defined in hui-treemacs.el.

Signature

(smart-treemacs)

Documentation

Use a single key or mouse key to manipulate directory entries.

Invoked via a key press when in treemacs-mode. It assumes that its caller has already checked that the key was pressed in an appropriate buffer and has moved the cursor there.

If key is pressed:
 (1) on or to the left of an entry icon, run the treemacs TAB command
     to expand or collapse the entry;
 (2) elsewhere within an entry line, display the item, which may be a
     directory, for editing, normally in another window;
 (3) at the end of an entry line: if an Action Key press, invoke
     action-key-eol-function, typically to scroll up proportionally;
     if an Asisst Key press, invoke assist-key-eol-function, typically
     to scroll down proportionally;
 (4) at the end of the first or last line of the buffer, quit this
     Treemacs invocation.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui-treemacs.el
;;;###autoload
(defun smart-treemacs ()
  "Use a single key or mouse key to manipulate directory entries.

Invoked via a key press when in treemacs-mode.  It assumes that its
caller has already checked that the key was pressed in an appropriate buffer
and has moved the cursor there.

If key is pressed:
 (1) on or to the left of an entry icon, run the treemacs TAB command
     to expand or collapse the entry;
 (2) elsewhere within an entry line, display the item, which may be a
     directory, for editing, normally in another window;
 (3) at the end of an entry line: if an Action Key press, invoke
     `action-key-eol-function', typically to scroll up proportionally;
     if an Asisst Key press, invoke `assist-key-eol-function', typically
     to scroll down proportionally;
 (4) at the end of the first or last line of the buffer, quit this
     Treemacs invocation."

  (interactive)
  (cond ((and (eolp) (or (first-line-p) (last-line-p)))
	 (hact 'smart-treemacs-quit))
	((eolp)
	 (hact 'funcall (if assist-flag assist-key-eol-function action-key-eol-function)))
	(t (if (and (treemacs-current-button)
		    (= (point) (- (button-start (treemacs-current-button)) 2)))
	       ;; Before or on the entry's icon
	       (hact 'treemacs-TAB-action current-prefix-arg)
	     ;; On the entry, handles dirs, files and tag entries
	     (hact 'treemacs-RET-action current-prefix-arg)))))