Function: bibtex-text-in-field

bibtex-text-in-field is a byte-compiled function defined in bibtex.el.gz.

Signature

(bibtex-text-in-field FIELD &optional FOLLOW-CROSSREF)

Documentation

Return content of field FIELD of current BibTeX entry or nil if not found.

FIELD may also be a list of fields that are tried in order. If optional arg FOLLOW-CROSSREF is non-nil, follow crossref.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-text-in-field (field &optional follow-crossref)
  "Return content of field FIELD of current BibTeX entry or nil if not found.
FIELD may also be a list of fields that are tried in order.
If optional arg FOLLOW-CROSSREF is non-nil, follow crossref."
  (save-excursion
    (let ((end (if (and (not follow-crossref) (stringp field))
                   t ; try to minimize parsing
                 (bibtex-end-of-entry)))
          bounds)
      (bibtex-beginning-of-entry) ; move point
      (let ((field (if (stringp field) (list field) field)))
        (while (and field (not bounds))
          (setq bounds (bibtex-search-forward-field (pop field) end))))
      (cond (bounds (bibtex-text-in-field-bounds bounds t))
            ((and follow-crossref
                  (setq bounds (bibtex-search-forward-field
                                "\\(OPT\\)?crossref" end)))
             (let ((crossref-field (bibtex-text-in-field-bounds bounds t)))
               (if (bibtex-search-crossref crossref-field)
                   ;; Do not pass FOLLOW-CROSSREF because we want
                   ;; to follow crossrefs only one level of recursion.
                   (bibtex-text-in-field field))))))))