Function: LaTeX-imenu-create-index-function

LaTeX-imenu-create-index-function is a byte-compiled function defined in latex.el.

Signature

(LaTeX-imenu-create-index-function)

Documentation

Return an alist for Imenu support for LaTeX.

The returned alist is built by the same facilities used for outline minor mode support. Hence, the value of TeX-outline-extra is respected.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/latex.el
(defun LaTeX-imenu-create-index-function ()
  "Return an alist for Imenu support for LaTeX.
The returned alist is built by the same facilities used for outline
minor mode support.  Hence, the value of `TeX-outline-extra' is
respected."
  (TeX-update-style)
  (let (entries
        (regexp (LaTeX-outline-regexp)))
    (goto-char (point-max))
    (while (re-search-backward regexp nil t)
      (let* ((name (LaTeX-outline-name))
             (level (make-string (1- (LaTeX-outline-level)) ?\ ))
             (label (concat level level name))
             (mark (make-marker)))
        (set-marker mark (point))
        (set-text-properties 0 (length label) nil label)
        (setq entries (cons (cons label mark) entries))))
    entries))