Function: bibtex-entry-index

bibtex-entry-index is a byte-compiled function defined in bibtex.el.gz.

Signature

(bibtex-entry-index)

Documentation

Return index of BibTeX entry head at or past position of point.

The index is a list (KEY CROSSREF-KEY ENTRY-TYPE) that is used for sorting the entries of the BibTeX buffer. CROSSREF-KEY is nil unless the value of bibtex-maintain-sorted-entries is crossref. If bibtex-maintain-sorted-entries is (INDEX-FUN ...), the index is the return value of INDEX-FUN. Return nil if no entry found. Move point to the end of the head of the entry found.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-entry-index ()
  "Return index of BibTeX entry head at or past position of point.
The index is a list (KEY CROSSREF-KEY ENTRY-TYPE) that is used for sorting
the entries of the BibTeX buffer.  CROSSREF-KEY is nil unless the value of
`bibtex-maintain-sorted-entries' is `crossref'.
If `bibtex-maintain-sorted-entries' is (INDEX-FUN ...), the index is the return
value of INDEX-FUN.  Return nil if no entry found.
Move point to the end of the head of the entry found."
  (let ((case-fold-search t))
    (if (re-search-forward bibtex-entry-maybe-empty-head nil t)
        (if (consp bibtex-maintain-sorted-entries)
            ;; Custom sorting scheme
            (funcall (car bibtex-maintain-sorted-entries))
          (let ((key (bibtex-key-in-head))
                ;; ENTRY-TYPE should be downcase (for ease of comparison)
                (entry-type (downcase (bibtex-type-in-head)))
                bounds)
            (list key
                  ;; Don't search CROSSREF-KEY if we don't need it.
                  (and (eq bibtex-maintain-sorted-entries 'crossref)
                       (setq bounds (bibtex-search-forward-field
                                      "\\(OPT\\)?crossref" t))
                       (bibtex-text-in-field-bounds bounds t))
                  entry-type))))))