Function: bibtex-enclosing-field
bibtex-enclosing-field is a byte-compiled function defined in
bibtex.el.gz.
Signature
(bibtex-enclosing-field &optional COMMA NOERR)
Documentation
Search for BibTeX field enclosing point.
For bibtex-mode's internal algorithms, a field begins at the comma
following the preceding field. Usually, this is not what the user expects.
Thus if COMMA is non-nil, the "current field" includes the terminating comma
as well as the entry delimiter if it appears on the same line.
Unless NOERR is non-nil, signal an error if no enclosing field is found.
On success return bounds, nil otherwise. Do not move point.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-enclosing-field (&optional comma noerr)
"Search for BibTeX field enclosing point.
For `bibtex-mode''s internal algorithms, a field begins at the comma
following the preceding field. Usually, this is not what the user expects.
Thus if COMMA is non-nil, the \"current field\" includes the terminating comma
as well as the entry delimiter if it appears on the same line.
Unless NOERR is non-nil, signal an error if no enclosing field is found.
On success return bounds, nil otherwise. Do not move point."
(save-excursion
(when comma
(end-of-line)
(skip-chars-backward " \t")
;; Ignore entry delimiter and comma at end of line.
(if (memq (preceding-char) '(?} ?\))) (forward-char -1))
(if (= (preceding-char) ?,) (forward-char -1)))
(let ((bounds (bibtex-search-backward-field bibtex-field-name t)))
(cond ((and bounds
(<= (bibtex-start-of-field bounds) (point))
(>= (bibtex-end-of-field bounds) (point)))
bounds)
((not noerr)
(user-error "Can't find enclosing BibTeX field"))))))