[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#1042: 23.0.60; read-char can evaluate to non-character
From: |
Markus Triska |
Subject: |
bug#1042: 23.0.60; read-char can evaluate to non-character |
Date: |
Sun, 28 Sep 2008 14:14:55 +0200 |
martin rudalics <rudalics@gmx.at> writes:
> The doc-string of `read-char' says
C-SPC (= 0) is different from C-0: (characterp 0) is t, and
(char-to-string 0) evaluates to a string; i.e., it is a character.
> Do you have a particular use case that calls for throwing an error
> here?
I relied on `read-char' evaluating to a character in ediprolog:
http://www.logic.at/prolog/ediprolog/ediprolog.html
On l.352, I read a character from the user and use `char-to-string' to
send it to the Prolog process as string. If the user generates an event
that is not a character, it should not be sent to the Prolog process,
and a usage note is displayed instead.
Thus, I can work around the current behaviour of `read-char' by also
guarding `char-to-string' against errors, or using the now obsolete
`char-valid-p' for Emacs 22, and `characterp' for later versions.
However, it would be nice if `read-char' always yielded a character.