Function: reftex-index-info

reftex-index-info is an autoloaded and byte-compiled function defined in reftex-parse.el.gz.

Signature

(reftex-index-info FILE)

Documentation

Return an index entry for the current match.

Careful: This function expects the match-data to still be in place!

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex-parse.el.gz
;;;###autoload
(defun reftex-index-info (file)
  "Return an index entry for the current match.
Careful: This function expects the `match-data' to still be in
place!"
  (catch 'exit
    (let* ((macro (reftex-match-string 10))
           (bom (match-beginning 10))
           (boa (match-end 10))
           (entry (or (assoc macro reftex-index-macro-alist)
                      (throw 'exit nil)))
           (exclude (nth 3 entry))
           ;; The following is a test if this match should be excluded
           (test-dummy (and (fboundp exclude)
                            (funcall exclude)
                            (throw 'exit nil)))
           (itag (nth 1 entry))
           (prefix (nth 2 entry))
           (index-tag
            (cond ((stringp itag) itag)
                  ((integerp itag)
                   (progn (goto-char boa)
                          (or (reftex-nth-arg itag (nth 6 entry)) "idx")))
                  (t "idx")))
           (arg (or (progn (goto-char boa)
                           (reftex-nth-arg (nth 5 entry) (nth 6 entry)))
                    ""))
           (end-of-args (progn (goto-char boa)
                               (reftex-move-over-touching-args)
                               (point)))
           (end-of-context (progn (skip-chars-forward "^ \t\n\r") (point)))
           (begin-of-context
            (progn (goto-char bom)
                   (skip-chars-backward "^ \t\r\n")
                   (point)))
           (context (buffer-substring-no-properties
                     begin-of-context end-of-context))
           (key-end (if (string-match reftex-index-key-end-re arg)
                        (1+ (match-beginning 0))))
           (rawkey (substring arg 0 key-end))

           (key (if prefix (concat prefix rawkey) rawkey))
           (sortkey (downcase key))
           (showkey (mapconcat #'identity
                               (split-string key reftex-index-level-re)
                               " ! ")))
      (goto-char end-of-args)
      ;;       0        1       2      3   4   5  6      7       8      9
      (list 'index index-tag context file bom arg key showkey sortkey key-end))))