X-Git-Url: https://git.donarmstrong.com/?p=org-ref.git;a=blobdiff_plain;f=org-ref.org;h=d4dc2a40f5f0169b1067a2e72e79af7983b52910;hp=0561f76a7d583075264fdd1d2099a3f18fa679fe;hb=21fc32b8c8386af4562833b9be6521ec3af69865;hpb=d832a3f74c8f41017016f79f3b6e2ad1677b4c0c 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