bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#638: 23.0.60; read-char evaluates to unexpected non-character value


From: Lawrence Mitchell
Subject: bug#638: 23.0.60; read-char evaluates to unexpected non-character value
Date: Fri, 01 Aug 2008 13:49:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

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@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@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@gmx.li>







reply via email to

[Prev in Thread] Current Thread [Next in Thread]