Skip to content
Bruce D'Arcus edited this page Sep 3, 2022 · 23 revisions

new embark target finder for bare org citation references (though it's a bit too greedy ATM):

(setf (alist-get
       'key-at-point
       (alist-get '(org-mode) citar-major-mode-functions nil nil #'equal))
      #'my/citar-org-key-at-point)

(defun my/citar-org-key-at-point ()
  "Return key at point for org-cite citation-reference or citekey."
  (or (citar-org-key-at-point)
      (when (org-in-regexp org-element-citation-key-re)
        (cons (substring (match-string 0) 1)
              (cons (match-beginning 0)
                    (match-end 0))))))

embark-act

Bind the keymap to embark-act like so:

(add-to-list 'embark-keymap-alist '(bib-reference . citar-map))

embark-become

This command allows you to take the input you use for one command, but pipe it to another.

That can be used to configure something similar to the "fallback" behavior you see in helm-bibtex and ivy-bibtex.

In order to configure that, you use a keymap, just as with embark-act. Here's an example for biblio lookup services, which in this case will be available if you are using citar-open-library-files:

;; define the keymap
(defvar my-citar-embark-become-map
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "f") 'citar-open-library-files)
    (define-key map (kbd "x") 'biblio-arxiv-lookup)
    (define-key map (kbd "c") 'biblio-crossref-lookup)
    (define-key map (kbd "i") 'biblio-ieee-lookup)
    (define-key map (kbd "h") 'biblio-hal-lookup)
    (define-key map (kbd "s") 'biblio-dissemin-lookup)
    (define-key map (kbd "b") 'biblio-dblp-lookup)
    (define-key map (kbd "o") 'biblio-doi-insert-bibtex)
  map)
  "Citar Embark become keymap for biblio lookup.")

;; tell embark about the keymap
(add-to-list 'embark-become-keymaps 'my-citar-embark-become-map)

A single "entry" command?

A flat list of standard Emacs commands plus Embark gives a lot of flexibility.

If you come from helm-bibtex or ivy-bibtex and crave a shorter entry point, however, the simple solution is to define an alias to what you'd like to be your default command; like:

(defalias 'my/cite 'citar-insert-citation)

tablist-mode

For marking candidates in the embark-collect buffer. TODO Still need code to bind this to embark.

embark-collect-direct-action-minor-mode

This allows you to bypass the embark-act command and invoke actions directly within a collect buffer.

Clone this wiki locally