Function: bibtex-parse-field-name

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

Signature

(bibtex-parse-field-name)

Documentation

Parse the name part of a BibTeX field.

If the field name is found, return a triple consisting of the position of the very first character of the match, the actual starting position of the name part and end position of the match. Move point to end of field name. If bibtex-autoadd-commas is non-nil add missing comma at end of preceding BibTeX field as necessary.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-parse-field-name ()
  "Parse the name part of a BibTeX field.
If the field name is found, return a triple consisting of the position of the
very first character of the match, the actual starting position of the name
part and end position of the match.  Move point to end of field name.
If `bibtex-autoadd-commas' is non-nil add missing comma at end of preceding
BibTeX field as necessary."
  (cond ((looking-at bibtex-name-part)
         (goto-char (match-end 0))
         (list (match-beginning 0) (match-beginning 1) (match-end 0)))
        ;; Maybe add a missing comma.
        ((and bibtex-autoadd-commas
              (looking-at (concat "[ \t\n]*\\(?:" bibtex-field-name
                                  "\\)[ \t\n]*=")))
         (skip-chars-backward " \t\n")
         ;; It can be confusing if non-editing commands try to
         ;; modify the buffer.
         (if buffer-read-only
             (user-error "Comma missing at buffer position %s" (point)))
         (insert ",")
         (forward-char -1)
         ;; Now try again.
         (bibtex-parse-field-name))))