-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgs-citar.el
79 lines (70 loc) · 2.8 KB
/
gs-citar.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
;;; -*- lexical-binding: t -*-
(use-package citar
:custom
(citar-bibliography "~/Documents/bibliography.bib")
(citar-citeproc-csl-styles-dir "~/Documents/zotero/styles/")
(citar-citeproc-csl-style "harvard-cite-them-right.csl")
(citar-format-reference-function #'citar-citeproc-format-reference)
(citar-library-paths '("~/Documents/zotero/storage/"))
(citar-open-entry-function #'citar-open-entry-in-zotero)
(citar-templates '((main . "${author editor:30%sn} ${date year issued:4} ${title:48}")
(suffix . " ${=key= id:15} ${tags keywords keywords:*} ${abstract abstract:*}")
(preview . "${author editor:%etal} (${year issued date}) ${title}, ${journal journaltitle publisher container-title collection-title}.")
(note . "Notes on ${author editor:%etal}, ${title}")))
:hook
(org-mode . citar-capf-setup)
:ensure t)
(use-package citar-embark
:after embark
:config
(defun bdarcus/citar-org-key-at-point ()
"Return citekey at point, when in org property drawer.
Citekey must be formatted as `@key'."
(or (citar-org-key-at-point)
(when (and (equal (org-element-type (org-element-at-point)) 'node-property)
(org-in-regexp (concat "[[:space:]]" org-element-citation-key-re)))
(cons (substring (match-string 0) 2)
(cons (match-beginning 0)
(match-end 0))))))
(setf (alist-get
'key-at-point
(alist-get '(org-mode) citar-major-mode-functions nil nil #'equal))
#'bdarcus/citar-org-key-at-point)
(add-to-list 'embark-keymap-alist '(bib-reference . citar-map))
:custom
(citar-at-point-function #'embark-act)
:ensure t
:hook
(text-mode . citar-embark-mode))
(use-package oc
:bind
(:map org-mode-map
("C-c m q" . org-cite-insert))
:custom
(org-cite-global-bibliography '("~/Documents/bibliography.bib"))
(org-cite-insert-processor 'citar)
(org-cite-follow-processor 'citar)
(org-cite-activate-processor 'citar))
(use-package oc-csl
:after oc
:custom
(org-cite-csl-styles-dir "~/Documents/zotero/styles/")
(org-cite-export-processors '((t . (csl "harvard-cite-them-right.csl")))))
(use-package citar-org-roam
:vc (:url "https://github.com/emacs-citar/citar-org-roam")
:bind
("C-z r c" . citar-create-note)
:after org-roam
:config
(citar-org-roam-mode)
(add-to-list 'org-roam-capture-templates
'("b" "bibliographic" plain
(file "~/Documents/org-roam/templates/default.org")
:if-new
(file+head "%<%Y%m%d%H%M%S>-${citar-citekey}.org" "#+title: ${title}\n\n")
:unnarrowed t))
:custom
(citar-org-roam-capture-template-key "b")
(citar-org-roam-note-title-template "${title}")
:ensure t)
(provide 'gs-citar)