From 66c410cec5064a6b2164b7e90c215efcb520b65d Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Thu, 14 Aug 2008 19:24:54 +0000 Subject: [PATCH] (Fread_char, Fread_char_exclusive): If no character event is read before timeout is reached, return nil, rather than converting to a number. --- src/lread.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lread.c b/src/lread.c index f36162b1a85..58faf747d1f 100644 --- a/src/lread.c +++ b/src/lread.c @@ -791,13 +791,13 @@ floating-point value. */) Lisp_Object prompt, inherit_input_method, seconds; { Lisp_Object val; - int c; if (! NILP (prompt)) message_with_string ("%s", prompt, 0); val = read_filtered_event (1, 1, 1, ! NILP (inherit_input_method), seconds); - c = XINT (val); - return make_number (char_resolve_modifier_mask (c)); + + return (NILP (val) ? Qnil + : make_number (char_resolve_modifier_mask (XINT (val)))); } DEFUN ("read-event", Fread_event, Sread_event, 0, 3, 0, @@ -836,13 +836,14 @@ floating-point value. */) Lisp_Object prompt, inherit_input_method, seconds; { Lisp_Object val; - int c; if (! NILP (prompt)) message_with_string ("%s", prompt, 0); + val = read_filtered_event (1, 1, 0, ! NILP (inherit_input_method), seconds); - c = XINT (val); - return make_number (char_resolve_modifier_mask (c)); + + return (NILP (val) ? Qnil + : make_number (char_resolve_modifier_mask (XINT (val)))); } DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0, -- 2.39.2