Function: org-cite-basic--key-completion-table
org-cite-basic--key-completion-table is a byte-compiled function
defined in oc-basic.el.gz.
Signature
(org-cite-basic--key-completion-table)
Documentation
Return completion table for cite keys, as a hash table.
In this hash table, keys are a strings with author, date, and title of the reference. Values are the cite keys.
Return nil if there are no bibliography files or no entries.
Source Code
;; Defined in /usr/src/emacs/lisp/org/oc-basic.el.gz
(defun org-cite-basic--key-completion-table ()
"Return completion table for cite keys, as a hash table.
In this hash table, keys are a strings with author, date, and
title of the reference. Values are the cite keys.
Return nil if there are no bibliography files or no entries."
;; Populate bibliography cache.
(let ((entries (org-cite-basic--parse-bibliography)))
(cond
((null entries) nil) ;no bibliography files
((gethash entries org-cite-basic--completion-cache)
org-cite-basic--completion-cache)
(t
(clrhash org-cite-basic--completion-cache)
(dolist (key (org-cite-basic--all-keys))
(let* ((entry (org-cite-basic--get-entry
key
;; Supply pre-calculated bibliography to avoid
;; performance degradation.
(list :cite-basic/bibliography entries)))
(completion
(concat
(let ((author (org-cite-basic--get-author entry nil 'raw)))
(if author
(truncate-string-to-width
(replace-regexp-in-string " and " "; " author)
org-cite-basic-author-column-end nil ?\s)
(make-string org-cite-basic-author-column-end ?\s)))
org-cite-basic-column-separator
(let ((date (org-cite-basic--get-year entry nil 'no-suffix)))
(format "%4s" (or date "")))
org-cite-basic-column-separator
(org-cite-basic--get-field 'title entry nil 'raw))))
(puthash completion key org-cite-basic--completion-cache)))
(unless (map-empty-p org-cite-basic--completion-cache) ;no key
(puthash entries t org-cite-basic--completion-cache)
org-cite-basic--completion-cache)))))