[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: repeatable vs. non-repeatable commands
From: |
Michael Heerdegen |
Subject: |
Re: repeatable vs. non-repeatable commands |
Date: |
Sun, 25 Jun 2017 06:56:45 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
Emanuel Berg <moasen@zoho.com> writes:
> (define-prefix-command 'C-o-prefix)
> (global-set-key "\C-o" 'C-o-prefix)
>
> (global-set-key "\C-od" (lambda () (interactive) (message "d")))
> (global-set-key "\C-oD" (lambda () (interactive) (message "D")))
>
> ... no?
That only solves the easy part (defining a prefix key), but not the
hard. The heard part is:
(global-set-key "\C-od" #'the-function)
should make C-o d d message "d" two times. But with the same named
command, binding
(global-set-key "\C-D" #'the-function)
(that is, control-shift-d) should not make typing C-D d message "d" two
times. Instead, only C-D should call the command, and the following d
is not special (i.e. calls self-insert-command). That means, I need to
decide whether I have to establish a transient map in the body of
`the-function' base on the keys hit, and how I can do that correctly is
my question.
Thanks,
Michael.