Function: rst-infer-hdr-hierarchy
rst-infer-hdr-hierarchy is a byte-compiled function defined in
rst.el.gz.
Signature
(rst-infer-hdr-hierarchy HDRS)
Documentation
Build a hierarchy from HDRS.
HDRS reflects the order in which the headers appear in the
buffer. Return a rst-Hdr list representing the hierarchy of
headers in the buffer. Indentation is unified.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/rst.el.gz
(defun rst-infer-hdr-hierarchy (hdrs)
;; testcover: ok.
"Build a hierarchy from HDRS.
HDRS reflects the order in which the headers appear in the
buffer. Return a `rst-Hdr' list representing the hierarchy of
headers in the buffer. Indentation is unified."
(let (ado2indents) ; Associates `rst-Ado' with the set of indents seen for it.
(dolist (hdr hdrs)
(let* ((ado (rst-Hdr-ado hdr))
(indent (rst-Hdr-indent hdr))
(found (assoc ado ado2indents)))
(if found
(setcdr found (cl-adjoin indent (cdr found)))
(push (list ado indent) ado2indents))))
(mapcar (cl-function
(lambda ((ado consistent &rest inconsistent))
(rst-Hdr-new ado (if inconsistent
rst-default-indent
consistent))))
(nreverse ado2indents))))