-
Notifications
You must be signed in to change notification settings - Fork 52
Notes configuration
Bruce D'Arcus edited this page May 18, 2022
·
8 revisions
This is adapted from Jethro Kuan's example.
(defun my/citar-org-roam-notes-function (citekey entry _)
(let ((title (citar--format-entry-no-widths entry
"${author editor} :: ${title}")))
(org-roam-capture- :templates
'(("r" "reference" plain "%?" :if-new
(file+head "reference/${citekey}.org"
":PROPERTIES:
:ROAM_REFS: [cite:@${citekey}]
:END:
#+title: ${title}\n")
:immediate-finish t
:unnarrowed t))
:info (list :citekey citekey)
:node (org-roam-node-create :title title)
:props '(:finalize find-file))))
#+name: bibliographic-entry-template
: #+title: %s
: #+subtitle: Bibliographic Notes
: #+author: %s
: #+email: %s
: #+property: header-args+ :comments link
: #+cite_export: csl apa.csl
:
: * Notes
:
: |
:
: * References
:
: #+begin_src bibtex :tangle %s :exports none
: %s
: #+end_src
:
: #+print_bibliography:
#+begin_src emacs-lisp :var template=bibliographic-entry-template
(defun my-citar-org-open-notes (key entry)
(let* ((bib (string-join (list my/bibtex-directory key ".bib")))
(org (string-join (list my/bibtex-directory key ".org")))
(new (not (file-exists-p org))))
(funcall citar-file-open-function org)
(when (and new (eq (buffer-size) 0))
(insert (format template
(assoc-default "title" entry)
user-full-name
user-mail-address
bib
(with-temp-buffer
(insert-file-contents bib)
(buffer-string))))
(search-backward "|")
(delete-char 1))))
(setq-default citar-open-note-function 'my-citar-org-open-notes)
#+end_src