update of packages

This commit is contained in:
2023-11-04 19:26:41 +01:00
parent e162a12b58
commit 3b54a3236d
726 changed files with 297673 additions and 34585 deletions

View File

@@ -190,6 +190,16 @@ You set =pdftotext-executable= to ${pdftotext-executable} (exists: ${pdftotext-e
(bibtex-copy-entry-as-kill)
(pop bibtex-entry-kill-ring)))
(defun org-ref-library-path ()
"return the library path"
(cond
((stringp bibtex-completion-library-path)
bibtex-completion-library-path)
((and (listp bibtex-completion-library-path)
(= 1 (length bibtex-completion-library-path)))
(car bibtex-completion-library-path))
(t
(completing-read "Dir: " bibtex-completion-library-path))))
;;*** key at point functions
(defun org-ref-get-pdf-filename (key)
@@ -261,6 +271,36 @@ Jabref, Mendeley and Zotero. See `bibtex-completion-find-pdf'."
(completing-read "pdf: " pdf-file))))))
;;;###autoload
(defun org-ref-add-pdf-at-point (&optional prefix)
"Add the pdf for bibtex key under point if it exists.
Similar to org-ref-bibtex-assoc-pdf-with-entry prompt for pdf
associated with bibtex key at point and rename it. Check whether a
pdf already exists in `bibtex-completion-library' with the name
'[bibtexkey].pdf'. If the file does not exist, rename it to
'[bibtexkey].pdf' using
`org-ref-bibtex-assoc-pdf-with-entry-move-function' and place it
in a directory. Optional PREFIX argument toggles between
`rename-file' and `copy-file'."
(interactive)
(let* ((bibtex-completion-bibliography (org-ref-find-bibliography))
(results (org-ref-get-bibtex-key-and-file))
(key (car results))
(pdf-file (bibtex-completion-find-pdf-in-library key)))
(if pdf-file
(message "PDF for key [%s] already exists %s" key pdf-file)
(let* (
(source-file-name (read-file-name (format "Select pdf file associated with key [%s]: " key)
org-ref-bibtex-pdf-download-dir))
(dest-file-name (expand-file-name (format "%s.pdf" key) (org-ref-library-path)))
(file-move-func (org-ref-bibtex-get-file-move-func prefix))
)
(progn
(funcall file-move-func source-file-name dest-file-name)
(message "added file %s to key %s" dest-file-name key))))))
;;;###autoload
(defun org-ref-open-url-at-point ()
"Open the url for bibtex key under point."
@@ -1131,13 +1171,18 @@ if FORCE is non-nil reparse the buffer no matter what."
;;** Find non-ascii charaters
;;** Find non-ascii characters
;;;###autoload
(defun org-ref-find-non-ascii-characters ()
"Find non-ascii characters in the buffer. Useful for cleaning up bibtex files."
(interactive)
(occur "[^[:ascii:]]"))
;;* Utilities
;;** Extract bibtex entries in org-file
;;;###autoload
(defun org-ref-extract-bibtex-to-file (bibfile &optional clobber)
"Extract all bibtex entries for citations buffer to BIBFILE.
@@ -1176,10 +1221,6 @@ which will CLOBBER the file."
"\n\n")))))
;;* Utilities
;;** Extract bibtex entries in org-file
;;;###autoload
(defun org-ref-extract-bibtex-entries ()
"Extract the bibtex entries in the current buffer into a bibtex src block."
@@ -1216,6 +1257,22 @@ which will CLOBBER the file."
"\n\n")))))
;;** Extract cited pdfs
;;;###autoload
(defun org-ref-extract-cited-pdfs (newdir)
"Copy PDFs in citations in current buffer to NEWDIR."
(interactive (list (read-directory-name "Copy to: ")))
;; Make sure newdir exists
(unless (file-directory-p newdir)
(mkdir newdir t))
(cl-loop for key in (org-ref-get-bibtex-keys) do
(let ((pdf (org-ref-get-pdf-filename key)))
(if (file-exists-p pdf)
(progn
(message "Copying %s to %s." pdf newdir)
(copy-file pdf newdir t))
(message "%s not found" pdf)))))
(provide 'org-ref-utils)