Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clarify docs on creating custom actions/target types #737

Open
mooseyboots opened this issue Oct 10, 2024 · 0 comments
Open

clarify docs on creating custom actions/target types #737

mooseyboots opened this issue Oct 10, 2024 · 0 comments

Comments

@mooseyboots
Copy link

mooseyboots commented Oct 10, 2024

i think you could make the docs much clearer on how to set up custom actions and keymaps.

i'm just learning embark, so not the person to do it. i got it working but it took some struggling to understand.

it seems like a few simple steps are required:

  1. create a keymap (as per clear code example in the docs: use defvar-keymap)

  2. create some actions (commands), taking a target as only argument, and add them to your keymap. (easy done)

  3. add a target type (in the docs kinda but pretty unclear):

;; in your parent consult function:
(consult--read candidates
               :category 'your-target-type)

your-target-type here is a consult category, and also creates an embark target type, right? Worth emphasizing! Two different concepts from two libraries are fused here.

Maybe there are other ways to also create target types?

  1. add a cons cell of target type and keymap to embark-keymap-alist (in the docs but format unclear):

the format is

(add-to-list 'embark-keymap-alist '(your-target-type . your-keymap))

That is, the consult category created above, which is also your target type, must be the car of your cons cell here. If you don't do that, your cons cell here will be meaningless.

Do I have that right? I feel like it'd be good to put the steps together in a simple list for others.

Apols if I missed the info somewhere in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant