GNU bug report logs - #638
23.0.60; read-char evaluates to unexpected non-character value

Previous Next

Package: emacs;

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

Date: Fri, 1 Aug 2008 12:05:06 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lawrence Mitchell <wence <at> gmx.li>
To: bug-gnu-emacs <at> gnu.org
Cc: emacs-pretest-bug <at> gnu.org
Subject: bug#638: 23.0.60; read-char evaluates to unexpected non-character value
Date: Fri, 01 Aug 2008 13:49:35 +0100
Markus Triska wrote:
> When I do:

>    $ emacs -Q --eval "(insert (format \"%s\" (read-char nil nil 0.1))))"

> The content of *scratch* is:

>    7340161

This is due to the following change:

2008-03-05  Kenichi Handa  <handa <at> ni.aist.go.jp>

	* lread.c (Fread_char): Resolve modifiers.
	(Fread_char_exclusive): Likewise.

It unconditionally resolves modifiers even if read_filtered_event
returns nil.  The following patch fixes things, I think.

2008-08-01  Lawrence Mitchell  <wence <at> gmx.li>

	* lread.c (Fread_char, Fread_char_exclusive): If no character
	event is read before timeout is reached, return nil, rather than
	converting to a number.


diff --git a/src/lread.c b/src/lread.c
index f36162b..97b22d5 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -796,6 +796,8 @@ floating-point value.  */)
   if (! NILP (prompt))
     message_with_string ("%s", prompt, 0);
   val = read_filtered_event (1, 1, 1, ! NILP (inherit_input_method), seconds);
+  if ( NILP (val) )
+    return Qnil;
   c = XINT (val);
   return make_number (char_resolve_modifier_mask (c));
 }
@@ -841,6 +843,8 @@ floating-point value.  */)
   if (! NILP (prompt))
     message_with_string ("%s", prompt, 0);
   val = read_filtered_event (1, 1, 0, ! NILP (inherit_input_method), seconds);
+  if ( NILP (val) )
+    return Qnil;
   c = XINT (val);
   return make_number (char_resolve_modifier_mask (c));
 }
-- 
1.5.6.GIT



-- 
Lawrence Mitchell <wence <at> gmx.li>






This bug report was last modified 16 years and 336 days ago.

Previous Next


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