Define keys more easily?

Vegard Øye vegard_oye at
Sat Aug 20 15:33:36 CEST 2011

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'.

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


More information about the implementations-list mailing list