Function: magit-insert-section--create
magit-insert-section--create is a byte-compiled function defined in
magit-section.el.
Signature
(magit-insert-section--create CLASS VALUE HIDE &rest ARGS)
Source Code
;; Defined in ~/.emacs.d/elpa/magit-section-20260330.1102/magit-section.el
(defun magit-insert-section--create (class value hide &rest args)
(let (type)
(if (class-p class)
(setq type (or (car (rassq class magit--section-type-alist))
class))
(setq type class)
(setq class (or (cdr (assq class magit--section-type-alist))
'magit-section)))
(let ((obj (apply class :type type args)))
(oset obj value value)
(oset obj parent magit-insert-section--parent)
(oset obj start (if magit-section-inhibit-markers (point) (point-marker)))
(unless (slot-boundp obj 'hidden)
(oset obj hidden
(let (set old)
(cond
((setq set (run-hook-with-args-until-success
'magit-section-set-visibility-hook obj))
(eq set 'hide))
((setq old (and (not magit-section-preserve-visibility)
magit-insert-section--oldroot
(magit-get-section
(magit-section-ident obj)
magit-insert-section--oldroot)))
(oref old hidden))
((setq set (magit-section-match-assoc
obj magit-section-initial-visibility-alist))
(eq (if (functionp set) (funcall set obj) set) 'hide))
(hide)))))
(unless (oref obj keymap)
(let ((type (oref obj type)))
(oset obj keymap
(or (let ((sym (intern (format "magit-%s-section-map" type))))
(and (boundp sym) sym))
(let ((sym (intern (format "forge-%s-section-map" type))))
(and (boundp sym) sym))))))
obj)))