Function: LaTeX-completion-bib-list

LaTeX-completion-bib-list is a byte-compiled function defined in latex.el.

Signature

(LaTeX-completion-bib-list)

Documentation

Return a list of bib entries in current document.

If RefTeX is active, use its advanced mechanism, otherwise use LaTeX-bibitem-list(var)/LaTeX-bibitem-list(fun) provided by AUCTeX.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.2.0/latex.el
(defun LaTeX-completion-bib-list ()
  "Return a list of bib entries in current document.
If RefTeX is active, use its advanced mechanism, otherwise use
`LaTeX-bibitem-list' provided by AUCTeX."
  (if (and (bound-and-true-p reftex-mode)
           (require 'reftex-cite nil t))
      ;; `reftex--query-search-regexps' calls `completing-read', so
      ;; prevent this here:
      (cl-letf (((symbol-function #'reftex--query-search-regexps)
                 (lambda (_) '("."))))
        (reftex-access-scan-info)
        (setq LaTeX--completion-bib-list-from-reftex
              ;; This part is extracted from `reftex-offer-bib-menu':
              (pcase (reftex-bib-or-thebib)
                ('thebib (reftex-extract-bib-entries-from-thebibliography
                          (reftex-uniquify
                           (mapcar #'cdr
                                   (reftex-all-assq
                                    'thebib (symbol-value reftex-docstruct-symbol))))))
                ('bib (reftex-extract-bib-entries (reftex-get-bibfile-list)))
                ((pred (lambda (x) (and (null x) reftex-default-bibliography)))
                 (reftex-extract-bib-entries (reftex-default-bibliography)))))
        (when LaTeX--completion-bib-list-from-reftex
          (mapcar (lambda (x) (substring-no-properties (car x)))
                  LaTeX--completion-bib-list-from-reftex)))
    (LaTeX-bibitem-list)))