Function: bibtex-text-in-field-bounds

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

Signature

(bibtex-text-in-field-bounds BOUNDS &optional CONTENT)

Documentation

Get text in BibTeX field defined via BOUNDS.

If optional arg CONTENT is non-nil extract content of field by removing field delimiters and concatenating the resulting string. If bibtex-expand-strings is non-nil, also expand BibTeX strings.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-text-in-field-bounds (bounds &optional content)
  "Get text in BibTeX field defined via BOUNDS.
If optional arg CONTENT is non-nil extract content of field
by removing field delimiters and concatenating the resulting string.
If `bibtex-expand-strings' is non-nil, also expand BibTeX strings."
  (if content
      (save-excursion
        (goto-char (bibtex-start-of-text-in-field bounds))
        (let ((epoint (bibtex-end-of-text-in-field bounds))
              content)
          (while (< (point) epoint)
            (if (looking-at bibtex-field-const)
                (let ((mtch (match-string-no-properties 0)))
                  (push (or (if bibtex-expand-strings
                                (cdr (assoc-string mtch (bibtex-strings) t)))
                            mtch)
                        content)
                  (goto-char (match-end 0)))
              (let ((bounds (bibtex-parse-field-string)))
                (push (buffer-substring-no-properties
                       (1+ (car bounds)) (1- (cdr bounds)))
                      content)
                (goto-char (cdr bounds))))
            (re-search-forward "\\=[ \t\n]*#[ \t\n]*" nil t))
          (apply #'concat (nreverse content))))
    (buffer-substring-no-properties (bibtex-start-of-text-in-field bounds)
                                    (bibtex-end-of-text-in-field bounds))))