X-Git-Url: https://git.donarmstrong.com/?p=org-ref.git;a=blobdiff_plain;f=org-ref.org;h=c6c3a67a755410ac97d2f78f0747999f5abb7ee5;hp=0561f76a7d583075264fdd1d2099a3f18fa679fe;hb=8567d22b28bb74586896e1a11af2406368978309;hpb=d832a3f74c8f41017016f79f3b6e2ad1677b4c0c diff --git a/org-ref.org b/org-ref.org index 0561f76..c6c3a67 100644 --- a/org-ref.org +++ b/org-ref.org @@ -2874,20 +2874,33 @@ 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) + ;; Conditional pdf functions + (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 '("Open notes" . org-ref-open-notes-at-point) t) + ;; conditional url and doi functions (when (or url doi) (add-to-list 'candidates