(defcustom org-ref-open-pdf-function
'org-ref-open-pdf-at-point
-"User-defined function to open a pdf from a link. The function must get the key at point, and derive a path to the pdf file, then open it. The default function is `org-ref-open-pdf-at-point'."
+ "User-defined function to open a pdf from a link. The
+function must get the key at point, and derive a path to the pdf
+file, then open it. The default function is
+`org-ref-open-pdf-at-point'."
:type 'function
:group 'org-ref)
+(defcustom org-ref-get-pdf-filename-function
+ 'org-ref-get-pdf-filename
+ "User-defined function to get a filename from a bibtex key.
+The function must take a key as an argument, and return the path
+to the corresponding filename. The default is
+`org-ref-get-pdf-filename'.")
+
+
(defcustom org-ref-insert-cite-function
'org-ref-helm-insert-cite-link
"Function to call to insert citation links. The default is `org-ref-helm-insert-cite-link' which uses `helm-bibtex'. `org-ref' modifies `helm-bibtex' a little bit to give `org-mode' citations, and to reorder default actions. You may use `org-ref-insert-cite-link' if you like the reftex interface."
;; *** key at point functions
+(defun org-ref-get-pdf-filename (key)
+ "Return the pdf filename associated with a bibtex KEY."
+ (format (concat org-ref-pdf-directory "%s.pdf") key))
+
(defun org-ref-open-pdf-at-point ()
"Open the pdf for bibtex key under point if it exists."
(interactive)
(let* ((results (org-ref-get-bibtex-key-and-file))
(key (car results))
- (pdf-file (format (concat org-ref-pdf-directory "%s.pdf") key)))
+ (pdf-file (funcall org-ref-get-pdf-filename-function key)))
(if (file-exists-p pdf-file)
(org-open-file pdf-file)
(message "no pdf found for %s" key))))
(interactive)
(let* ((results (org-ref-get-bibtex-key-and-file))
(key (car results))
- (pdf-file (format (concat org-ref-pdf-directory "%s.pdf") key))
+ (pdf-file (funcall org-ref-get-pdf-filename-function key))
(bibfile (cdr results))
(url (save-excursion
(with-temp-buffer
Checks for pdf and doi, and add appropriate functions."
(let* ((results (org-ref-get-bibtex-key-and-file))
(key (car results))
- (pdf-file (format (concat org-ref-pdf-directory "%s.pdf") key))
+ (pdf-file (funcall org-ref-get-pdf-filename-function key))
(bibfile (cdr results))
(url (save-excursion
(with-temp-buffer