Function: bibtex-field-list

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

Signature

(bibtex-field-list ENTRY-TYPE)

Documentation

Return list of allowed fields for entry ENTRY-TYPE.

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-TYPE according to bibtex-BibTeX-entry-alist and friends, bibtex-include-OPTkey, bibtex-include-OPTcrossref, and bibtex-user-optional-fields.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-field-list (entry-type)
  "Return list of allowed fields for entry ENTRY-TYPE.
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-TYPE according to `bibtex-BibTeX-entry-alist' and friends,
`bibtex-include-OPTkey', `bibtex-include-OPTcrossref',
and `bibtex-user-optional-fields'."
  (let ((e-list (assoc-string entry-type bibtex-entry-alist t))
        required optional)
    (unless e-list
      (user-error "Fields for BibTeX entry type %s not defined" entry-type))
    (if (member-ignore-case entry-type bibtex-include-OPTcrossref)
        (setq required (nth 2 e-list)
              optional (append (nth 3 e-list) (nth 4 e-list)))
      (setq required  (append (nth 2 e-list) (nth 3 e-list))
            optional (nth 4 e-list)))
    (if bibtex-include-OPTkey
        (push (list "key" "Used as label with certain BibTeX styles"
                    (if (or (stringp bibtex-include-OPTkey)
                            (functionp bibtex-include-OPTkey))
                        bibtex-include-OPTkey))
              optional))
    (if (member-ignore-case entry-type bibtex-include-OPTcrossref)
        (push '("crossref" "Reference key of the cross-referenced entry")
              optional))
    (setq optional (append optional bibtex-user-optional-fields))
    (cons (bibtex--skip-field-aliases required)
          (bibtex--skip-field-aliases optional))))