From: "Drew Adams" <drew.adams@oracle.com>
Subject: RE: key-binding values
Date: Tue, 6 Sep 2005 10:15:03 -0700 [thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICKEFCCMAA.drew.adams@oracle.com> (raw)
In-Reply-To: <je7jdu5fi9.fsf@sykes.suse.de>
> 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-@"
Yes, that's what key-description is for. My question was, "is this as good
as can be expected from C-h v in this case?" I suppose the answer is "yes",
because there is no way for describe-variable to know that this represents a
key sequence and not an arbitrary string or vector.
> 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.
Characters, not key sequences, are integers. Some key sequences are
characters (integers), but others are more complex events. And none of the
ouput expressions "^@", [67108896], and [(control 32)], or the input
expressions "\C- ", [?\C-\ ], and [(control ?\ )], is an integer.
But this point is valid: There is nothing that makes a vector, string etc.
special wrt a key. There is no way for C-h v to know that a given value is
intended to represent a key sequence.
> 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.
Whenever either is acceptable, is one of the two preferred in Emacs-Lisp
code, for binding keys? My understanding was that the vector form was
preferred.
> If so, that makes matters worse in cases like this.
> This form is good:
> (defcustom my-key [(control ?\ )] "My key sequence.")
Given all of the above, I would think that [(control ?\ )] should be the
preferred syntax in code, whenever alternatives are equivalent. Both the
source code and the C-h v output are clearer.
next prev parent reply other threads:[~2005-09-06 17:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-06 15:50 key-binding values Drew Adams
2005-09-06 16:26 ` Andreas Schwab
2005-09-06 17:15 ` Drew Adams [this message]
2005-09-06 22:14 ` Andreas Schwab
2005-09-06 22:51 ` Edward O'Connor
2005-09-07 5:05 ` Richard M. Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DNEMKBNJBGPAOPIJOOICKEFCCMAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).