Function: magit-section-show-level

magit-section-show-level is a byte-compiled function defined in magit-section.el.

Signature

(magit-section-show-level LEVEL)

Documentation

Show surrounding sections up to LEVEL.

Likewise hide sections at higher levels. If the region selects multiple sibling sections, act on all marked trees. If LEVEL is negative, show all sections up to the absolute value of that, not just surrounding sections.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-section-20260330.1102/magit-section.el
(defun magit-section-show-level (level)
  "Show surrounding sections up to LEVEL.
Likewise hide sections at higher levels.  If the region selects multiple
sibling sections, act on all marked trees.  If LEVEL is negative, show
all sections up to the absolute value of that, not just surrounding
sections."
  (if (< level 0)
      (let ((s (magit-current-section)))
        (setq level (- level))
        (while (> (1- (length (magit-section-ident s))) level)
          (setq s (oref s parent))
          (goto-char (oref s start)))
        (magit-section-show-children magit-root-section (1- level)))
    (dolist (section (or (magit-region-sections)
                         (list (magit-current-section))))
      (cl-do* ((s section
                  (oref s parent))
               (i (1- (length (magit-section-ident s)))
                  (cl-decf i)))
          ((cond ((< i level) (magit-section-show-children s (- level i 1)) t)
                 ((= i level) (magit-section-hide s) t))
           (magit-section-goto s))))))