Function: magit-get-section

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

Signature

(magit-get-section IDENT &optional ROOT)

Documentation

Return the section identified by IDENT.

IDENT has to be a list as returned by magit-section-ident. If optional ROOT is non-nil, then search in that section tree instead of in the one whose root magit-root-section is.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-section-20260330.1102/magit-section.el
(defun magit-get-section (ident &optional root)
  "Return the section identified by IDENT.
IDENT has to be a list as returned by `magit-section-ident'.
If optional ROOT is non-nil, then search in that section tree
instead of in the one whose root `magit-root-section' is."
  (setq ident (reverse ident))
  (let ((section (or root magit-root-section)))
    (when (eq (car (pop ident))
              (oref section type))
      (while (and ident
                  (pcase-let ((`(,type . ,value) (car ident)))
                    (setq section
                          (cl-find-if
                           (##and (eq (oref % type) type)
                                  (equal (magit-section-ident-value %) value))
                           (oref section children)))))
        (pop ident))
      section)))