Function: smart-magit-tab
smart-magit-tab is an interactive and byte-compiled function defined
in hui-mouse.el.
Signature
(smart-magit-tab SECTION)
Documentation
Toggle visibility of the body of the current SECTION.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui-mouse.el
;; Thanks to Jonas Bernoulli <tarsius>, magit author, for most of this
;; next function.
;; Usage: (define-key magit-section-mode-map "TAB" 'smart-magit-tab)
(defun smart-magit-tab (section)
"Toggle visibility of the body of the current SECTION."
(interactive (list (magit-current-section)))
(require 'magit)
(let* ((magit-display-buffer-function #'hpath:display-buffer)
(non-text-area-p (and (eventp action-key-depress-args)
(posn-area (event-start action-key-depress-args)))))
(cond (non-text-area-p (magit-section-cycle-diffs))
((eq section magit-root-section)
(user-error "Cannot hide root section"))
((or (oref section content)
(oref section washer))
(goto-char (oref section start))
(if (oref section hidden)
(magit-section-show section)
(magit-section-hide section)))
(t
(if-let* ((command (key-binding (kbd "RET"))))
(progn (setq last-command-event ?\()
(setq this-command command)
(smart-magit-display-file command))
(user-error "Nothing to visit either"))))))