[Top][All Lists]

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

Re: key-binding values

From: Andreas Schwab
Subject: Re: key-binding values
Date: Tue, 06 Sep 2005 18:26:38 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux)

"Drew Adams" <address@hidden> writes:

> Consider these two definitions:
>  (defcustom my-key [?\C-\ ] "My key sequence.")
>  (defcustom my-key  "\C- "  "My key sequence.")
> `C-h v' then gives these values: [67108896] and "^@".
> Is this as good as can be expected - is there no way to get something more
> readable for [?\C-\ ]?

(key-description [67108896]) => "C-SPC"
(key-description "\C- ") => "C-@"

> Emacs users learn quickly to read "^@" as "control @", and they also
> learn that this is equivalent to "control SPC", but [67108896] is hard
> to read and digest.

Keys are just integers in Emacs.  There is nothing that makes any integer
special wrt to keys.

> Also, correct me if I'm wrong, but my understanding is that the form [?\C- ]
> is generally preferred over the form "\C- ", for a key binding.

These two key sequences represent quite different bindings.  You can't get
one override the other, it depends on the terminal which key you receive
on typing C-space.

> If so, that makes matters worse in cases like this.
> This form is good:
>  (defcustom my-key [(control ?\ )] "My key sequence.")

(key-description [(control ?\ )]) => "C-SPC"


Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

reply via email to

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