From: John Kitchin Date: Sun, 25 Jan 2015 16:36:12 +0000 (-0500) Subject: add try to get pdf if you do not have it X-Git-Url: https://git.donarmstrong.com/?p=org-ref.git;a=commitdiff_plain;h=21fc32b8c8386af4562833b9be6521ec3af69865;ds=sidebyside add try to get pdf if you do not have it --- 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