help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Migration from define-key to bind-key with prefix-command


From: Alex Kost
Subject: Re: Migration from define-key to bind-key with prefix-command
Date: Mon, 09 Nov 2015 21:12:27 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Karl Voit (2015-11-09 15:55 +0300) wrote:

> Hi!
>
> How can I define "define-key" commands with a global prefix-command to
> bind-key(s) syntax?

Do you mean you want to use 'bind-key' package from
<https://github.com/jwiegley/use-package/>?

If so, you can use something like this:

(bind-keys
 :prefix-map my-map
 :prefix-docstring "My favourite map"
 :prefix "C-c ,"
 ("-" . text-scale-decrease)
 ("+" . text-scale-increase))

> I don't want to loose the ability to change my global prefix "my-map"
> to a different one on one single place. I also want to keep my habit
> of defining key bindings on many different places scattered all over
> my init file and not on one single spot.

You are not forced to use a single spot.  You can add keys to your map
later:

(bind-keys
 :map my-map
 ("f" . forward-char)
 ("b" . backward-char))

or:

(bind-key "RET" 'hanoi my-map)

-- 
Alex



reply via email to

[Prev in Thread] Current Thread [Next in Thread]