Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize bibtex-completion-prepare-entry #419

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions bibtex-completion.el
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ having a PDF if \"<key>.<extension\" exists."

(defcustom bibtex-completion-pdf-symbol "⌘"
"Symbol used to indicate that a PDF file is available for a publication.
This should be a single character."
This should be a single character or the empty string."
:group 'bibtex-completion
:type 'string)

Expand Down Expand Up @@ -181,7 +181,7 @@ directory (not a file)."

(defcustom bibtex-completion-notes-symbol "✎"
"Symbol used to indicate that a publication has notes.
This should be a single character."
This should be a single character or the empty string."
:group 'bibtex-completion
:type 'string)

Expand Down Expand Up @@ -834,15 +834,19 @@ find a PDF file."
(when entry ; entry may be nil, in which case just return nil
(let* ((fields (when fields (append fields (list "=type=" "=key=" "=has-pdf=" "=has-note="))))
; Check for PDF:
(entry (if (and (not do-not-find-pdf) (bibtex-completion-find-pdf entry))
(entry (if (and (not do-not-find-pdf)
(not (string= "" bibtex-completion-pdf-symbol))
(bibtex-completion-find-pdf entry))
(cons (cons "=has-pdf=" bibtex-completion-pdf-symbol) entry)
entry))
(entry-key (cdr (assoc "=key=" entry)))
; Check for notes:
(entry (if (cl-some #'identity
(mapcar (lambda (fn)
(funcall fn entry-key))
bibtex-completion-find-note-functions))
(entry (if (and
(not (string= "" bibtex-completion-notes-symbol))
(cl-some #'identity
(mapcar (lambda (fn)
(funcall fn entry-key))
bibtex-completion-find-note-functions)))
(cons (cons "=has-note=" bibtex-completion-notes-symbol) entry)
entry))
; Remove unwanted fields:
Expand Down