Function: js--imenu-create-index
js--imenu-create-index is a byte-compiled function defined in
js.el.gz.
Signature
(js--imenu-create-index)
Documentation
Return an imenu index for the current buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defun js--imenu-create-index ()
"Return an imenu index for the current buffer."
(save-excursion
(save-restriction
(widen)
(goto-char (point-max))
(js--ensure-cache)
(cl-assert (or (= (point-min) (point-max))
(eq js--last-parse-pos (point))))
(when js--last-parse-pos
(let ((state js--state-at-last-parse-pos)
(unknown-ctr (cons -1 nil)))
;; Make sure everything is closed
(while (cdr state)
(setq state
(cons (js--pitem-add-child (cl-second state) (car state))
(cddr state))))
(cl-assert (= (length state) 1))
;; Convert the new-finalized state into what imenu expects
(js--pitems-to-imenu
(car (js--pitem-children state))
unknown-ctr))))))