Function: magit-section-cycle

magit-section-cycle is an interactive and byte-compiled function defined in magit-section.el.

Signature

(magit-section-cycle SECTION)

Documentation

Cycle visibility of current section and its children.

If this command is invoked using \C-<tab> and that is globally bound to tab-next, then this command pivots to behave like that command, and you must instead use \C-c TAB to cycle section visibility.

If you would like to keep using \C-<tab> to cycle section visibility but also want to use tab-bar-mode(var)/tab-bar-mode(fun), then you have to prevent that mode from using this key and instead bind another key to tab-next. Because tab-bar-mode(var)/tab-bar-mode(fun) does not use a mode map but instead manipulates the global map, this involves advising tab-bar--define-keys.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-section-20260330.1102/magit-section.el
(defun magit-section-cycle (section)
  "Cycle visibility of current section and its children.

If this command is invoked using \\`C-<tab>' and that is globally bound
to `tab-next', then this command pivots to behave like that command, and
you must instead use \\`C-c TAB' to cycle section visibility.

If you would like to keep using \\`C-<tab>' to cycle section visibility
but also want to use `tab-bar-mode', then you have to prevent that mode
from using this key and instead bind another key to `tab-next'.  Because
`tab-bar-mode' does not use a mode map but instead manipulates the
global map, this involves advising `tab-bar--define-keys'."
  (interactive (list (magit-current-section)))
  (cond-let
    ((and (equal (this-command-keys) [C-tab])
          (eq (global-key-binding [C-tab]) 'tab-next)
          (fboundp 'tab-bar-switch-to-next-tab))
     (tab-bar-switch-to-next-tab current-prefix-arg))
    ((eq section magit-root-section)
     (magit-section-cycle-global))
    ((oref section hidden)
     (magit-section-show section)
     (magit-section-hide-children section))
    [[children (oref section children)]]
    ((and (seq-some (##oref % hidden)   children)
          (seq-some (##oref % children) children))
     (magit-section-show-headings section))
    ((seq-some #'magit-section-hidden-body children)
     (magit-section-show-children section))
    ((magit-section-hide section))))