bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#32562: 26; `read-char(-exclusive)' and `characterp'


From: Eli Zaretskii
Subject: bug#32562: 26; `read-char(-exclusive)' and `characterp'
Date: Mon, 10 Sep 2018 12:56:41 +0300

> Date: Tue, 28 Aug 2018 13:39:20 -0700 (PDT)
> From: Drew Adams <address@hidden>
> 
> Perhaps there is no bug here, other than incomplete or insufficiently
> clear doc.  Dunno.

It's a documentation bug.

> emacs -Q
> M-: (setq foo (read-char "Char: "))
> M-:
> 
> shows: 134217786 (#o1000000072, #x800003a), a number too large
> to be `characterp'.  And M-: (characterp foo) ; returns nil.
> 
> Same thing for `read-char-exclusive'.
> 
> Something seems wrong.  The doc for `read-char(-exclusive)' talks about
> reading a character. For `read-char' it says that it raises an error for
> a non-char event.  And for `read-char-exclusive' it says that it ignores
> non-char events that it reads.
> 
> But they both seem to read the event from `M-:' and return its value
> (a number). And it is not a character, according to `characterp'.

What the documentation failed to make clear is that the value returned
by these functions is an _event_, not a character.  For ASCII
characters, the event and the character are identical, but modifier
bits that cannot be resolved to yield an ASCII character are left in
the returned value, and that makes the value not a valid character
code.

I have now clarified this subtle point in the documentation (on the
emacs-26 branch).

> And what function reads a `characterp' character, either ignoring
> anything else or raising an error for anything else?

What do you mean by "reading a 'characterp'"?  E.g., if the user types
C-% or M-a, what 'characterp' code would you expect to see?  Also,
does "reading a 'characterp'" include supporting input methods, if
any?





reply via email to

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