update packages
This commit is contained in:
@@ -32,14 +32,26 @@
|
||||
;; get a doi. This needs a reliable title/citation.
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; pdf-tools is optional, and I think this will skip compiling this file and
|
||||
;; outputting an error.
|
||||
(when (and (bound-and-true-p byte-compile-current-file)
|
||||
(not (locate-library "pdf-tools")))
|
||||
(message "org-ref-pdf: skipping byte-compile; pdf-tools not installed.")
|
||||
(setq byte-compile-current-file nil)
|
||||
(throw 'byte-compile-top-level nil))
|
||||
|
||||
(require 'pdf-tools)
|
||||
|
||||
(require 'f)
|
||||
(require 'org-ref-utils)
|
||||
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl-lib))
|
||||
|
||||
(declare-function org-ref-normalize-bibtex-completion-bibliography "org-ref-utils")
|
||||
|
||||
(defvar bibtex-completion-bibliography)
|
||||
|
||||
(defgroup org-ref-pdf nil
|
||||
"Customization group for org-ref-pdf"
|
||||
@@ -88,7 +100,7 @@ strings, or nil."
|
||||
;; I don't know how to avoid a trailing . on some dois with the
|
||||
;; expression above, so if it is there, I chomp it off here.
|
||||
(let ((doi (match-string 0)))
|
||||
(when (or (s-ends-with? "." doi) (s-ends-with? ";" doi))
|
||||
(when (or (string-suffix-p "." doi) (string-suffix-p ";" doi))
|
||||
(setq doi (substring doi 0 (- (length doi) 1))))
|
||||
(cl-pushnew doi matches :test #'equal)))
|
||||
matches)))
|
||||
@@ -110,9 +122,7 @@ Used when multiple dois are found in a pdf file."
|
||||
"Return a bibtex entry's key from a DOI.
|
||||
BIB is an optional filename to get the entry from."
|
||||
(catch 'key
|
||||
(cl-loop for bibfile in (if (stringp bibtex-completion-bibliography)
|
||||
(list bibtex-completion-bibliography)
|
||||
bibtex-completion-bibliography)
|
||||
(cl-loop for bibfile in (org-ref-normalize-bibtex-completion-bibliography)
|
||||
do
|
||||
(with-temp-buffer
|
||||
(insert-file-contents (expand-file-name bibfile))
|
||||
@@ -126,7 +136,7 @@ BIB is an optional filename to get the entry from."
|
||||
"Add pdf of current buffer to bib file and save pdf. The pdf
|
||||
should be open in Emacs using the `pdf-tools' package."
|
||||
(interactive)
|
||||
(when (not (f-ext? (downcase (buffer-file-name)) "pdf"))
|
||||
(when (not (org-ref--file-ext-p (downcase (buffer-file-name)) "pdf"))
|
||||
(error "Buffer is not a pdf file"))
|
||||
;; Get doi from pdf of current buffer
|
||||
(let* ((dois (org-ref-extract-doi-from-pdf (buffer-file-name)))
|
||||
|
||||
Reference in New Issue
Block a user