Function: bibtex-valid-entry
bibtex-valid-entry is a byte-compiled function defined in
bibtex.el.gz.
Signature
(bibtex-valid-entry &optional EMPTY-KEY)
Documentation
Parse a valid BibTeX entry (maybe without key if EMPTY-KEY is t).
A valid entry is a syntactical correct one with type contained in
bibtex-BibTeX-entry-alist. Ignore @String and @Preamble entries.
Return a cons pair with buffer positions of beginning and end of entry
if a valid entry is found, nil otherwise. Do not move point.
After a call to this function match-data corresponds to the header
of the entry, see regexp bibtex-entry-head.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-valid-entry (&optional empty-key)
"Parse a valid BibTeX entry (maybe without key if EMPTY-KEY is t).
A valid entry is a syntactical correct one with type contained in
`bibtex-BibTeX-entry-alist'. Ignore @String and @Preamble entries.
Return a cons pair with buffer positions of beginning and end of entry
if a valid entry is found, nil otherwise. Do not move point.
After a call to this function `match-data' corresponds to the header
of the entry, see regexp `bibtex-entry-head'."
(let ((case-fold-search t) end)
(if (looking-at (if empty-key bibtex-entry-maybe-empty-head
bibtex-entry-head))
(save-excursion
(save-match-data
(goto-char (match-end 0))
(let ((entry-closer
(if (save-excursion
(goto-char (match-end bibtex-type-in-head))
(looking-at "[ \t]*("))
",?[ \t\n]*)" ; entry opened with `('
",?[ \t\n]*}")) ; entry opened with `{'
bounds)
(skip-chars-forward " \t\n")
;; loop over all BibTeX fields
(while (setq bounds (bibtex-parse-field))
(goto-char (bibtex-end-of-field bounds)))
;; This matches the infix* part.
(if (looking-at entry-closer) (setq end (match-end 0)))))
(if end (cons (match-beginning 0) end))))))