Skip to content

Commit

Permalink
add function to determine local files to cache
Browse files Browse the repository at this point in the history
  • Loading branch information
bdarcus committed Aug 4, 2021
1 parent 285372d commit c69c37a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bibtex-actions.el
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,21 @@ offering the selection candidates"
collect (cdr (or (assoc choice candidates)
(rassoc choice candidates))))))

(defun bibtex-actions--normalize-paths (file-paths)
"Return a list of FILE-PATHS sorted and normalized with truename."
(cl-sort
(delete-dups
(mapcar (lambda (p) (file-truename p)) file-paths)) 'string-lessp))

(defun bibtex-actions--local-files-to-cache ()
"The local bibliographic files not included in the global bibliography."
;; We cache these locally to the buffer.
(let* ((local-bib-files
(bibtex-actions--normalize-paths (bibtex-completion-find-local-bibliography)))
(global-bib-files
(bibtex-actions--normalize-paths bibtex-completion-bibliography)))
(seq-difference local-bib-files global-bib-files)))

(defun bibtex-actions--format-candidates ()
"Transform candidates from 'bibtex-completion-candidates'.
This both propertizes the candidates for display, and grabs the
Expand Down

0 comments on commit c69c37a

Please sign in to comment.