From 21fc32b8c8386af4562833b9be6521ec3af69865 Mon Sep 17 00:00:00 2001 From: John Kitchin Date: Sun, 25 Jan 2015 11:36:12 -0500 Subject: [PATCH] add try to get pdf if you do not have it --- org-ref.org | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/org-ref.org b/org-ref.org index 0561f76..d4dc2a4 100644 --- a/org-ref.org +++ b/org-ref.org @@ -2874,14 +2874,26 @@ Checks for pdf and doi, and add appropriate functions." (bibtex-autokey-get-field "doi")))) (candidates `(("Quit" . org-ref-citation-at-point) ("Open bibtex entry" . org-ref-open-citation-at-point)))) + ;; for some reason, when there is no doi or url, they are returned as "". I + ;; prefer nil so we correct this here. + (when (string= doi "") (setq doi nil)) + (when (string= url "") (setq url nil)) - - (when (file-exists-p pdf-file) + (if (file-exists-p pdf-file) + (add-to-list + 'candidates + '("Open pdf" . org-ref-open-pdf-at-point) + t + ) (add-to-list 'candidates - '("Open pdf" . org-ref-open-pdf-at-point) - t - )) + '("Try to get pdf" . (lambda () + (save-window-excursion + (org-ref-open-citation-at-point) + (bibtex-beginning-of-entry) + (doi-utils-get-bibtex-entry-pdf)))) + t)) + (add-to-list 'candidates -- 2.39.2