From 30474307396e84cd8be97bacf91026ead911e898 Mon Sep 17 00:00:00 2001 From: Bruce D'Arcus Date: Wed, 27 Oct 2021 17:33:04 -0400 Subject: [PATCH] feat(biblio): add org-cite, citeproc --- init.example.el | 1 + modules/tools/biblio/config.el | 52 ++++++++++++++++++++++++++++---- modules/tools/biblio/packages.el | 2 ++ 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/init.example.el b/init.example.el index 4d42f7fcf..dc4e6ea9a 100644 --- a/init.example.el +++ b/init.example.el @@ -85,6 +85,7 @@ :tools ;;ansible + ;;biblio ; Writes a PhD for you (citation needed) ;;debugger ; FIXME stepping through code, to help you add bugs ;;direnv ;;docker diff --git a/modules/tools/biblio/config.el b/modules/tools/biblio/config.el index 46fef46e9..6d0cd390f 100644 --- a/modules/tools/biblio/config.el +++ b/modules/tools/biblio/config.el @@ -1,11 +1,12 @@ ;;; tools/biblio/config.el -*- lexical-binding: t; -*- (use-package! bibtex-completion + :when (or (featurep! :completion ivy) + (featurep! :completion helm)) :defer t :config (setq bibtex-completion-additional-search-fields '(keywords) - bibtex-completion-pdf-field "file"));; This tell bibtex-completion to look at the File field of the bibtex to figure out which pdf to open - + bibtex-completion-pdf-field "file"));; This tells bibtex-completion to look at the File field of the bibtex to figure out which pdf to open (use-package! ivy-bibtex :when (featurep! :completion ivy) @@ -14,7 +15,46 @@ (add-to-list 'ivy-re-builders-alist '(ivy-bibtex . ivy--regex-plus))) -(use-package! citar - :when (featurep! :completion vertico) - :after embark - :defer t) +;;; Org-Cite configuration + +(use-package! oc + :after org + :config + (map! :map org-mode-map + :localleader + :desc "Insert citation" "@" #'org-cite-insert) + (setq org-cite-global-bibliography + (let ((paths + (cond + ((boundp 'citar-bibliography) citar-bibliography) + ((boundp 'bibtex-completion-bibliography) bibtex-completion-bibliography)))) + ;; Always return bibliography paths as list for org-cite. + (if (stringp paths) (list paths) paths)) + ;; setup export processor; default csl/citeproc-el, with biblatex for + ;; latex + org-cite-export-processors + '((latex biblatex) + (t csl)) + org-cite-insert-processor 'citar + org-cite-follow-processor 'citar + org-cite-activate-processor 'citar + org-support-shift-select t)) + + + ;;; Org-cite processors +(use-package! oc-biblatex + :after oc) + +(use-package! oc-csl + :after oc) + +(use-package! oc-natbib + :after oc) + +;;;; Third-party + +(use-package! citar-org + :when (featurep! :lang org +roam2) + :config + ;; Include property drawer metadata for 'org-roam' v2. + (setq citar-org-note-include '(org-id org-roam-ref))) diff --git a/modules/tools/biblio/packages.el b/modules/tools/biblio/packages.el index d9a2adc8c..d1ce8be55 100644 --- a/modules/tools/biblio/packages.el +++ b/modules/tools/biblio/packages.el @@ -8,3 +8,5 @@ (package! helm-bibtex :pin "b85662081de98077f13f1a9fac03764702325d28")) (when (featurep! :completion vertico) (package! citar :pin "fd33f5c4f7981036a969b5ca8aaf42380848ab32")) + +(package! citeproc :pin "0857973409e3ef2ef0238714f2ef7ff724230d1c")