unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Run `C-x C-e' on (self-insert-command 1) and (this-command-keys).
Date: Thu, 21 Oct 2021 16:28:47 +0200	[thread overview]
Message-ID: <87pmrywixs.fsf@web.de> (raw)
In-Reply-To: CAGP6PO+iwj=FpsTTPPpOYdCGLBWYZ10ZC9Uf572TTfn8BYsyQg@mail.gmail.com

Hongyi Zhao <hongyi.zhao@gmail.com> writes:

> (self-insert-command 1)^E
>
> But why doesn't it give the following:
>
> (self-insert-command 1)^X^E

This question is a bit like "I drove my car into a lake and it drowned -
why was it designed to do that?".  It is not a silly question, but most
drivers don't try and also don't ask.

Ok.  `self-insert-command' is a command to insert the character a key
corresponds to - "Insert the character you type." (from the docstring).
It operates on the level of single (key) events, not key sequences.

So instead of binding a complete key sequence Z h a o to
`self-insert-command', so that when you have finished typing those keys
Emacs would insert "Zhao", each of the individual letter keys are just
bound to `self-insert-command'.  The command is intended to be bound to
keys.

In that way this command kind of an exception.  For more see the
implementation: it just looks at the last event.

Michael.




  reply	other threads:[~2021-10-21 14:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21  6:22 Run `C-x C-e' on (self-insert-command 1) and (this-command-keys) Hongyi Zhao
2021-10-21 14:28 ` Michael Heerdegen [this message]
2021-10-21 19:49   ` Emanuel Berg via Users list for the GNU Emacs text editor

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=87pmrywixs.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).