[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Migration from define-key to bind-key with prefix-command
From: |
Emanuel Berg |
Subject: |
Re: Migration from define-key to bind-key with prefix-command |
Date: |
Tue, 10 Nov 2015 22:53:07 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Karl Voit <devnull@Karl-Voit.at> writes:
>> (bind-keys
>> :prefix-map my-map
>> :prefix-docstring "My favourite map"
>> :prefix "C-c ,"
>> ("-" . text-scale-decrease)
>> ("+" . text-scale-increase))
>>
>> 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)
>
> Great!
Sure is! Here is another way to do a new prefix
command and to have it work globally and on global
commands, if that is what you are doing:
;; Create a new prefix command: C-o
(define-prefix-command 'C-o-prefix)
(global-set-key "\C-o" 'C-o-prefix)
;; Assign `C-o m' to do something useful
(global-set-key "\C-om"
(lambda ()
(interactive)
(message "Humans are sure fun to watch. And from here, the look so
small!") ))
--
underground experts united
http://user.it.uu.se/~embe8573