[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#4751: 23.1; `read-char' inserts accented chars when you use `M-' mod

From: Drew Adams
Subject: bug#4751: 23.1; `read-char' inserts accented chars when you use `M-' modifier
Date: Tue, 20 Oct 2009 08:05:55 -0700

> Yes, but it's a change that was done on purpose (at least
> the code is quite explicit), so undoing it is a bit risky.
> Hmm... OK, I just reverted that part of the change, we'll see
> what happens.
> The fundamental problem is that read-char is ill-defined: on the one
> hand, it wants to return "raw undecoded events" and on the other it
> wants to return chars (which in the general case need 
> decoding, e.g. to
> turn an escape sequence into <kp-3> and then into the char 
> ?3) and uses
> a far-reaching definition of "char" (basically: any event 
> represented by an integer).

There are those two cases: decoding vs any integer. But there are also three
cases for integers, apparently: (1) any integer, (2) any integer < 4194303, (3)
any integer small enough that the char can be used in a string or buffer (which
limit is apparently greater than 4194303).

I'm also confused about `characterp' and the notion of a character.
`(elisp)Character Type' says that only integers/chars from 0 to 4194303 can be
in strings or buffers. But ?\M-t is 134217844, yet "\M-t" is a string with that
char (`o' circumflex), and (insert-char ?\M-t 1) inserts it in a buffer. That
doc is confusing - is it also incorrect?

There is also the ambiguity I mentioned in the too-sparse doc for `characterp':
The function returns non-nil only for a subset of the chars that can be used in
a string or buffer. What is that subset (it seems to be chars < 4194304)? This
needs to be documented, IMO. Or is there perhaps also a bug for `characterp' and
it should return t for ?\M-t? Currently, characterp seems to respect the 4194303
limit: (characterp 4194303) = t, (characterp 4194304) = nil.

Wrt `read-char' what is/are the intention(s) - use cases?

Should it too only return `characterp' chars (assuming there is no `characterp'
bug), and signal an error for a non-characterp event? In which case
`read-char-exclusive' would ignore such events and wait until getting a
`characterp' char. That is one use case - I've seen code that uses `read-char'
in a loop to accumulate a string of chars, and in some cases it seems unlikely
that what is really wanted is a string that can contain meta chars.

Or should `read-char' return any char, even one beyond the limit of being
representable in strings and buffer (whatever the correct limit is - it doesn't
seem to be 4194303)? In which case, if a user really wants a characterp char,
e.g. in order to accumulate in a string, s?he would test using `characterp'
before accumulating.

Or should `read-char' accept another arg to determine the behavior.

As you can see, I'm still confused - have questions.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]