update packages

This commit is contained in:
2025-03-11 21:14:26 +01:00
parent 45d49daef0
commit 14dcaaddde
440 changed files with 13229 additions and 8718 deletions

View File

@@ -1,9 +1,16 @@
;;; contrib.el --- Code contributed by users
;;; contrib.el --- Code contributed by users -*- lexical-binding: t; -*-
;;; Commentary:
;;
;;; Code:
(defvar org-ref-cite-types)
(declare-function org-element-context "org-element")
(declare-function org-element-type "org-element")
(declare-function org-element-property "org-element")
(declare-function bibtex-completion-apa-format-reference "bibtex-completion")
(declare-function org-ref-parse-cite-path "org-ref-citation-links")
;; * Add messages in minibuffer
;; Contributed in https://github.com/jkitchin/org-ref/issues/938 by @DiogoFerrari
@@ -17,7 +24,7 @@ If not on a key, but on a cite, prompt for key."
key
;; point is not on a key, but may still be on a cite link
(let ((el (org-element-context))
data
data text
keys)
(cond
;; on a cite-link type
@@ -33,7 +40,7 @@ If not on a key, but on a cite, prompt for key."
(dolist (key keys)
(search-forward key)
(goto-char (match-beginning 0))
(get-text-property (point) 'cite-key)
;; (get-text-property (point) 'cite-key)
;; (message (bibtex-completion-apa-format-reference key))
(setq text (concat text "\n" (bibtex-completion-apa-format-reference key))))))))
(message (string-trim-left text)))
@@ -45,7 +52,8 @@ If not on a key, but on a cite, prompt for key."
(defcustom org-ref-message-interval 0.5
"Time in seconds to wait for the idle timer that displays the cite message."
:group 'org-ref)
:group 'org-ref
:type 'float)
(defun org-ref-link-message ()

View File

@@ -43,6 +43,10 @@
(declare-function org-bibtex-yank "org-bibtex")
(declare-function org-ref-possible-bibfiles "org-ref-core")
(declare-function f-ext? "f")
(declare-function f-entries "f")
(declare-function s-match "s")
(eval-when-compile
(require 'cl-lib))
(require 'bibtex)
@@ -1006,7 +1010,9 @@ Opening %s" json-data url))
(url (plist-get results :URL))
(booktitle (plist-get results :container-title))
(school (or (plist-get results :school)
(plist-get (plist-get results :institution) :name)))))
(plist-get (plist-get results :institution) :name)))
;; I am not sure how general this is. This gets the first name.
(institution (plist-get (car (plist-get results :institution)) :name))))
;; Next, we need to define the different bibtex types. Each type has a bibtex
;; type (for output) and the type as provided in the doi record. Finally, we
@@ -1066,13 +1072,17 @@ MATCHING-TYPES."
(doi-utils-def-bibtex-type inproceedings ("proceedings-article" "paper-conference")
author title booktitle year month pages doi url)
(doi-utils-def-bibtex-type book ("book")
(doi-utils-def-bibtex-type book ("book" "edited-book")
author title series publisher year pages doi url)
(doi-utils-def-bibtex-type inbook ("chapter" "book-chapter" "reference-entry")
author title booktitle series publisher year pages doi url)
(doi-utils-def-bibtex-type phdthesis ("phdthesis" "thesis" "dissertation")
author title school publisher year)
author title school publisher year)
(doi-utils-def-bibtex-type techreport ("report")
institution author title publisher year doi url)
;; this is what preprints in chemrxiv look like for now
(doi-utils-def-bibtex-type misc ("posted-content")

View File

@@ -1,4 +1,4 @@
;;; nist-webbook.el --- Integration of Emacs with NIST Webbook
;;; nist-webbook.el --- Integration of Emacs with NIST Webbook -*- lexical-binding: t; -*-
;; Integration of Emacs with NIST webbook
;;; Commentary:

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
;;; org-ref-arxiv.el --- arxiv utilities for org-mode -*- lexical-binding: t; -*-
;; Copyright (C) 2015-2021 John Kitchin
;; Copyright (C) 2015-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords:
@@ -137,9 +137,9 @@ Returns a formatted BibTeX entry."
(org-ref-replace-nonascii)
(bibtex-generate-autokey)))
(doi (assq 'doi entry)))
(if doi
(doi-utils-doi-to-bibtex-string (nth 2 doi))
;; no doi, so we fall back to the simple template
(unless (and doi
(ignore-errors (doi-utils-doi-to-bibtex-string (nth 2 doi))))
;; no doi or inactive doi, so we fall back to the simple template
(format arxiv-entry-format-string key title names year arxiv-number category abstract url)))))
@@ -223,15 +223,7 @@ Returns a formatted BibTeX entry."
(arxiv-maybe-arxiv-id-from-current-kill))
(read-string
"PDF: ")))
(let ((pdf-url (with-current-buffer
(url-retrieve-synchronously
(concat
"http://arxiv.org/abs/" arxiv-number))
;; <meta name="citation_pdf_url" content="http://arxiv.org/pdf/0801.1144" />
(goto-char (point-min))
(search-forward-regexp
"name=\\\"citation_pdf_url\\\" content=\\\"\\(.*\\)\\\"")
(match-string 1))))
(let ((pdf-url (format "https://arxiv.org/pdf/%s" arxiv-number)))
(url-copy-file pdf-url pdf)
;; now check if we got a pdf
(unless (org-ref-pdf-p pdf)
@@ -296,8 +288,13 @@ key."
(when (file-exists-p (concat pdfdir key ".pdf"))
(bibtex-end-of-entry)
(backward-char)
(insert (format " file = {%s}\n " (concat pdfdir key ".pdf")))))))
(insert (format " file = {%s}\n " (concat pdfdir key ".pdf")))))
(save-buffer)))
(provide 'org-ref-arxiv)
;;; org-ref-arxiv.el ends here
;; Local Variables:
;; byte-compile-warnings: (not docstrings)
;; End:

View File

@@ -1,6 +1,6 @@
;;; org-ref-bibliography-links.el --- Bibliography and bibliographystyle links
;;; org-ref-bibliography-links.el --- Bibliography and bibliographystyle links -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2021 John Kitchin
;; Copyright (C) 2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords: convenience
@@ -310,3 +310,7 @@ Optional argument BACKEND is the export backend."
(provide 'org-ref-bibliography-links)
;;; org-ref-bibliography-links.el ends here
;; Local Variables:
;; byte-compile-warnings: (not docstrings)
;; End:

View File

@@ -1,6 +1,6 @@
;;; org-ref-bibtex.el -- org-ref-bibtex utilities
;;; org-ref-bibtex.el -- org-ref-bibtex utilities -*- lexical-binding: t; -*-
;; Copyright(C) 2014-2021 John Kitchin
;; Copyright(C) 2014-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; URL: https://github.com/jkitchin/org-ref
@@ -67,8 +67,10 @@
(require 's)
(require 'doi-utils)
(require 'avy)
(require 'sgml-mode)
(defvar bibtex-completion-bibliography)
(defvar bibtex-completion-library-path)
(declare-function bibtex-completion-show-entry "bibtex-completion")
(declare-function org-ref-find-bibliography "org-ref-core")
(declare-function org-element-property "org-element")
@@ -1171,7 +1173,7 @@ will clobber the file."
(format "%s = %s,\n" f v))))
(-uniq other-fields) "\n")
"\n}"))
(bibtex-find-entry key)
(bibtex-search-entry key)
(bibtex-fill-entry)
(bibtex-clean-entry))))
@@ -1201,7 +1203,7 @@ will clobber the file."
(cdr (assoc field entry))))
entry-fields "\n")
"\n}\n\n"))
(bibtex-find-entry key)
(bibtex-search-entry key)
(bibtex-fill-entry)
(bibtex-clean-entry)))
@@ -1460,3 +1462,7 @@ See functions in `org-ref-clean-bibtex-entry-hook'."
(provide 'org-ref-bibtex)
;;; org-ref-bibtex.el ends here
;; Local Variables:
;; byte-compile-warnings: (not docstrings-wide)
;; End:

View File

@@ -1,6 +1,6 @@
;;; org-ref-citation-links.el --- citation links for org-ref -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2021 John Kitchin
;; Copyright (C) 2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords: convenience
@@ -47,11 +47,15 @@
;; natmove like preprocessing is provided with `org-ref-cite-natmove'.
;;
;;; Code:
(require 'org-keys)
(require 'hydra)
(require 'xref)
(eval-when-compile (require 'subr-x))
(defvar bibtex-completion-cache)
(declare-function bibtex-completion-format-citation-cite "bibtex-completion")
(declare-function bibtex-completion-show-entry "bibtex-completion")
(defgroup org-ref-faces nil
"A group for faces in `org-ref'."
:group 'org-ref-faces)
@@ -592,13 +596,13 @@ PATH has the citations in it."
"Get a tooltip for the cite at POSITION."
(let ((key (get-text-property position 'cite-key)))
(when key
(let ((bibtex-completion-bibliography (org-ref-find-bibliography))
(has-pdf (when (bibtex-completion-find-pdf key) bibtex-completion-pdf-symbol))
(has-notes (when (cl-some #'identity
(mapcar (lambda (fn)
(funcall fn key))
bibtex-completion-find-note-functions))
bibtex-completion-notes-symbol)))
(let* ((bibtex-completion-bibliography (org-ref-find-bibliography))
(has-pdf (when (bibtex-completion-find-pdf key) bibtex-completion-pdf-symbol))
(has-notes (when (cl-some #'identity
(mapcar (lambda (fn)
(funcall fn key))
bibtex-completion-find-note-functions))
bibtex-completion-notes-symbol)))
(format "%s%s %s" (or has-pdf "") (or has-notes "")
(bibtex-completion-apa-format-reference key))))))
@@ -1048,21 +1052,17 @@ If not on a key, but on a cite, prompt for key."
(t
(let ((el (org-element-context))
(cp (point))
(org-ref-activate-cite-links t) ;; temporary
data
keys
)
(and
(eq (org-element-type el) 'link)
(assoc (org-element-property :type el) org-ref-cite-types))
(save-excursion
;; We activate just this one link
(org-ref-cite-activate
(org-element-property :begin el)
(org-element-property :end el)
(org-element-property :path el)
nil))
(org-ref-activate-cite-links t)) ;; temporary
(when (and
(eq (org-element-type el) 'link)
(assoc (org-element-property :type el) org-ref-cite-types))
(save-excursion
;; We activate just this one link
(org-ref-cite-activate
(org-element-property :begin el)
(org-element-property :end el)
(org-element-property :path el)
nil)))
;; Now we have to handle some cases.
(cond
;; on a key, return a key
@@ -1423,3 +1423,7 @@ Here is an example use:
(provide 'org-ref-citation-links)
;;; org-ref-citation-links.el ends here
;; Local Variables:
;; byte-compile-warnings: (not docstrings docstrings-wide)
;; End:

View File

@@ -1,4 +1,4 @@
;;; org-ref-compat.el --- Compatibility functions for org-cite
;;; org-ref-compat.el --- Compatibility functions for org-cite -*- lexical-binding: t; -*-
;;; Commentary:
;;
@@ -35,14 +35,14 @@ There is no way to get them all though, there are conflicting
translations with some biblatex and some natbib commands. This
list maps the natbib commands. I have also opted to use the full
names rather than the short names."
:group 'org-ref)
:group 'org-ref
:type '(list (cons string string)))
(defun org-ref-to-org-cite ()
(interactive)
(let ((ref-cites (reverse (org-ref-get-cite-links)))
ref-type
path
type path
beg end)
;; This takes care of the cite links
(cl-loop for rc in ref-cites do

View File

@@ -1,6 +1,6 @@
;;; org-ref-core.el --- citations, cross-references and bibliographies in org-mode -*- lexical-binding: t; -*-
;; Copyright(C) 2014-2021 John Kitchin
;; Copyright(C) 2014-2024 John Kitchin
;; This file is not currently part of GNU Emacs.
@@ -53,6 +53,7 @@
(require 'org-ref-utils)
(require 'org-ref-bibtex)
(require 'org-ref-glossary)
(require 'openalex)
;;* Custom variables
@@ -337,3 +338,7 @@ provide their own version."
(provide 'org-ref-core)
;;; org-ref-core.el ends here
;; Local Variables:
;; byte-compile-warnings: (not docstrings docstrings-wide)
;; End:

View File

@@ -1,6 +1,6 @@
;;; org-ref-export.el --- org-ref-export library -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2021 John Kitchin
;; Copyright (C) 2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords: convenience
@@ -52,6 +52,8 @@
(require 'citeproc)
(defvar org-cite-csl-styles-dir)
(defcustom org-ref-backend-csl-formats
'((html . html)
(latex . latex)
@@ -66,11 +68,14 @@
(defcustom org-ref-cite-internal-links 'auto
"Should be one of
- 'bib-links :: link cites to bibliography entries
- 'no-links :: do not link cites to bibliography entries
- nil or 'auto :: add links based on the style."
:type '(choice bib-links no-links auto nil)
"Should be one of these symbols (quoted)
- bib-links :: link cites to bibliography entries
- no-links :: do not link cites to bibliography entries
- nil or auto :: add links based on the style."
:type '(choice symbol (sexp :tag bib-links)
symbol (sexp :tag no-links)
symbol (sexp :tag auto-links)
symbol (sexp :tag nil))
:group 'org-ref)
@@ -212,17 +217,16 @@ REF is a plist data structure returned from `org-ref-parse-cite-path'."
(suffix . ,suffix)
(locator . ,locator)
(label . ,(when label (org-ref-dealias-label (string-trim label))))
;; TODO: proof of concept and not complete. I did not go through all the
;; types to see what else should be in here.
(suppress-author . ,(not (null (member type
'("citenum"
"citeyear"
"citeyear*"
"citedate"
"citedate*"
"citetitle"
"citetitle*"
"citeurl"))))))))
;; [2024-01-29 Mon] see
;; https://github.com/jkitchin/org-ref/issues/1103#issuecomment-1915028374
;; and related comments at
;; https://github.com/andras-simonyi/citeproc-el/issues/151. It seems I
;; should not be adding this. TODO: proof of concept and not complete. I
;; did not go through all the types to see what else should be in here.
;; (suppress-author . ,(not (null (member type '("citenum" "citeyear"
;; "citeyear*" "citedate" "citedate*" "citetitle" "citetitle*"
;; "citeurl")))))
)))
(declare-function org-ref-find-bibliography "org-ref-core")
@@ -513,9 +517,9 @@ VISIBLE-ONLY BODY-ONLY and INFO."
"Export the buffer to PDF via LaTeX and open.
See `org-export-as' for the meaning of ASYNC SUBTREEP
VISIBLE-ONLY BODY-ONLY and INFO."
(let ((org-export-before-parsing-hook (append
org-export-before-parsing-hook
'(org-ref-csl-preprocess-buffer))))
(let ((org-export-before-parsing-functions (append
org-export-before-parsing-functions
'(org-ref-csl-preprocess-buffer))))
(org-open-file (org-latex-export-to-pdf async subtreep visible-only
body-only info))))
@@ -595,8 +599,8 @@ VISIBLE-ONLY BODY-ONLY and INFO."
(?e "to email" org-ref-export-to-message)
(?w "to docx" org-ref-export-to-docx))))
;; An alternative to this exporter is to use an `org-export-before-parsing-hook'
;; (add-hook 'org-export-before-parsing-hook 'org-ref-csl-preprocess-buffer)
;; An alternative to this exporter is to use an `org-export-before-parsing-functions'
;; (add-hook 'org-export-before-parsing-functions 'org-ref-csl-preprocess-buffer)
(defun org-ref-csl-preprocess-buffer (backend)
"Preprocess the buffer in BACKEND export.
@@ -627,27 +631,27 @@ I am not positive on this though."
(when (and org-ref/citeproc org-ref/bblproc)
(error "You cannot use CSL and BBL at the same time."))
(let ((org-export-before-parsing-hook org-export-before-parsing-hook))
(let ((org-export-before-parsing-functions org-export-before-parsing-functions))
(when org-ref/citeproc
(cl-pushnew 'org-ref-csl-preprocess-buffer org-export-before-parsing-hook))
(cl-pushnew 'org-ref-csl-preprocess-buffer org-export-before-parsing-functions))
(when org-ref/refproc
(cl-pushnew 'org-ref-refproc org-export-before-parsing-hook))
(cl-pushnew 'org-ref-refproc org-export-before-parsing-functions))
(when org-ref/acrossproc
(cl-pushnew 'org-ref-acrossproc org-export-before-parsing-hook))
(cl-pushnew 'org-ref-acrossproc org-export-before-parsing-functions))
(when org-ref/idxproc
(cl-pushnew 'org-ref-idxproc org-export-before-parsing-hook))
(cl-pushnew 'org-ref-idxproc org-export-before-parsing-functions))
(when org-ref/bblproc
(unless (featurep 'org-ref-natbib-bbl-citeproc)
(require 'org-ref-natbib-bbl-citeproc))
(cl-pushnew 'org-ref-bbl-preprocess org-export-before-parsing-hook))
(cl-pushnew 'org-ref-bbl-preprocess org-export-before-parsing-functions))
;; this goes last since it moves cites before they might get replaced.
(when org-ref/natmove
(cl-pushnew 'org-ref-cite-natmove org-export-before-parsing-hook))
(cl-pushnew 'org-ref-cite-natmove org-export-before-parsing-functions))
(org-export-dispatch arg)))

View File

@@ -1,6 +1,6 @@
;;; org-ref-glossary.el --- glossary support in org-ref -*- lexical-binding: t; -*-
;; Copyright (C) 2016-2021 John Kitchin
;; Copyright (C) 2016-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords:
@@ -45,7 +45,7 @@
;; #+name: acronyms
;; | key | abbreviation | full form |
;; |------+--------------+--------------------------------|
;; | mimo | | multiple-input multiple output |
;; | mimo | mimo | multiple-input multiple output |
;; | qos | QoS | quality-of-service |
;; | bb | BB | branch and bound |
;;
@@ -102,7 +102,7 @@ This is not always fast, so we provide a way to disable it."
:group 'org-ref-glossary)
(defvar org-ref-glsentries '()
(defcustom org-ref-glsentries '()
"Variable to hold locations of glsentries load files.")
@@ -152,7 +152,7 @@ changes."
;; We don't have a cache, or an entry in it, so we find it.
;; No cache? we make one
(unless org-ref-glossary-cache
(setq-local org-ref-glossary-cache (make-hash-table)))
(setq-local org-ref-glossary-cache (make-hash-table :test 'equal)))
;; Now we search to get the data
(save-excursion
@@ -171,13 +171,14 @@ changes."
external))))
org-ref-glsentries)
(cdr (assoc external org-ref-glsentries))))))
key value p1 p2)
key value p1 p2 position)
(setq data
(catch 'data
;; look inside first for latex-headers
(goto-char (point-min))
(when (re-search-forward
(format "\\newglossaryentry{%s}" entry) nil t)
(setq position (match-beginning 0))
(re-search-forward "{")
(save-excursion
(backward-char)
@@ -206,7 +207,8 @@ changes."
(setq data (append data
(list :label entry)
(list (intern (format ":%s" key)))
(list value))))
(list value)
(list :position position))))
(throw 'data data))
;; check for a glossary table
@@ -218,11 +220,15 @@ changes."
(lambda (el)
(when (string= "glossary" (org-element-property :name el))
(goto-char (org-element-property :contents-begin el))
(setq position (point))
(throw 'found
(nthcdr 2 (org-babel-read-table)))))))))
(result (assoc entry entries)))
(when result
(throw 'data (list :label entry :name (cl-second result) :description (cl-third result)))))
(throw 'data (list :label entry
:name (cl-second result)
:description (cl-third result)
:position position))))
;; then external
(when (and glsentries
@@ -231,7 +237,7 @@ changes."
(with-current-buffer (find-file-noselect glsentries)
(goto-char (point-min))
(when (re-search-forward
(format "\\newglossaryentry{%s}" entry) nil t)
(format "\\newglossaryentry{%s}" entry) nil t)
(re-search-forward "{")
(save-excursion
(backward-char)
@@ -255,65 +261,57 @@ changes."
(setq data (append data
(list :label entry)
(list (intern (format ":%s" key)))
(list value))))
(list value)
(list :position nil))))
(throw 'data data))))))
(puthash entry data org-ref-glossary-cache)
data))))
;;;###autoload
(defun org-ref-add-glossary-entry (label name description)
"Insert a new glossary entry.
LABEL is how you refer to it with links.
NAME is the name of the entry to be defined.
DESCRIPTION is the definition of the entry.
Entry gets added after the last #+latex_header line.
This is not a preferred way to add entries. It is preferred to
manually add them to the glossary table."
(interactive "sLabel: \nsName: \nsDescription: ")
(save-excursion
(goto-char (point-max))
;; get to the last latex_header line
(re-search-backward "#\\+latex_header" nil t)
(forward-line)
(when (not (looking-at "^$"))
(beginning-of-line)
(insert "\n")
(forward-line -1))
(insert (format "#+latex_header_extra: \\newglossaryentry{%s}{name={%s},description={%s}}\n"
label name description))))
(defun org-ref-glossary-face-fn (label)
"Return a face for a glossary link."
(if org-ref-activate-glossary-links
(save-match-data
(cond
((or-parse-glossary-entry label)
'org-ref-glossary-face)
(t
'font-lock-warning-face)))
'org-ref-glossary-face))
;;** Glossary links
(defun or-activate-glossary (start end path bracketp)
"Activate function for a glossary link.
set data on text with properties
Set face property, and help-echo."
(let ((data (or (or-parse-glossary-entry path)
(or-parse-acronym-entry path))))
(add-text-properties
start end
(list 'or-glossary data
'face (if data
'org-ref-glossary-face
'font-lock-warning-face)))))
(defface org-ref-glossary-face
`((t (:inherit org-link :foreground "Mediumpurple3")))
"Face for glossary links.")
(defun or-follow-glossary (entry)
"Goto beginning of the glossary ENTRY."
(org-mark-ring-push)
(cond
;; Try finding in the table
((progn (goto-char (point-min))
(and (re-search-forward "#\\+name: glossary" nil t)
(re-search-forward entry nil t)))
nil)
(goto-char (plist-get (get-text-property (point) 'or-glossary) :position)))
((progn (goto-char (point-min)) (re-search-forward (format "\\newglossaryentry{%s}" entry) nil t))
(goto-char (match-beginning 0)))
(t
(message "no entry found for %s" entry))))
(defun or-glossary-tooltip (_window buffer position)
"Return tooltip for the glossary entry.
The entry is in WINDOW and OBJECT at POSITION.
Used in fontification."
(with-current-buffer buffer
(let* ((data (get-text-property position 'or-glossary))
(name (or (plist-get data :name)
(plist-get data :abbrv)))
(description (or (plist-get data :description)
(plist-get data :full))))
(format
"%s: %s"
name
(with-temp-buffer
(insert (concat description "."))
(fill-paragraph)
(buffer-string))))))
(defvar org-ref-glossary-gls-commands
@@ -330,7 +328,7 @@ manually add them to the glossary table."
(dolist (command org-ref-glossary-gls-commands)
(org-link-set-parameters (cl-first command)
:follow #'or-follow-glossary
:face 'org-ref-glossary-face-fn
:activate-func #'or-activate-glossary
:help-echo 'or-glossary-tooltip
:export (lambda (path _ format)
(cond
@@ -342,6 +340,7 @@ manually add them to the glossary table."
(org-link-set-parameters "glslink"
:follow #'or-follow-glossary
:activate-func #'or-activate-glossary
:face 'org-ref-glossary-face-fn
:help-echo 'or-glossary-tooltip
:export (lambda (path desc format)
@@ -351,33 +350,8 @@ manually add them to the glossary table."
(t
(format "%s" path)))))
;;** Tooltips on glossary entries
(defface org-ref-glossary-face
`((t (:inherit org-link :foreground "Mediumpurple3")))
"Face for glossary links.")
(defun or-glossary-tooltip (_window _object position)
"Return tooltip for the glossary entry.
The entry is in WINDOW and OBJECT at POSITION.
Used in fontification."
(save-excursion
(goto-char position)
(let* ((label (org-element-property :path (org-element-context)))
(data (or (or-parse-glossary-entry label)
(or-parse-acronym-entry label)))
(name (or (plist-get data :name)
(plist-get data :abbrv)))
(description (or (plist-get data :description)
(plist-get data :full))))
(format
"%s: %s"
name
(with-temp-buffer
(insert (concat description "."))
(fill-paragraph)
(buffer-string))))))
;; ** printglossaries links
;; There is a printglossary command in LaTeX, but I am not supporting it for now.
@@ -440,26 +414,6 @@ This is intended to be run in `org-export-before-parsing-hook'."
;;* Acronyms
;;;###autoload
(defun org-ref-add-acronym-entry (label abbrv full)
"Add an acronym entry with LABEL.
ABBRV is the abbreviated form.
FULL is the expanded acronym.
This is not the preferred way to add acronyms, you should add
them manually to the acronyms table."
(interactive "sLabel: \nsAcronym: \nsFull name: ")
(save-excursion
(re-search-backward "#\\+latex_header" nil t)
(forward-line)
(when (not (looking-at "^$"))
(beginning-of-line)
(insert "\n")
(forward-line -1))
(insert (format "#+latex_header_extra: \\newacronym{%s}{%s}{%s}\n"
label abbrv full))))
(defun or-parse-acronym-entry (label)
"Parse an acronym entry LABEL to a plist.
Returns (:abbrv abbrv :full full :label label)
@@ -470,7 +424,7 @@ The plist maps to \newacronym{<label>}{<abbrv>}{<full>}"
;; We don't have a cache, or an label in it, so we find it.
;; No cache? we make one
(unless org-ref-acronym-cache
(setq-local org-ref-acronym-cache (make-hash-table)))
(setq-local org-ref-acronym-cache (make-hash-table :test 'equal )))
;; Now search for the data
(save-excursion
@@ -539,10 +493,24 @@ The plist maps to \newacronym{<label>}{<abbrv>}{<full>}"
(defun org-ref-glossary-invalidate-caches ()
"Function to invalidate the caches."
(interactive)
(setq-local org-ref-acronym-cache (make-hash-table))
(setq-local org-ref-glossary-cache (make-hash-table)))
(setq-local org-ref-acronym-cache (make-hash-table :test 'equal))
(setq-local org-ref-glossary-cache (make-hash-table :test 'equal)))
;;** Acronym links
(defun or-activate-acronym (start end path bracketp)
"Activate function for an acronym link.
set data on text with properties
Set face property, and help-echo."
(let ((data (or-parse-acronym-entry path)))
(add-text-properties
start end
(list 'or-glossary data
'face (if data
'org-ref-acronym-face
'font-lock-warning-face)))))
(defun or-follow-acronym (label)
"Go to the definition of the acronym LABEL."
(org-mark-ring-push)
@@ -560,6 +528,30 @@ The plist maps to \newacronym{<label>}{<abbrv>}{<full>}"
(message "no entry found for %s" label))))
;;** Tooltips on acronyms
(defface org-ref-acronym-face
`((t (:inherit org-link :foreground "Darkorange2")))
"Face for acronym links.")
(defun or-acronym-tooltip (_window buffer position)
"Return tooltip for the acronym entry.
The entry is in WINDOW and OBJECT at POSITION.
Used in fontification.
WINDOW and OBJECT are ignored."
(with-current-buffer buffer
(save-excursion
(goto-char position)
(let* ((acronym-data (get-text-property position 'or-glossary))
(abbrv (plist-get acronym-data :abbrv))
(full (plist-get acronym-data :full)))
(if acronym-data
(format
"%s: %s"
abbrv full)
(format "This is not defined in this file."))))))
(defvar org-ref-acronym-types
'(("acrshort" "The acronym for label")
("acrshortpl" "The acronym for label in plural")
@@ -587,8 +579,8 @@ The plist maps to \newacronym{<label>}{<abbrv>}{<full>}"
(cl-dolist (mapping org-ref-acronym-types)
(org-link-set-parameters (cl-first mapping)
:follow #'or-follow-acronym
:face 'org-ref-acronym-face-fn
:help-echo 'or-acronym-tooltip
:activate-func #'or-activate-acronym
:help-echo #'or-acronym-tooltip
:export (lambda (path _ format)
(cond
((memq format '(latex beamer))
@@ -597,40 +589,6 @@ The plist maps to \newacronym{<label>}{<abbrv>}{<full>}"
(format "%s" (upcase path)))))))
;;** Tooltips on acronyms
(defface org-ref-acronym-face
`((t (:inherit org-link :foreground "Darkorange2")))
"Face for acronym links.")
(defun org-ref-acronym-face-fn (label)
"Return a face for an acronym link."
(if org-ref-activate-glossary-links
(save-match-data
(cond
((or-parse-acronym-entry label)
'org-ref-acronym-face)
(t
'font-lock-warning-face)))
'org-ref-acronym-face))
(defun or-acronym-tooltip (_window _object position)
"Return tooltip for the acronym entry.
The entry is in WINDOW and OBJECT at POSITION.
Used in fontification.
WINDOW and OBJECT are ignored."
(save-excursion
(goto-char position)
(let* ((label (org-element-property :path (org-element-context)))
(acronym-data (or-parse-acronym-entry label))
(abbrv (plist-get acronym-data :abbrv))
(full (plist-get acronym-data :full)))
(if acronym-data
(format
"%s: %s"
abbrv full)
(format "%s is not defined in this file." label)))))
;; ** Exporting with an acronym table

View File

@@ -1,6 +1,6 @@
;;; org-ref-helm.el --- org-ref interface to helm-bibtex -*- lexical-binding: t; -*-
;; Copyright(C) 2014-2022 John Kitchin
;; Copyright(C) 2014-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; URL: https://github.com/jkitchin/org-ref

View File

@@ -1,6 +1,6 @@
;;; org-ref-isbn.el --- utilities for generating bibtex entries from an ISBN -*- lexical-binding: t; -*-
;; Copyright (C) 2015 John Kitchin
;; Copyright (C) 2015-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords: convenience
@@ -25,7 +25,7 @@
;;; Code:
(require 'f)
(require 'org)
(require 'org-ref-core)
(defvar url-http-end-of-headers)

View File

@@ -1,6 +1,6 @@
;;; org-ref-ivy.el --- org-ref with ivy completion -*- lexical-binding: t; -*-
;; Copyright (C) 2016-2021 John Kitchin
;; Copyright (C) 2016-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; URL: https://github.com/jkitchin/org-ref

View File

@@ -1,6 +1,6 @@
;;; org-ref-label-link.el --- -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2021 John Kitchin
;; Copyright (C) 2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords: convenience

View File

@@ -1,6 +1,6 @@
;;; org-ref-latex.el --- org-ref functionality for LaTeX files -*- lexical-binding: t; -*-
;; Copyright (C) 2015-2021 John Kitchin
;; Copyright (C) 2015-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords: languages
@@ -25,10 +25,34 @@
(require 'org-ref-citation-links)
(require 'bibtex-completion)
(require 'tex-mode)
(defvar latex-mode-map)
(defvar org-ref-cite-types)
(defcustom orl-cite-keymap
(let ((map (copy-keymap latex-mode-map)))
(define-key map (kbd "S-<left>") #'orl-cite-shift-left)
(define-key map (kbd "S-<right>") #'orl-cite-shift-right)
(define-key map (kbd "S-<up>") #'orl-sort-cite-keys)
(define-key map (kbd "S-<down>") (lambda () (interactive) (orl-sort-cite-keys t)))
(define-key map (kbd "<tab>") #'org-ref-latex-insert-citation)
(define-key map [mouse-1] (lambda ()
(interactive)
(let ((bibtex-completion-bibliography (org-ref-latex-get-bibliography)))
(bibtex-completion-show-entry (list (org-ref-latex-key-at-point)))
(bibtex-beginning-of-entry))))
map)
"Key map for cite keys."
:group 'org-ref-latex
:type '(restricted-sexp
:match-alternatives
((lambda (x)
(or (keymapp x) ; Can be a keymap var.
(and (symbolp x)
(boundp x)
(keymapp (symbol-value x))))))))
(defvar org-ref-latex-cite-re
(concat "\\\\\\(?1:" (mapconcat
@@ -37,15 +61,15 @@
(mapcar 'car org-ref-cite-types)
"\\|")
"\\)"
"\\(?2:\\[[^]]*\\]\\)?" ; optional []
"\\(?3:\\[[^]]*\\]\\)?" ; optional []
"\\(?2:\\[[^]]*\\]\\)?" ; optional []
"\\(?3:\\[[^]]*\\]\\)?" ; optional []
"{\\(?4:[^}]*\\)}") ; group 4 contains the keys
"Regexp for LaTeX citations. \\citetype[opti{o}nal][optiona{l}]{some,keys}.
The clickable part are the keys.")
(defun org-ref-latex-get-bibliography ()
"Find bibliographies in the tex file"
"Find bibliographies in the tex file."
(save-excursion
(let ((bibliography '()))
(goto-char (point-min))
@@ -65,6 +89,23 @@ The clickable part are the keys.")
"Font-lock function to make cites in LaTeX documents clickable."
(while (re-search-forward org-ref-latex-cite-re limit t)
(setq font-lock-extra-managed-props (delq 'help-echo font-lock-extra-managed-props))
;; save data on cite. This is useful later for modifying cites, clicking, etc.
(add-text-properties (match-beginning 0) (match-end 0)
`(org-ref-latex-cite (
:cite-begin ,(match-beginning 0)
:cite-end ,(match-end 0)
:cite-key-begin ,(+ 1 (match-beginning 4))
:cite-key-end ,(- (match-end 4) 1)
:cite-type ,(match-string-no-properties 1)
:optional-1 ,(match-string-no-properties 2)
:optional-2 ,(match-string-no-properties 3)
:keys ,(mapcar
#'s-trim
(s-split
","
(match-string-no-properties 4))))))
(goto-char (match-beginning 0))
(let ((end (match-end 0)))
(cl-loop for key in (mapcar #'s-trim (split-string (match-string-no-properties 4) ","))
@@ -75,19 +116,14 @@ The clickable part are the keys.")
(add-text-properties
(match-beginning 0)
(match-end 0)
`(mouse-face highlight
local-map ,(let ((map (copy-keymap latex-mode-map)))
(define-key map [mouse-1]
`(lambda ()
(interactive)
(let ((bibtex-completion-bibliography (org-ref-latex-get-bibliography)))
(bibtex-completion-show-entry (list ,key))
(bibtex-beginning-of-entry))))
map)
help-echo ,(let* ((bibtex-completion-bibliography (org-ref-latex-get-bibliography)))
(condition-case nil
(bibtex-completion-apa-format-reference key)
(error (display-warning :warning (format "Key %s missing." key)))))))))
`(
org-ref-cite-key ,key
mouse-face highlight
local-map ,orl-cite-keymap
help-echo ,(let* ((bibtex-completion-bibliography (org-ref-latex-get-bibliography)))
(condition-case nil
(bibtex-completion-apa-format-reference key)
(error (display-warning :warning (format "Key %s missing." key)))))))))
(goto-char end))))
@@ -98,6 +134,142 @@ The clickable part are the keys.")
'((org-ref-next-latex-cite 0 font-lock-constant-face))))
(add-hook 'LaTeX-mode-hook 'org-ref-latex-cite-on)
(add-hook 'LaTeX-mode-hook 'org-ref-latex-cite-on)
;; * Insert cite link
(defun org-ref-latex-on-citation-p ()
"Return non-nil if on a citation."
(get-text-property (point) 'org-ref-latex-cite))
(defun org-ref-latex-key-at-point ()
"Return key at point if there is one."
(interactive)
(get-text-property (point) 'org-ref-cite-key))
(defun orl-insert-key (key)
(cond
;; on a key
((get-text-property (point) 'org-ref-cite-key)
(forward-sexp)
(insert (format ",%s" key)))
;; on the leading \
((and (get-text-property (point) 'org-ref-latex-cite)
(looking-at "\\\\"))
(search-forward "{")
(insert (format "%s," key)))
;; on {
((and (get-text-property (point) 'org-ref-latex-cite)
(looking-at "{"))
(forward-char)
(insert (format "%s," key)))
;; on }
((and (get-text-property (point) 'org-ref-latex-cite)
(looking-at "}"))
(insert (format ",%s" key)))
;; on citetype
((and (get-text-property (point) 'org-ref-latex-cite)
(get-text-property (point) 'org-ref-latex-cite-type))
(search-forward "{")
(insert (format "%s," key)))
;; everything else
(t
(insert (format "\\cite{%s}" key)))))
(defun org-ref-latex-insert-citation ()
"Insert a citation key with completion.
Should DWIM inserting into existing or new citations."
(interactive)
;; This initializes bibtex if the variable is not defined.
(unless bibtex-completion-display-formats-internal
(bibtex-completion-init))
(let* ((bibtex-completion-bibliography (org-ref-latex-get-bibliography))
(candidates (bibtex-completion-candidates)))
(ivy-read "org-ref-ivy BibTeX entries: " candidates
:preselect (ivy-thing-at-point)
:action '(1
("o" (lambda (candidate)
(orl-insert-key (cdr (assoc "=key=" (cdr candidate)))))
"insert")))))
(defun orl-swap-citation (direction)
(let* ((key (org-ref-latex-key-at-point))
(data (get-text-property (point) 'org-ref-latex-cite))
(keys (plist-get data :keys))
(i (seq-position keys key #'string=))
cite-string)
(if (> direction 0)
(org-ref-swap-list-elements i (min (+ i 1) (- (length keys) 1)) keys)
(org-ref-swap-list-elements i (max (- i 1) 0) keys))
(setq data (plist-put data :keys keys))
;; now render it
(setq cite-string (concat (format "\\%s" (plist-get data :cite-type))
(or (plist-get data :optional-1) "")
(or (plist-get data :optional-2) "")
(format "{%s}" (s-join "," (plist-get data :keys)))))
(cl--set-buffer-substring (plist-get data :cite-begin)
(plist-get data :cite-end)
cite-string)
(search-forward key)
(goto-char (match-beginning 0))))
(defun orl-cite-shift-left ()
"Shift cite key at point to the left."
(interactive)
(orl-swap-citation -1))
(defun orl-cite-shift-right ()
"Shift cite-key at point to the right."
(interactive)
(orl-swap-citation +1))
(defun orl-sort-cite-keys (&optional descending)
"Sort keys in ascending order by year.
With prefix arg DESCENDING, sort in descending order."
(interactive "P")
(let* ((data (get-text-property (point) 'org-ref-latex-cite))
(keys (plist-get data :keys))
cite-string)
(setq data (plist-put data :keys
(cl-loop for entry in
(cl-sort (cl-loop for key in keys collect
(list :key key :year (bibtex-completion-get-value
"year"
(bibtex-completion-get-entry
key))))
(if descending
(lambda (x y)
(> (string-to-number (plist-get x :year))
(string-to-number (plist-get y :year))))
(lambda (x y)
(< (string-to-number (plist-get x :year))
(string-to-number (plist-get y :year))))))
collect
(plist-get entry :key))))
;; now render it
(setq cite-string (concat (format "\\%s" (plist-get data :cite-type))
(or (plist-get data :optional-1) "")
(or (plist-get data :optional-2) "")
(format "{%s}" (s-join "," (plist-get data :keys)))))
(cl--set-buffer-substring (plist-get data :cite-begin)
(plist-get data :cite-end)
cite-string)
(search-forward (car (plist-get data :keys)))
(goto-char (match-beginning 0))))
(provide 'org-ref-latex)

View File

@@ -1,6 +1,6 @@
;;; org-ref-misc-links.el --- Miscellaneous links -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2021 John Kitchin
;; Copyright (C) 2021-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords: convenience

View File

@@ -1,6 +1,6 @@
;;; org-ref-natbib-bbl-citeproc.el --- A bibtex + natbib BBL-based citeproc -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2021 John Kitchin
;; Copyright (C) 2021-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords:
@@ -101,7 +101,7 @@ cover any math (yet)."
(setq p4 (point)
p3 (- (point) 1))
(setq ss (string-trim (buffer-substring p2 p3)))
(setf (buffer-substring p1 p4) (format fmt ss))))
(cl--set-buffer-substring p1 p4 (format fmt ss))))
;; {text} for protecting case. This is tricky to do reliably. I try to check
;; if this is not part of a command, and skip it if so. This leaves
@@ -414,8 +414,8 @@ Argument BACKEND is the export format."
replacement)
p2 (+ 1 (org-element-property :end link))))))
(setf (buffer-substring p1 p2)
(concat replacement (make-string (org-element-property :post-blank link) ? )))))
(cl--set-buffer-substring p1 p2
(concat replacement (make-string (org-element-property :post-blank link) ? )))))
(defun org-ref-bbl-replace-bibliography (bib-link bibdata NATBIB-OPTIONS backend)
@@ -469,7 +469,7 @@ You need a LaTeX file and a bbl file for it. This hook generates
those, then gets the data, replaces the citations and the
bibliography.
"
(let* ((org-export-before-parsing-hook nil)
(let* ((org-export-before-parsing-functions nil)
(tex-file (org-latex-export-to-latex))
(bbl-file (concat (file-name-sans-extension tex-file) ".bbl"))
natbib-options bibdata org-ref-natmove

View File

@@ -1,6 +1,6 @@
;;; org-ref-pdf.el --- Drag-n-drop PDF onto bibtex files -*- lexical-binding: t; -*-
;; Copyright (C) 2015-2021 John Kitchin
;; Copyright (C) 2015-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords:

View File

@@ -1,4 +1,4 @@
(define-package "org-ref" "3.0.0" "citations, cross-references and bibliographies in org-mode"
(define-package "org-ref" "3.1.0" "citations, cross-references and bibliographies in org-mode"
'((dash "0")
(s "0")
(f "0")
@@ -6,7 +6,7 @@
(htmlize "0")
(parsebib "0")
(bibtex-completion "0")
(emacs "26")))
(emacs "29")))
;; Local Variables:

View File

@@ -1,4 +1,4 @@
(define-package "org-ref" "20231101.2355" "citations, cross-references and bibliographies in org-mode"
(define-package "org-ref" "20250301.1918" "citations, cross-references and bibliographies in org-mode"
'((org "9.4")
(dash "0")
(s "0")
@@ -9,8 +9,9 @@
(parsebib "0")
(bibtex-completion "0")
(citeproc "0")
(ox-pandoc "0"))
:commit "195b8d3209aff956ecdd755422700e8517a34d11" :authors
(ox-pandoc "0")
(request "0"))
:commit "edbb80863ef63ef52ef04fce3239e063843f8d30" :authors
'(("John Kitchin" . "jkitchin@andrew.cmu.edu"))
:maintainers
'(("John Kitchin" . "jkitchin@andrew.cmu.edu"))

View File

@@ -1,4 +1,4 @@
;;; org-ref-publish.el --- org-publish with org-ref
;;; org-ref-publish.el --- org-publish with org-ref -*- lexical-binding: t; -*-
;;; Commentary:
;; First draft proposed by madhu 230826 (Madhu <enometh@meer.net>)

View File

@@ -1,6 +1,6 @@
;;; org-ref-pubmed.el --- Links and functions for Pubmed and NIH databases -*- lexical-binding: t; -*-
;; Copyright (C) 2015-2021 John Kitchin
;; Copyright (C) 2015-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords: convenience

View File

@@ -1,6 +1,6 @@
;;; org-ref-ref-links.el --- cross-reference links for org-ref -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2021 John Kitchin
;; Copyright (C) 2021-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords: convenience
@@ -162,8 +162,7 @@ font-lock."
(rx (string-join org-ref-ref-label-regexps "\\|"))
(labels '())
oe ;; org-element
context
data)
context)
(save-excursion
(org-with-wide-buffer
(goto-char (point-min))
@@ -221,7 +220,7 @@ font-lock."
(when (string= label (match-string-no-properties 1))
(save-match-data (org-mark-ring-push))
(goto-char (match-beginning 1))
(org-show-entry)
(org-fold-show-entry)
(substitute-command-keys
"Go back with (org-mark-ring-goto) \`\\[org-mark-ring-goto]'.")
(throw 'found t)))))))
@@ -347,8 +346,7 @@ This is meant to be used with `apply-partially' in the link definitions."
;; in a latex environment
((equal (org-element-type object) 'latex-environment)
(let ((value (org-element-property :value object))
label)
(let ((value (org-element-property :value object)))
(when (string-match "\\\\label{\\(?1:[+a-zA-Z0-9:\\._-]*\\)}" value)
(match-string-no-properties 1 value))))

View File

@@ -1,6 +1,6 @@
;;; org-ref-sci-id.el --- org-mode links for scientific IDs -*- lexical-binding: t; -*-
;; Copyright (C) 2015 John Kitchin
;; Copyright (C) 2015-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords:

View File

@@ -1,6 +1,6 @@
;;; org-ref-scifinder.el --- Emacs interface to SciFinder
;;; org-ref-scifinder.el --- Emacs interface to SciFinder -*- lexical-binding: t; -*-
;; Copyright (C) 2015 John Kitchin
;; Copyright (C) 2015-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords:

View File

@@ -1,6 +1,6 @@
;;; org-ref-scopus.el --- Emacs-lisp interface to the Scopus API -*- lexical-binding: t; -*-
;; Copyright (C) 2015 John Kitchin
;; Copyright (C) 2015-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords:

View File

@@ -1,6 +1,6 @@
;;; org-ref-url-utils.el --- Utility functions to scrape DOIs from urls -*- lexical-binding: t; -*-
;; Copyright (C) 2015-2021 John Kitchin
;; Copyright (C) 2015-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords:

View File

@@ -1,6 +1,6 @@
;;; org-ref-utils.el --- Utility functions for org-ref -*- lexical-binding: t; -*-
;; Copyright (C) 2016-2021 John Kitchin
;; Copyright (C) 2016-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords:
@@ -55,9 +55,11 @@ Copies the string to the clipboard."
(setq org-version (with-temp-buffer
(insert-file-contents org-ref-el)
(goto-char (point-min))
(re-search-forward ";; Version:")
(s-trim (buffer-substring (point)
(line-end-position)))))
(if
(re-search-forward ";; Version:" nil t)
(s-trim (buffer-substring (point)
(line-end-position)))
org-ref-dir)))
(setq git-commit
;; If in git, get current commit
@@ -128,6 +130,12 @@ org-ref installed in [[${org-ref-location}]].
- org-ref-insert-ref-function :: ${org-ref-insert-ref-function}
- org-ref-cite-onclick-function :: ${org-ref-cite-onclick-function}
* bibtex-completion setup
- bibtex-completion-bibliography :: ${bibtex-completion-bibliography}
- bibtex-completion-library-path :: ${bibtex-completion-library-path}
- bibtex-completion-notes-path :: ${bibtex-completion-notes-path}
* org-ref libraries
** org-ref-helm (loaded: ${org-ref-helm-p})
@@ -175,7 +183,11 @@ You set =pdftotext-executable= to ${pdftotext-executable} (exists: ${pdftotext-e
("org-ref-insert-cite-function" . ,org-ref-insert-cite-function)
("org-ref-insert-label-function" . ,org-ref-insert-label-function)
("org-ref-insert-ref-function" . ,org-ref-insert-ref-function)
("org-ref-cite-onclick-function" . ,org-ref-cite-onclick-function)))))
("org-ref-cite-onclick-function" . ,org-ref-cite-onclick-function)
("bibtex-completion-bibliography" . ,bibtex-completion-bibliography)
("bibtex-completion-library-path" . ,bibtex-completion-library-path)
("bibtex-completion-notes-path" . ,bibtex-completion-notes-path)))))
(defun org-ref-get-bibtex-entry-citation (key)
@@ -263,7 +275,10 @@ Jabref, Mendeley and Zotero. See `bibtex-completion-find-pdf'."
(pdf-file (bibtex-completion-find-pdf key t)))
(pcase (length pdf-file)
(0
(message "no pdf found for %s" key))
(message "no pdf found for %s" key)
(save-window-excursion
(org-ref-open-citation-at-point)
(doi-utils-get-bibtex-entry-pdf)))
(1
(funcall bibtex-completion-pdf-open-function (car pdf-file)))
(_
@@ -291,12 +306,12 @@ in a directory. Optional PREFIX argument toggles between
(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))
)
(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))))))
@@ -591,7 +606,7 @@ if FORCE is non-nil reparse the buffer no matter what."
(cl-loop for ref in (plist-get (org-ref-parse-cite-path (plist-get plist :path)) :references)
do
(when (not (member (plist-get ref :key) bibtex-keys))
(goto-char (plist-get plist :begin))
(goto-char (org-element-property :begin link))
(re-search-forward (plist-get ref :key))
(push (cons (plist-get ref :key) (point-marker)) bad-citations)))))))
;; add with-affiliates to get cites in caption
@@ -615,7 +630,7 @@ if FORCE is non-nil reparse the buffer no matter what."
(cl-loop for label in (split-string (plist-get plist :path) ",")
do
(unless (-contains? labels label)
(goto-char (plist-get plist :begin))
(goto-char (org-element-property :begin link))
(add-to-list
'bad-refs
(cons label (point-marker)))))))))
@@ -1277,3 +1292,7 @@ which will CLOBBER the file."
(provide 'org-ref-utils)
;;; org-ref-utils.el ends here
;; Local Variables:
;; byte-compile-warnings: (not docstrings-wide)
;; End:

View File

@@ -1,4 +1,4 @@
;;; org-ref-worldcat.el --- Worldcat library
;;; org-ref-worldcat.el --- Worldcat library -*- lexical-binding: t; -*-
;;; Commentary:
;; Provides a function to query world cat

View File

@@ -1,6 +1,6 @@
;;; org-ref-wos.el --- Web of Science functions -*- lexical-binding: t; -*-
;; Copyright (C) 2015 John Kitchin
;; Copyright (C) 2015-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; Keywords:

View File

@@ -1,12 +1,12 @@
;;; org-ref.el --- citations, cross-references and bibliographies in org-mode -*- lexical-binding: t; -*-
;; Copyright(C) 2014-2021 John Kitchin
;; Copyright(C) 2014-2024 John Kitchin
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
;; URL: https://github.com/jkitchin/org-ref
;; Version: 3.0
;; Version: 3.1
;; Keywords: org-mode, cite, ref, label
;; Package-Requires: ((org "9.4") (dash "0") (s "0") (f "0") (htmlize "0") (hydra "0") (avy "0") (parsebib "0") (bibtex-completion "0") (citeproc "0") (ox-pandoc "0"))
;; Package-Requires: ((org "9.4") (dash "0") (s "0") (f "0") (htmlize "0") (hydra "0") (avy "0") (parsebib "0") (bibtex-completion "0") (citeproc "0") (ox-pandoc "0") (request "0"))
;; This file is not currently part of GNU Emacs.
;; This program is free software; you can redistribute it and/or

View File

@@ -1,4 +1,4 @@
;;; x2bib.el --- Bibliography conversion to Bibtex
;;; x2bib.el --- Bibliography conversion to Bibtex -*- lexical-binding: t; -*-
;;; Header:
@@ -41,7 +41,7 @@
;;; Code:
(require 'bibtex)
(require 'org-ref-core)
;;* RIS to bibtex
@@ -74,7 +74,7 @@ and convert it to bib format in place."
(shell-command-on-region (region-beginning) (region-end)
"ris2xml 2> /dev/null | xml2bib -w 2> /dev/null" nil
t)
nil))))
nil))))
;; make some lines into comments.
(when result
(setq result (replace-regexp-in-string
@@ -136,7 +136,7 @@ Display output if VERBOSE is non-nil."
"Map over bibtex entries and clean them."
(interactive)
(bibtex-map-entries
(lambda (a b c)
(lambda (_ _ _)
(ignore-errors
(org-ref-clean-bibtex-entry)))))