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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Markus Triska <markus.triska <at> gmx.at>; dated Sun, 28 Sep 2008 05:15:02 UTC; Maintainer for emacs is bug-gnu-emacs <at> gnu.org.
Severity set to 'minor' from 'wishlist' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. Full text available.
Severity set to `wishlist' from `normal' Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. Full text available.

Message received at (unknown):


Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
	(2007-08-08) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Status: No, score=-5.3 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER
	autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02
Received: (at 1042) by emacsbugs.donarmstrong.com; 29 Sep 2008 22:38:00 +0000
Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24])
	by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8TMbval000722
	for <1042 <at> emacsbugs.donarmstrong.com>; Mon, 29 Sep 2008 15:37:58 -0700
Received: by cyd.mit.edu (Postfix, from userid 1000)
	id 279D957E341; Mon, 29 Sep 2008 18:38:52 -0400 (EDT)
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
Message-ID: <87skrilgqr.fsf <at> cyd.mit.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

> 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.




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 available.
Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1042; Package emacs. Full text available.

Message received at (unknown):


Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
	(2007-08-08) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Status: No, score=-6.2 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER
	autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02
Received: (at 1042) by emacsbugs.donarmstrong.com; 28 Sep 2008 12:15:12 +0000
Received: from mail.gmx.net (mail.gmx.net [213.165.64.20])
	by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id m8SCF6TP006689
	for <1042 <at> emacsbugs.donarmstrong.com>; Sun, 28 Sep 2008 05:15:08 -0700
Received: (qmail invoked by alias); 28 Sep 2008 12:15:01 -0000
Received: from chello062178240212.3.14.tuwien.teleweb.at (EHLO mt-computer.local) [62.178.240.212]
  by mail.gmx.net (mp052) with SMTP; 28 Sep 2008 14:15:01 +0200
X-Authenticated: #4064391
X-Provags-ID: V01U2FsdGVkX1/R4e5TqL3RCfdWMg/FzqMHXuLtB0FQ0hlw0I9nJ8
	WmEPUKaQYZe+W+
Received: by mt-computer.local (Postfix, from userid 502)
	id 4CA0FB0F8CE; Sun, 28 Sep 2008 14:14:56 +0200 (CEST)
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
References: <20080928050936.D9027B0F76E <at> mt-computer.local>
	<48DF4544.2070704 <at> gmx.at>
Date: Sun, 28 Sep 2008 14:14:55 +0200
In-Reply-To: <48DF4544.2070704 <at> gmx.at> (martin rudalics's message of "Sun, 28
	Sep 2008 10:50:12 +0200")
Message-ID: <m1tzc08o1s.fsf <at> gmx.at>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.6899999999999999

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.





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 available.
Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1042; Package emacs. Full text available.

Message received at (unknown):


Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
	(2007-08-08) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Status: No, score=-6.7 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER
	autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02
Received: (at 1042) by emacsbugs.donarmstrong.com; 28 Sep 2008 08:53:31 +0000
Received: from mail.gmx.net (mail.gmx.net [213.165.64.20])
	by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id m8S8rQ41021325
	for <1042 <at> emacsbugs.donarmstrong.com>; Sun, 28 Sep 2008 01:53:28 -0700
Received: (qmail invoked by alias); 28 Sep 2008 08:53:20 -0000
Received: from 62-47-49-73.adsl.highway.telekom.at (EHLO [62.47.49.73]) [62.47.49.73]
  by mail.gmx.net (mp061) with SMTP; 28 Sep 2008 10:53:20 +0200
X-Authenticated: #14592706
X-Provags-ID: V01U2FsdGVkX19ILk4m36VIUk/iFaVgmnjdoWooPAAgCq6T9CX33p
	CrhtR4IjaJ0/hJ
Message-ID: <48DF4544.2070704 <at> gmx.at>
Date: Sun, 28 Sep 2008 10:50:12 +0200
From: martin rudalics <rudalics <at> gmx.at>
User-Agent: Thunderbird 2.0.0.16 (Windows/20080708)
MIME-Version: 1.0
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
References: <20080928050936.D9027B0F76E <at> mt-computer.local>
In-Reply-To: <20080928050936.D9027B0F76E <at> mt-computer.local>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.67

 > 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.





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 available.
Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1042; Package emacs. Full text available.

Message received at (unknown):


Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
	(2007-08-08) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Status: No, score=-6.2 required=4.0 tests=AWL,BAYES_00,FOURLA,NUMONLY,
	RCVD_IN_DNSWL_MED autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02
Received: (at submit) by emacsbugs.donarmstrong.com; 28 Sep 2008 05:09:49 +0000
Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10])
	by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8S59j3b030294
	for <submit <at> emacsbugs.donarmstrong.com>; Sat, 27 Sep 2008 22:09:46 -0700
Received: from mx10.gnu.org ([199.232.76.166]:35911)
	by fencepost.gnu.org with esmtp (Exim 4.67)
	(envelope-from <triska <at> gmx.at>)
	id 1KjoVL-0003rk-EB
	for emacs-pretest-bug <at> gnu.org; Sun, 28 Sep 2008 01:07:35 -0400
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60)
	(envelope-from <triska <at> gmx.at>)
	id 1KjoXP-0007jB-PN
	for emacs-pretest-bug <at> gnu.org; Sun, 28 Sep 2008 01:09:44 -0400
Received: from mail.gmx.net ([213.165.64.20]:60244)
	by monty-python.gnu.org with smtp (Exim 4.60)
	(envelope-from <triska <at> gmx.at>)
	id 1KjoXP-0007in-9f
	for emacs-pretest-bug <at> gnu.org; Sun, 28 Sep 2008 01:09:43 -0400
Received: (qmail invoked by alias); 28 Sep 2008 05:09:40 -0000
Received: from chello062178240212.3.14.tuwien.teleweb.at (EHLO mt-computer.local) [62.178.240.212]
  by mail.gmx.net (mp008) with SMTP; 28 Sep 2008 07:09:40 +0200
X-Authenticated: #4064391
X-Provags-ID: V01U2FsdGVkX1/oVt4sg0Xokr9tgAUrGf0yyAjD4zwN1PJDozdv/5
	ofETEjl5/++0pX
Received: by mt-computer.local (Postfix, from userid 502)
	id D9027B0F76E; Sun, 28 Sep 2008 07:09:36 +0200 (CEST)
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
Message-Id: <20080928050936.D9027B0F76E <at> mt-computer.local>
Date: Sun, 28 Sep 2008 07:09:36 +0200 (CEST)
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.55
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)


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





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 available.
Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1042; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 4 Oct 2011 20:15:02 UTC

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