Function: magit-insert-child-count
magit-insert-child-count is a byte-compiled function defined in
magit-section.el.
Signature
(magit-insert-child-count SECTION)
Documentation
Modify SECTION's heading to contain number of child sections.
If magit-section-show-child-count is non-nil and the SECTION
has children and its heading ends with ":", then replace that
with " (N)", where N is the number of child sections.
This function is called by magit-insert-section after that has
evaluated its BODY. Admittedly that's a bit of a hack.
Source Code
;; Defined in ~/.emacs.d/elpa/magit-section-20260330.1102/magit-section.el
(defun magit-insert-child-count (section)
"Modify SECTION's heading to contain number of child sections.
If `magit-section-show-child-count' is non-nil and the SECTION
has children and its heading ends with \":\", then replace that
with \" (N)\", where N is the number of child sections.
This function is called by `magit-insert-section' after that has
evaluated its BODY. Admittedly that's a bit of a hack."
(let (content count)
(cond
((not (and magit-section-show-child-count
(setq content (oref section content))
(setq count (length (oref section children)))
(> count 0))))
((eq (char-before (- content 1)) ?:)
(save-excursion
(goto-char (- content 2))
(insert (magit--propertize-face (format " (%s)" count)
'magit-section-child-count))
(delete-char 1)))
((and (eq (char-before (- content 4)) ?\s)
(eq (char-before (- content 3)) ?\()
(eq (char-before (- content 2)) ?t )
(eq (char-before (- content 1)) ?\)))
(save-excursion
(goto-char (- content 3))
(delete-char 1)
(insert (format "%s" count)))))))