Skip to content

Commit

Permalink
simplify --get-candidates
Browse files Browse the repository at this point in the history
  • Loading branch information
bdarcus committed Feb 27, 2021
1 parent a17fc0d commit 54b8b4b
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions bibtex-completion.el
Original file line number Diff line number Diff line change
Expand Up @@ -516,22 +516,11 @@ for string replacement."
for candidate in (bibtex-completion-candidates)
collect
(cons
;; Here we concat the string for display with an invisible string enhanced
;; for search, when bibtex-completion-additional-search-fields is non-nil.
(concat(bibtex-completion-format-entry candidate (1- (frame-width)))
(propertize (bibtex-completion--get-extra-search-data candidate) 'invisible t))
(cdr (assoc "=key=" candidate)))))

(defun bibtex-completion--get-extra-search-data (candidate)
"Return extended search metadata as string."
(if bibtex-completion-additional-search-fields
; if the data is present, pull its value(s), join into a single string
; TODO FIX ME, this is wrong
(format "%s" (cl-loop
for field in bibtex-completion-additional-search-fields
collect
(cdr (assoc field (cdr candidate)))
))))
;; Here use one string for display, and the other for search.
;; TODO not working correctly
(concat(car (candidate)))
(propertize (bibtex-completion-format-entry candidate) 'display)))
(cdr (assoc "=key=" candidate)))

(defun bibtex-completion-candidates ()
"Read the BibTeX files and return a list of conses, one for each entry.
Expand Down

0 comments on commit 54b8b4b

Please sign in to comment.