(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."
(if reftex-comment-citations
reftex-cite-comment-format
"")))
- ((= l ?a) (reftex-format-names
- (reftex-get-bib-names "author" entry)
- (or n 2)))
- ((= l ?A) (car (reftex-get-bib-names "author" entry)))
+ ((= l ?a) (replace-regexp-in-string
+ "\n\\|\t\\|\s+" " "
+ (reftex-format-names
+ (reftex-get-bib-names "author" entry)
+ (or n 2))))
+ ((= l ?A) (replace-regexp-in-string
+ "\n\\|\t\\|\s+" " "
+ (car (reftex-get-bib-names "author" entry))))
((= l ?b) (org-ref-reftex-get-bib-field "booktitle" entry "in: %s"))
((= l ?B) (reftex-abbreviate-title
(org-ref-reftex-get-bib-field "booktitle" entry "in: %s")))
((= l ?U) (org-ref-reftex-get-bib-field "url" entry))
((= l ?r) (org-ref-reftex-get-bib-field "address" entry))
;; strip enclosing brackets from title if they are there
- ((= l ?t) (org-ref-reftex-get-bib-field "title" entry))
+ ((= l ?t) (replace-regexp-in-string
+ "\n\\|\t\\|\s+" " "
+ (org-ref-reftex-get-bib-field "title" entry)))
((= l ?T) (reftex-abbreviate-title
((replace-regexp-in-string
"\n\\|\t\\|\s+" " "
;; *** 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