GNU bug report logs -
#32562
26; `read-char(-exclusive)' and `characterp'
Previous Next
Full log
Message #19 received at 32562 <at> debbugs.gnu.org (full text, mbox):
> Date: Tue, 28 Aug 2018 13:39:20 -0700 (PDT)
> From: Drew Adams <drew.adams <at> oracle.com>
>
> 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?
This bug report was last modified 6 years and 306 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.