emacs-citar / citar

Emacs package to quickly find and act on bibliographic references, and edit org, markdown, and latex academic documents.
GNU General Public License v3.0
501 stars 54 forks source link

embark-define-keymap has been removed #782

Closed LorenRiccie closed 1 year ago

LorenRiccie commented 1 year ago

embark-define-keymap has been removed from embark package In the citar wiki, the snippet under the section "Using citar in Bibtex files with embark" is therefore not working anymore.

In place of I used to make it work the method you normally use to define keymaps:

(with-eval-after-load "embark" (defvar-keymap bibtex-key-embark-map :doc "Embark keymap" :parent embark-file-map "f" #'citar-open "n" #'citar-open-notes) (add-to-list 'embark-keymap-alist '(bibtex-key . bibtex-key-embark-map)))

I dont know if it is the best way to do it, but it works so far.

Since I removed helm-bibtex from my emacs configuration, I really missed the possibility to open file attchments from my bibliographic file and not only from a text citation. Correcting the wiki will maybe help others with an identical workflow.

bdarcus commented 1 year ago

I think you should be able to edit the wiki if you like ;-)

You are aware that we split the embark functionality into a separate package awhile back; citar-embark? See here etc

https://github.com/emacs-citar/citar/blob/747d9083e07b57209f652949f4807ef9cec541da/citar-embark.el#L29

LorenRiccie commented 1 year ago

Not so confident, to edit the wiki :)

Do you think this is well coded enough ? It works on my end.

(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))
(with-eval-after-load "citar-embark"
    (defvar-keymap bibtex-key-embark-map
      :doc "Embark keymap"
      :parent citar-embark-bibtex-map
      "f" #'citar-open
      "n" #'citar-open-notes)
    (add-to-list 'embark-keymap-alist '(bibtex-key . bibtex-key-embark-map)))
bdarcus commented 1 year ago

It's been awhile since I've worked with the details of embark code, and it's changed since then, so I'm not certain without digging into it and testing it myself.

I may do that sometime soon (in part because it may suggest an enhancement to citar-embark), but for now, the obvious question: does it work for you?

If yes, then it's a useful contribution to the wiki ;-)

LorenRiccie commented 1 year ago

It works indeed. I will then contribute. Thank you for the encouragement.

LorenRiccie commented 1 year ago

Please check https://github.com/emacs-citar/citar/wiki/Citar-in-bibtex-files-with-Embark for an update to use citar-embark actions in a .bibtex file