Function: imenu--flatten-index-alist
imenu--flatten-index-alist is a byte-compiled function defined in
imenu.el.gz.
Signature
(imenu--flatten-index-alist INDEX-ALIST &optional CONCAT-NAMES PREFIX)
Source Code
;; Defined in /usr/src/emacs/lisp/imenu.el.gz
(defun imenu--flatten-index-alist (index-alist &optional concat-names prefix)
;; Takes a nested INDEX-ALIST and returns a flat index alist.
;; If optional CONCAT-NAMES is non-nil, then a nested index has its
;; name and a space concatenated to the names of the children.
;; Third argument PREFIX is for internal use only.
(mapcan
(lambda (item)
(let* ((name (car item))
(pos (cdr item))
(new-prefix (and concat-names
(if prefix
(concat prefix imenu-level-separator name)
name))))
(cond
((not (imenu--subalist-p item))
(list (cons (pcase imenu-flatten
('annotation
(if prefix
(propertize name
'imenu-section (format " (%s)" prefix)
'imenu-choice item)
(propertize new-prefix 'imenu-choice item)))
('group (propertize name
'imenu-section (or prefix "*")
'imenu-choice item))
(_ new-prefix))
pos)))
(t
(imenu--flatten-index-alist pos concat-names new-prefix)))))
index-alist))