unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Stefan Monnier'" <monnier@iro.umontreal.ca>
Cc: 4751@emacsbugs.donarmstrong.com
Subject: bug#4751: 23.1; `read-char' inserts accented chars when you use `M-' modifier
Date: Tue, 20 Oct 2009 08:05:55 -0700	[thread overview]
Message-ID: <5915254BB95348E2BB2962DF2A524778@us.oracle.com> (raw)
In-Reply-To: <jwvoco2434k.fsf-monnier+emacsbugreports@gnu.org>

> 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	other threads:[~2009-10-20 15:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-18 21:44 bug#4751: 23.1; `read-char' inserts accented chars when you use `M-' modifier Drew Adams
2009-10-18 22:36 ` Andreas Schwab
2009-10-19  2:15 ` Stefan Monnier
2009-10-19  6:11   ` Drew Adams
2009-10-19 13:54     ` Stefan Monnier
2009-10-19 21:42       ` Drew Adams
2009-10-20  1:20         ` Stefan Monnier
2009-10-20  2:13           ` Stefan Monnier
2009-10-20  2:30             ` Drew Adams
2009-10-20 13:51               ` Stefan Monnier
2009-10-20 15:05                 ` Drew Adams [this message]
2009-10-20 19:56                   ` Stefan Monnier
2011-09-11  4:47                     ` Lars Magne Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=5915254BB95348E2BB2962DF2A524778@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=4751@emacsbugs.donarmstrong.com \
    --cc=monnier@iro.umontreal.ca \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).