Skip to content

Notes configuration

Bruce D'Arcus edited this page Aug 15, 2022 · 8 revisions

Custom notes source

Citar 1.0 includes a flexibility notes API. Examples of how to use it.

Citar-Org-Roam

This small integration package was developed alongside the API.

https://github.com/emacs-citar/citar-org-roam

Org-Roam-Bibtex

You can also use citar-org-roam to also plugin to org-roam-bibtex, like so:

(require 'citar-org-roam)
(citar-register-notes-source
 'orb-citar-source (list :name "Org-Roam Notes"
        :category 'org-roam-node
        :items #'citar-org-roam--get-candidates
        :hasitems #'citar-org-roam-has-notes
        :open #'citar-org-roam-open-note
        :create #'orb-citar-edit-note
        :annotate #'citar-org-roam--annotate))

(setq citar-notes-source 'orb-citar-source)

Org

#+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
Clone this wiki locally