Function: bibtex-field-list

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

Signature

(bibtex-field-list ENTRY)

Documentation

Return list of allowed fields for entry ENTRY.

More specifically, the return value is a cons pair (REQUIRED . OPTIONAL), where REQUIRED and OPTIONAL are lists of the required and optional field names for ENTRY according to bibtex-BibTeX-entry-alist and friends, and bibtex-include-OPTcrossref.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-field-list (entry)
  "Return list of allowed fields for entry ENTRY.
More specifically, the return value is a cons pair (REQUIRED . OPTIONAL),
where REQUIRED and OPTIONAL are lists of the required and optional field
names for ENTRY according to `bibtex-BibTeX-entry-alist' and friends,
and `bibtex-include-OPTcrossref'."
  (let* ((e-list (assoc-string entry bibtex-entry-alist t))
         (_ (unless e-list
              (user-error "Fields for BibTeX entry type %s not defined" entry)))
         (crossref (member-ignore-case entry bibtex-include-OPTcrossref))
         (required (if crossref (nth 2 e-list)
                     (append (nth 2 e-list) (nth 3 e-list))))
         (optional (if crossref
                       (append '(("crossref")) (nth 3 e-list) (nth 4 e-list))
                     (nth 4 e-list))))
    ;; The following clause can be removed when the obsolete variable
    ;; `bibtex-include-OPTkey' will be removed.
    (if (and bibtex-include-OPTkey (not (assoc-string "key" optional t)))
        (push (list "key" nil
                    (if (or (stringp bibtex-include-OPTkey)
                            (functionp bibtex-include-OPTkey))
                        bibtex-include-OPTkey))
              optional))
    (cons (bibtex--skip-field-aliases required)
          (bibtex--skip-field-aliases optional))))