GNU bug report logs - #1042
23.0.60; read-char can evaluate to non-character

Previous Next

Package: emacs;

Reported by: Markus Triska <markus.triska <at> gmx.at>

Date: Sun, 28 Sep 2008 05:15:02 UTC

Severity: minor

Merged with 13599, 32562

Found in version 24.2

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1042 in the body.
You can then email your comments to 1042 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1042; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Markus Triska <markus.triska <at> gmx.at>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.60; read-char can evaluate to non-character
Date: Sun, 28 Sep 2008 07:09:36 +0200 (CEST)
In "$ emacs -Q", when I evaluate:

   (read-char)

and press C-0, I get:

   67108912

However, (characterp 67108912) is nil, and (char-to-string 67108912)
throws an error. Thus I expect an error also from read-char in this
case. Besides, in `char-resolve-modifers', "modifiers" is misspelled.

In GNU Emacs 23.0.60.1 (i386-apple-darwin8.11.1, GTK+ Version 2.12.9)
 of 2008-09-24 on mt-computer.local
Windowing system distributor `The XFree86 Project, Inc', version 11.0.40400000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1042; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #10 received at 1042 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Markus Triska <markus.triska <at> gmx.at>, 1042 <at> debbugs.gnu.org
Subject: Re: bug#1042: 23.0.60; read-char can evaluate to non-character
Date: Sun, 28 Sep 2008 10:50:12 +0200
> In "$ emacs -Q", when I evaluate:
>
>    (read-char)
>
> and press C-0, I get:
>
>    67108912
>
> However, (characterp 67108912) is nil, and (char-to-string 67108912)
> throws an error. Thus I expect an error also from read-char in this
> case.

The doc-string of `read-char' says

    If the character has modifiers, they are resolved and reflected to the
    character code if possible (e.g. C-SPC -> 0).

Do you have a particular use case that calls for throwing an error here?

> Besides, in `char-resolve-modifers', "modifiers" is misspelled.

I fixed that.

Thanks, martin.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1042; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #15 received at 1042 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Markus Triska <markus.triska <at> gmx.at>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 1042 <at> debbugs.gnu.org
Subject: Re: bug#1042: 23.0.60; read-char can evaluate to non-character
Date: Sun, 28 Sep 2008 14:14:55 +0200
martin rudalics <rudalics <at> 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.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1042; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #20 received at 1042 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Markus Triska <markus.triska <at> gmx.at>
Cc: 1042 <at> debbugs.gnu.org
Subject: Re: bug#1042: 23.0.60; read-char can evaluate to non-character
Date: Mon, 29 Sep 2008 18:38:52 -0400
> it would be nice if `read-char' always yielded a character.

This may be true, but let's discuss this after the release.  Making such
a change right now would be dangerous.




Severity set to `wishlist' from `normal' Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Mon, 29 Sep 2008 22:45:05 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'wishlist' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 04 Oct 2011 20:10:02 GMT) Full text and rfc822 format available.

Forcibly Merged 1042 13599. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 08 Feb 2013 03:21:01 GMT) Full text and rfc822 format available.

Forcibly Merged 1042 13599 32562. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 28 Aug 2018 20:52:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 10 Oct 2018 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 255 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.