From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: Re: capslock changes control characters? Date: Wed, 05 Mar 2008 11:18:36 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1204733956 9445 80.91.229.12 (5 Mar 2008 16:19:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Mar 2008 16:19:16 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org, christopher.ian.moore@gmail.com, rms@gnu.org To: Kenichi Handa Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 05 17:19:42 2008 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 1JWwL0-00012e-Vy for ged-emacs-devel@m.gmane.org; Wed, 05 Mar 2008 17:19:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JWwKT-0000sn-L0 for ged-emacs-devel@m.gmane.org; Wed, 05 Mar 2008 11:18:53 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JWwKP-0000se-U3 for emacs-devel@gnu.org; Wed, 05 Mar 2008 11:18:49 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JWwKO-0000sE-Jg for emacs-devel@gnu.org; Wed, 05 Mar 2008 11:18:49 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JWwKO-0000sA-HR for emacs-devel@gnu.org; Wed, 05 Mar 2008 11:18:48 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JWwKO-00054a-BI for emacs-devel@gnu.org; Wed, 05 Mar 2008 11:18:48 -0500 Original-Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1JWwKO-0005pw-4F for emacs-pretest-bug@gnu.org; Wed, 05 Mar 2008 11:18:48 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1JWwKL-00054B-2C for emacs-pretest-bug@gnu.org; Wed, 05 Mar 2008 11:18:48 -0500 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JWwKK-00053p-NK; Wed, 05 Mar 2008 11:18:44 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAD9XzkfO+LKX/2dsb2JhbACrbIEC X-IronPort-AV: E=Sophos;i="4.25,451,1199682000"; d="scan'208";a="15618463" Original-Received: from smtp.pppoe.ca ([65.39.196.238]) by ironport2-out.pppoe.ca with ESMTP; 05 Mar 2008 11:18:37 -0500 Original-Received: from pastel.home ([206.248.178.151]) by smtp.pppoe.ca (Internet Mail Server v1.0) with ESMTP id LTX02337; Wed, 05 Mar 2008 11:18:37 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 0394D8359; Wed, 5 Mar 2008 11:18:37 -0500 (EST) In-Reply-To: (Kenichi Handa's message of "Wed, 05 Mar 2008 14:13:05 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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:91392 gmane.emacs.pretest.bugs:21414 Archived-At: > 2008-03-05 Kenichi Handa > * lread.c (Fread_char): Resolve modifiers. > (Fread_char_exclusive): Likewise. > Previously (read-char) returned 33554441 when you type C-I > (i.e. C-S-i). I changed it to return 9 (i.e. C-i). It is > also changed to return 233 upon M-i instead of 134217833. > They still return a code containing unresolvable modifiers. It looks ok, but I have some comments/questions: 1 - Why both with the mapping of meta? AFAIK this is only ever used when manipulating keymaps using keysequences represented as strings rather than vectors. So I don't think it's needed here. 2 - why is this needed now. It seems like this was already working fine before the unicode merge without this function, so what is the change that caused the problem in the first place (or in other words, how did it work before)? -- Stefan > The algorithm of resolving modifiers is implemented in > char_resolve_modifier_mask as below: > int > char_resolve_modifier_mask (c) > int c; > { > /* A non-ASCII character can't reflect modifier bits to the code. */ > if (! ASCII_CHAR_P ((c & ~CHAR_MODIFIER_MASK))) > return c; > /* For Meta, Shift, and Control modifiers, we need special care. */ > if (c & CHAR_SHIFT) > { > /* Shift modifier is valid only with [A-Za-z]. */ > if ((c & 0377) >= 'A' && (c & 0377) <= 'Z') > c &= ~CHAR_SHIFT; > else if ((c & 0377) >= 'a' && (c & 0377) <= 'z') > c = (c & ~CHAR_SHIFT) - ('a' - 'A'); > /* Shift modifier for control characters and SPC is ignored. */ > else if ((c & ~CHAR_MODIFIER_MASK) <= 0x20) > c &= ~CHAR_SHIFT; > } > if (c & CHAR_CTL) > { > /* Simulate the code in lread.c. */ > /* Allow `\C- ' and `\C-?'. */ > if ((c & 0377) == ' ') > c &= ~0177 & ~ CHAR_CTL; > else if ((c & 0377) == '?') > c = 0177 | (c & ~0177 & ~CHAR_CTL); > /* ASCII control chars are made from letters (both cases), > as well as the non-letters within 0100...0137. */ > else if ((c & 0137) >= 0101 && (c & 0137) <= 0132) > c &= (037 | (~0177 & ~CHAR_CTL)); > else if ((c & 0177) >= 0100 && (c & 0177) <= 0137) > c &= (037 | (~0177 & ~CHAR_CTL)); > } > if (c & CHAR_META) > { > /* Move the meta bit to the right place for a string. */ > c = (c & ~CHAR_META) | 0x80; > } > return c; > } > --- > Kenichi Handa > handa@ni.aist.go.jp