Define keys more easily?

Michael Markert markert.michael at googlemail.com
Sat Aug 20 15:48:58 CEST 2011


On 20 Aug 2011, Vegard Øye wrote:

> On 2011-08-20 00:26 +0200, Michael Markert wrote:
>
>> (evil-define-keys 'motion speedbar-key-map "h" 'backward-char
>> "j" 'speedbar-next
>> "k" 'speedbar-prev
>> "l" 'forward-char
>> ...)
>>
>> Is it worth to include it? And if, is it worth to keep the single
>> key functions?
>
> I would just add a &rest parameter to the current function,
> `evil-define-key'. That makes it similar to `setq': you can specify
> multiple sets of arguments if you want to, or you can just use it
> in the same way as the standard function `define-key'.

Thought about it but didn't like the thought of using the singular to
define many things.

But it has the great advantage to keep backwards compatibility without
cluttering the code. I'll do it that way!

> Note that Emacs won't indent the code like above. You have to break
> it up before the first of the bindings in order for them to line up:
>
> (evil-define-keys 'motion speedbar-key-map
>                   "h" 'backward-char
>                   "j" 'speedbar-next
>                   "k" 'speedbar-prev
>                   "l" 'forward-char
>                   ...)

Yeah of course, it was just an example how it would look (at least the
big picture of it ;))

Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
Url : https://lists.ourproject.org/pipermail/implementations-list/attachments/20110820/2f250ac0/attachment-0001.pgp 


More information about the implementations-list mailing list