From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: kbd vs read-key-sequence Date: Mon, 05 Mar 2007 12:10:00 -0500 Message-ID: References: <45E8657D.4080202@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1173114662 16134 80.91.229.12 (5 Mar 2007 17:11:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 5 Mar 2007 17:11:02 +0000 (UTC) Cc: lekktu@gmail.com, jasonr@gnu.org, emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 05 18:10:55 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HOGi4-0002pV-S3 for ged-emacs-devel@m.gmane.org; Mon, 05 Mar 2007 18:10:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HOGi4-0007SO-8l for ged-emacs-devel@m.gmane.org; Mon, 05 Mar 2007 12:10:52 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HOGhS-0007FP-VZ for emacs-devel@gnu.org; Mon, 05 Mar 2007 12:10:15 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HOGhQ-0007EU-Ng for emacs-devel@gnu.org; Mon, 05 Mar 2007 12:10:14 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HOGhQ-0007EN-FZ for emacs-devel@gnu.org; Mon, 05 Mar 2007 12:10:12 -0500 Original-Received: from mercure.iro.umontreal.ca ([132.204.24.67]) by monty-python.gnu.org with esmtp (Exim 4.52) id 1HOGhM-0007Zb-Q2; Mon, 05 Mar 2007 12:10:09 -0500 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 19C0A2CEFFB; Mon, 5 Mar 2007 12:10:08 -0500 (EST) Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id E89F53FE0; Mon, 5 Mar 2007 12:10:00 -0500 (EST) Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id CD90A6C9DE; Mon, 5 Mar 2007 12:10:00 -0500 (EST) In-Reply-To: (Richard Stallman's message of "Sun\, 04 Mar 2007 21\:55\:32 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.93 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-detected-kernel: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:67364 Archived-At: > 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). > Except for the case of unibyte characters, that is the same as the > character that gets inserted in the buffer if you type the character, > right? So it should be possible to type in the character code that > C-x =3D shows you, right? Almost: 1 - the unibyte case is very common, so the "exception" is important. 2 - there's also translation-table-for-input. I had suggested to apply this directly in read-char but it was rejected, so it's still applied much later, in self-insert-command (and a few other commands). > And you should also be able to insert that character in .emacs, > then save it in whichever coding system. Why won't that work? Off the top of my head: - saving may change the char thanks to unify-8859-on-encoding (e.g. you copy a iso-8859-15 char to your .emacs which you then save in iso-8859-1). - the coding-system may not be properly detected, especially if you configure your auto-dtection in your .emacs: the configuration will apply to all files you open but not to the loading of .emacs > And if you want it to work with modifiers, it's yet a bit more > interesting because the base-event is not always decoded > I don't understand that. What does it mean to "decode the base-event"? Turn ?\M- into ?\M-=E9. > Anyway, if you want to bind a character with modifiers, you can just use > a construct in .emacs that applies the modifier to the desired base > character, such as \M- in a string, or (meta CHAR). > Is there a case where that doesn't work? Because the way the event is decoded through read-key-sequence is not necessarily the same. E.g. while ? may get turned into ?=E9, = it may be the case that ?\M- stays unchanged. Stefan