-
Notifications
You must be signed in to change notification settings - Fork 53
Citar in bibtex files with Embark
EFLS edited this page Mar 29, 2022
·
6 revisions
To use Citar on bibtex entries in .bib
files, we can
leverage Embark.
First we create a finder for Embark. This ensures that
embark-act
will recognize the bibtex keys.
(defun bibtex-key-embark ()
(save-excursion
(bibtex-beginning-of-entry)
(when (looking-at bibtex-entry-maybe-empty-head)
(cons 'bibtex-key
(bibtex-key-in-head)))))
(with-eval-after-load "embark"
(add-to-list 'embark-target-finders 'bibtex-key-embark))
Next, we define a keymap, include some functions & keys, and link it to this Embark type.
(with-eval-after-load "embark"
(embark-define-keymap bibtex-key-embark-map
"Embark keymap for Zetteldeft links"
("f" 'citar-open)
("n" 'citar-open-notes))
(add-to-list 'embark-keymap-alist '(bibtex-key . bibtex-key-embark-map)))
That's it! Now simply call embark-act
on a bibtex entry, and use the new keybindings to use Citar.