Function: bibtex--skip-field-aliases
bibtex--skip-field-aliases is a byte-compiled function defined in
bibtex.el.gz.
Signature
(bibtex--skip-field-aliases LIST)
Documentation
Skip fields in LIST that are aliases, return the shortened list.
Aliases are fields for which the element ALTERNATIVE is a negative number,
see bibtex-BibTeX-entry-alist. The shortened field list is used
for the templates of bibtex-entry, whereas entry validation performed by
bibtex-format-entry uses the full list of fields for an entry.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex--skip-field-aliases (list)
"Skip fields in LIST that are aliases, return the shortened list.
Aliases are fields for which the element ALTERNATIVE is a negative number,
see `bibtex-BibTeX-entry-alist'. The shortened field list is used
for the templates of `bibtex-entry', whereas entry validation performed by
`bibtex-format-entry' uses the full list of fields for an entry."
;; FIXME: `bibtex-entry' and `bibtex-format-entry' handle field aliases
;; under the hood in a manner that is largely invisible to users.
;; If instead one wanted to display the aliases as alternatives
;; in the usual way, field names may get both the ALT and the OPT prefix.
;; That gets rather clumsy. Also, the code currently assumes that
;; field names have either the ALT or the OPT prefix, but not both.
;; Are there scenarios when it would be useful to display both?
(let (alt-list new-list)
(dolist (elt list) ; identify alternatives
(if (and (nth 3 elt)
(<= 0 (nth 3 elt)))
(push (nth 3 elt) alt-list)))
(setq alt-list (sort alt-list #'<))
;; Skip aliases. If ELT is marked as "proper alternative", but all
;; alternatives for field ELT are aliases, we do not label ELT
;; as an alternative either.
(dolist (elt list)
(let ((alt (nth 3 elt)))
(if alt
(if (<= 0 alt)
(push (if (eq alt (cadr (memq alt alt-list)))
elt ; ELT has proper alternatives
(butlast elt)) ; alternatives of ELT are alias
new-list))
(push elt new-list))))
(reverse new-list)))