"Drew Adams" <[EMAIL PROTECTED]> 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.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
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."


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to