all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: rms@gnu.org
Cc: lekktu@gmail.com, jasonr@gnu.org, emacs-devel@gnu.org
Subject: Re: kbd vs read-key-sequence
Date: Sat, 03 Mar 2007 18:01:08 -0500	[thread overview]
Message-ID: <jwvslcmc5it.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <E1HNcTx-0004Xa-8w@fencepost.gnu.org> (Richard Stallman's message of "Sat\, 03 Mar 2007 17\:13\:37 -0500")

>     Yeah, probably.  But it's been the case sine Emacs-20.  And some of the
>     bindings which worked in Emacs-20 failed in Emacs-21, and some of the
>     binding that work in Emacs-21 will fail in Emacs-22, and the same for
>     Emacs-23 most likely.  And if you add modifiers it's even more likely
>     to fail.

> I was not following this thread.  Can someone summarize the problem
> as it is known?

Here is the problem: when a key is pressed which causes a non-ASCII char to
be inserted in a buffer, the translation from the key-event to the non-ASCII
char can happen at many different levels:
- before the event is passed to Lisp code
- in input-method
- in key-translation-map (using encoded-kb typically)
- in self-insert-command (using unibyte-char-to-multibyte)

Usually, the earlier the better, but historically we started by doing the
most case of the translation (e.g. latin-1) in self-insert-command.
Also the place where it's done depends on the kind of char, the kind of
input method (e.g. XIM or LEIM), whether we're in console mode or w32, or
X11, or ...

On the other side of the problem we have code written in the .emacs file
which tries to bind something to this key.  To work, this has to satisfy
the condition that when Emacs loads the .emacs file, the key it finds in the
define-key call corresponds to the form of the event after
key-translation-map (but before unibyte-char-to-multibyte if applicable).

An additional piece of the puzzle is that the key that Emacs finds in the
define-key call might not be the one that the user sees on her screen when
she edits her .emacs, depending on how she specifies the file's encoding.

Another source of fun is of course the lack/presence of unification which
means that the same glyph or char can have different codes.

And if you want it to work with modifiers, it's yet a bit more interesting
because the base-event is not always decoded (partly because of bugs,
I guess, but in some cases it's done on purpose.  IIRC an example of
purposefully keeping the base event untranslated is for cyrillic
input-method where `c' might map to a cyrillic char, but C-c and M-c should
stay unchanged).


        Stefan

  reply	other threads:[~2007-03-03 23:01 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-28 22:27 kbd vs read-key-sequence Juanma Barranquero
2007-02-28 22:40 ` Andreas Schwab
2007-02-28 22:50   ` Lennart Borgman (gmail)
2007-02-28 23:32   ` Juanma Barranquero
2007-03-01  1:35     ` Juanma Barranquero
2007-03-01  5:28       ` Stefan Monnier
2007-03-01 12:48         ` Juanma Barranquero
2007-03-01 15:32           ` Stefan Monnier
2007-03-01 17:30             ` Juanma Barranquero
2007-03-01 23:23               ` Stefan Monnier
2007-03-01 23:53                 ` Juanma Barranquero
2007-03-02  0:03                   ` Juanma Barranquero
2007-03-02  9:09                     ` Jason Rumney
2007-03-02  9:48                       ` Juanma Barranquero
2007-03-02 16:47                   ` Stefan Monnier
2007-03-02 17:29                     ` Juanma Barranquero
2007-03-02 17:57                       ` Jason Rumney
2007-03-02 18:15                         ` Juanma Barranquero
2007-03-02 18:20                           ` David Kastrup
2007-03-02 21:03                           ` Stefan Monnier
2007-03-03  0:31                             ` Juanma Barranquero
2007-03-03 22:13                             ` Richard Stallman
2007-03-03 23:01                               ` Stefan Monnier [this message]
2007-03-05  2:55                                 ` Richard Stallman
2007-03-05 17:10                                   ` Stefan Monnier
2007-03-11 20:01                                     ` Richard Stallman
2007-03-12 15:19                                       ` Stefan Monnier
2007-03-13  1:17                                         ` Kenichi Handa
2007-03-13  3:12                                           ` Stefan Monnier
2007-03-13  4:06                                             ` Kenichi Handa
2007-03-13 14:47                                               ` Stefan Monnier
2007-03-19  5:14                                           ` Richard Stallman
2007-03-19 12:25                                             ` Kenichi Handa
2007-03-19 14:19                                               ` Kim F. Storm
2007-03-26  3:52                                               ` Richard Stallman
2007-03-26  7:22                                                 ` Kenichi Handa
2007-03-26 23:14                                                   ` Richard Stallman
2007-03-27  0:30                                                     ` Kenichi Handa
2007-03-27 16:42                                                       ` Richard Stallman
2007-03-28  0:29                                                         ` Kenichi Handa
2007-03-29 15:32                                                           ` Richard Stallman
2007-03-29 16:11                                                             ` Stefan Monnier
2007-03-30 21:23                                                               ` Richard Stallman
2007-03-31  0:38                                                                 ` Stefan Monnier
2007-03-31 10:07                                                                   ` Eli Zaretskii
2007-03-31 23:20                                                                     ` Richard Stallman
2007-04-01  3:09                                                                       ` Eli Zaretskii
2007-04-01 13:59                                                                         ` Richard Stallman
2007-04-01 19:14                                                                           ` Stefan Monnier
2007-04-01 20:18                                                                             ` Jason Rumney
2007-04-01 20:35                                                                               ` Stefan Monnier
2007-04-02 12:00                                                                                 ` Eli Zaretskii
2007-04-02  2:27                                                                               ` Kenichi Handa
2007-04-02 11:58                                                                                 ` Eli Zaretskii
2007-04-02 12:31                                                                                   ` Kenichi Handa
2007-04-02 12:46                                                                                     ` Eli Zaretskii
2007-04-02 14:33                                                                                       ` Stefan Monnier
2007-04-02 16:14                                                                                     ` Jason Rumney
2007-04-02 23:24                                                                                       ` Davis Herring
2007-04-03  6:58                                                                                         ` Jason Rumney
2007-04-03  7:46                                                                                       ` Richard Stallman
2007-04-03  8:42                                                                                         ` Eli Zaretskii
2007-04-03 14:58                                                                                           ` Stefan Monnier
2007-04-03 15:34                                                                                             ` Eli Zaretskii
2007-04-03 17:59                                                                                               ` Stefan Monnier
2007-04-03 18:20                                                                                                 ` Eli Zaretskii
2007-04-03 18:33                                                                                                   ` Stefan Monnier
2007-04-04 14:02                                                                                                 ` Richard Stallman
2007-04-04 14:02                                                                                             ` Richard Stallman
2007-04-03  9:05                                                                                         ` Jason Rumney
2007-04-03  9:37                                                                                           ` Eli Zaretskii
2007-04-03 10:24                                                                                             ` Jason Rumney
2007-04-04 14:02                                                                                           ` Richard Stallman
2007-04-03 10:12                                                                                       ` Eli Zaretskii
2007-04-04 14:02                                                                                         ` Richard Stallman
2007-04-04 18:03                                                                                           ` Eli Zaretskii
2007-03-31 20:42                                                                   ` Richard Stallman
2007-03-31 21:44                                                                     ` Eli Zaretskii
2007-03-31 22:06                                                                       ` Juanma Barranquero
2007-03-30  0:47                                                             ` Kenichi Handa
2007-03-30  3:25                                                               ` Stefan Monnier
2007-03-31 10:03                                                                 ` Eli Zaretskii
2007-03-31 20:27                                                                   ` Stefan Monnier
2007-03-30 21:22                                                               ` Richard Stallman
2007-03-31 10:02                                                               ` Eli Zaretskii
2007-03-19  5:14                                         ` Richard Stallman
2007-03-26 23:14                                         ` Richard Stallman
2007-03-28  0:57                                           ` Stefan Monnier
2007-03-28 16:09                                             ` Richard Stallman
2007-03-28 19:52                                               ` Stefan Monnier
2007-03-29 17:59                                                 ` Richard Stallman
2007-03-30 23:47                                               ` Chong Yidong
2007-03-31  9:08                                                 ` Eli Zaretskii
2007-03-03 22:13                           ` Richard Stallman
2007-03-02 18:21                         ` Juanma Barranquero
2007-03-02 19:04                           ` Jason Rumney
2007-03-03 10:39                       ` Eli Zaretskii

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvslcmc5it.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=jasonr@gnu.org \
    --cc=lekktu@gmail.com \
    --cc=rms@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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.