Function: doc-view--imenu-subtree
doc-view--imenu-subtree is a byte-compiled function defined in
doc-view.el.gz.
Signature
(doc-view--imenu-subtree OUTLINE ACT)
Documentation
Construct a tree of imenu items for the given outline list and action.
This auxliary function constructs recursively all the items for the first node in the outline and all its siblings at the same level. Returns that imenu alist together with any other pending outline entries at an upper level.
Source Code
;; Defined in /usr/src/emacs/lisp/doc-view.el.gz
(defun doc-view--imenu-subtree (outline act)
"Construct a tree of imenu items for the given outline list and action.
This auxliary function constructs recursively all the items for
the first node in the outline and all its siblings at the same
level. Returns that imenu alist together with any other pending outline
entries at an upper level."
(let ((level (alist-get 'level (car outline)))
(nested (not doc-view-imenu-flatten))
(index nil))
(while (and (car outline)
(or (not nested)
(<= level (alist-get 'level (car outline)))))
(let-alist (car outline)
(let ((title (format-spec doc-view-imenu-title-format
`((?t . ,.title) (?p . ,.page)))))
(if (and nested (> .level level))
(let ((sub (doc-view--imenu-subtree outline act))
(fst (car index)))
(setq index (cdr index))
(push (cons (car fst) (cons fst (car sub))) index)
(setq outline (cdr sub)))
(push `(,title 0 ,act ,.page) index)
(setq outline (cdr outline))))))
(cons (nreverse index) outline)))