From: Kenichi Handa <handa@m17n.org>
To: rms@gnu.org
Cc: emacs-pretest-bug@gnu.org, christopher.ian.moore@gmail.com
Subject: Re: capslock changes control characters?
Date: Wed, 05 Mar 2008 14:13:05 +0900 [thread overview]
Message-ID: <E1JWlw9-0000DO-CM@etlken.m17n.org> (raw)
In-Reply-To: <E1JTPMO-0000WA-5C@fencepost.gnu.org> (message from Richard Stallman on Mon, 03 Mar 2008 05:08:53 -0500)
In article <E1JTPMO-0000WA-5C@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> writes:
> [I sent this message a week ago but did not get a response.]
> Would someone please DTRT and ack?
[...]
> From: "Chris Moore" <christopher.ian.moore@gmail.com>
> To: emacs-pretest-bug@gnu.org
> Subject: capslock changes control characters?
> I tried to insert a TAB into a C++ mode buffer by typing:
> C-q C-i
> I got an error:
> Debugger entered--Lisp error: (wrong-type-argument char-or-string-p 33554441)
I've just installed a fix. It required changes to several
places, and among them I'm not sure the following changes
are ok.
2008-03-05 Kenichi Handa <handa@ni.aist.go.jp>
* 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.
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
next prev parent reply other threads:[~2008-03-05 5:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-18 18:45 capslock changes control characters? Chris Moore
2008-02-24 22:30 ` Richard Stallman
2008-03-03 10:38 ` David Reitter
2008-03-03 14:02 ` Stefan Monnier
2008-03-03 14:49 ` Andreas Schwab
2008-03-04 13:15 ` Chris Moore
2008-03-05 5:13 ` Kenichi Handa [this message]
2008-03-05 16:18 ` Stefan Monnier
2008-03-05 16:50 ` Andreas Schwab
2008-03-06 11:20 ` Kenichi Handa
2008-03-07 23:04 ` Stefan Monnier
2008-03-10 0:54 ` Kenichi Handa
2008-03-10 3:26 ` Stefan Monnier
2008-03-16 9:15 ` Andreas Schwab
2008-03-17 0:48 ` Kenichi Handa
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=E1JWlw9-0000DO-CM@etlken.m17n.org \
--to=handa@m17n.org \
--cc=christopher.ian.moore@gmail.com \
--cc=emacs-pretest-bug@gnu.org \
--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.