From d9f9cab6d3a69887a6219253eedf1ca837228333 Mon Sep 17 00:00:00 2001 From: TEC Date: Sun, 7 Nov 2021 03:42:55 +0800 Subject: [PATCH] Update org-cite package setup --- config.org | 74 ++++++++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/config.org b/config.org index c687093..aeaf9a7 100644 --- a/config.org +++ b/config.org @@ -5450,52 +5450,39 @@ There's also the new =org-cite= though. It would be nice to try that out. To improve =org-cite=. #+begin_src emacs-lisp :noweb-ref none :tangle packages.el -(package! bibtex-actions :pin "8130de52d9bf246d56bda0299ffea08108f0463b") -(package! citeproc :pin "91d7630de1ec61ff5d5e62c27d820207ec5bb1c6") -(package! bibtex-completion :pin "bb47f355b0da8518aa3fb516019120c14c8747c9") -(package! org-cite-csl-activate :recipe (:host github :repo "andras-simonyi/org-cite-csl-activate") :pin "032e765a4cf634fc56abcd18488510d3d5b1ee09") +(package! citar :pin "a6926650114a8091f98bff8c7fd00add82043190") +(package! citeproc :pin "38e70c0a94eeefe86ddefc38dfa8ab2311008774") +(package! org-cite-csl-activate :recipe (:host github :repo "andras-simonyi/org-cite-csl-activate") :pin "8f49ccbd337edda01e52da0c75f6a76e2cc976f7") #+end_src #+begin_src emacs-lisp :noweb-ref none :tangle yes -(use-package! bibtex-completion - :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 - -(use-package! bibtex-actions - :after embark bibtex-completion - :config - (add-to-list 'embark-keymap-alist '(bibtex . bibtex-actions-map))) +(use-package! citar + :when (featurep! :completion vertico)) (use-package! citeproc :defer t) ;;; Org-Cite configuration +(map! :after org + :map org-mode-map + :localleader + :desc "Insert citation" "@" #'org-cite-insert) + (use-package! oc - :after org bibtex-completion bibtex-actions + :after org citar :config (require 'ox) - (map! :map org-mode-map - :localleader - :desc "Insert citation" "@" #'org-cite-insert) - (defvar bibtex-actions-bibliography nil) (setq org-cite-global-bibliography - (let ((paths (or bibtex-actions-bibliography - bibtex-completion-bibliography))) + (let ((paths (or citar-bibliography + (bound-and-true-p 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 - (setq org-cite-export-processors '((t csl)))) - -;;; Org-cite processors - -;;;; Core - -(use-package! oc-basic - :after oc) + (setq org-cite-export-processors + '((t csl)))) + ;;; Org-cite processors (use-package! oc-biblatex :after oc) @@ -5509,9 +5496,26 @@ To improve =org-cite=. ;;;; Third-party +(use-package! citar-org + :no-require + :custom + (org-cite-insert-processor 'citar) + (org-cite-follow-processor 'citar) + (org-cite-activate-processor 'citar) + (org-support-shift-select t) + (when (featurep! :lang org +roam2) + ;; Include property drawer metadata for 'org-roam' v2. + (citar-org-note-include '(org-id org-roam-ref))) + ;; Personal extras + (setq citar-symbols + `((file ,(all-the-icons-faicon "file-o" :v-adjust -0.1) . " ") + (note ,(all-the-icons-material "speaker_notes" :face 'all-the-icons-silver :v-adjust -0.3) . " ") + (link ,(all-the-icons-octicon "link" :face 'all-the-icons-dsilver :v-adjust 0.01) . " ")))) + (use-package! oc-csl-activate :after oc :config + (setq org-cite-csl-activate-use-document-style t) (defun +org-cite-csl-activate/enable () (interactive) (setq org-cite-activate-processor 'csl-activate) @@ -5524,16 +5528,8 @@ To improve =org-cite=. (save-excursion (goto-char (point-min)) (org-cite-activate (point-max))) - (org-cite-csl-activate-render-all))))) - -(use-package! oc-bibtex-actions - :when (featurep! :completion vertico) - :after oc - :demand t - :config - (setq org-cite-insert-processor 'oc-bibtex-actions - org-cite-follow-processor 'oc-bibtex-actions - org-cite-activate-processor 'basic)) + (org-cite-csl-activate-render-all))) + (fmakunbound #'+org-cite-csl-activate/enable))) #+end_src I think it would be nice to have a function to convert =org-ref= citations to