Closed spiderbit closed 1 year ago
The form passed to bind:
is not executed as code. It is a form that describes key bindings. It is the same format as what you would pass to bind-keys
itself (mostly, see #967 and #971 for related bugs). One thing bind:
does is set up autoloads for the commands that are bound to. So, if you don't use bind:
, you may need:
:commands action1
...but only if action1
is not provided by the package named in the enclosing use-package
-- in that case action1
does not need an autoload.
The form passed to config:
is lisp code that is executed after the package is loaded. You can write it separately, outside the use-package
form, and get it working that way, then put it in the form. One thing I notice: I don't think you need to call symbol-value
in your code. Otherwise, I'm not sure what problems you are having. Can you explain what you mean by "behaves here very differently"?
I don't think hyper analyse what I meant brings us very far, the question primary interesting would be the part:
want to add key bindings to multiple maps
When I want to add 20 keybindings to 3 maps that are related to 1 package but I don't want DRY disadvantages, how can I do that?
I don't think hyper analyse what I meant brings us very far, the question primary interesting would be the part:
want to add key bindings to multiple maps
When I want to add 20 keybindings to 3 maps that are related to 1 package but I don't want DRY disadvantages, how can I do that?
There is no way around using something like :config
or :init
to do that, I think. Does that not work for you, for some reason?
It does work it's just ugly if you have 20 bindings you want to add to add identically to 3 different key maps. And if I want to change something I have to keep it consistent and chance in all 3 places.
@spiderbit If I'm understanding you correctly, you would like to change this:
:bind
(:map map1 (<key1> . 'action1)
:map map2 (<key1> . 'action1)
Into something like this:
:bind
(:map (map1 map2) (<key1> . 'action1))
Is that right? If so, I think this might be a duplicate of #959.
Yes and Yes, seems like a duplicate.
Yes and Yes, seems like a duplicate.
Thanks, so I'm closing this as a duplicate of #959. Let's use that issue to track progress on this.
I read through the issues and saw something about using such code if you want to add key bindings to multiple maps and I thought this was the solution basically I want to not have a copy-paste form of that:
I thought that would be achievable through:
Did I miss something or is that supposed to be equivalent, because it behaves here very differently. I don't want so much redundant code and 1 place to change the behavior on one place without copy / pasting.