Mercurial > emacs
comparison src/lread.c @ 97470:9a4bddae759e
(Fread_char, Fread_char_exclusive): If no character event is read
before timeout is reached, return nil, rather than converting to a
number.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Thu, 14 Aug 2008 19:24:54 +0000 |
parents | c3512b2085a0 |
children | d8b291454853 |
comparison
equal
deleted
inserted
replaced
97469:0a5d1005eed6 | 97470:9a4bddae759e |
---|---|
789 floating-point value. */) | 789 floating-point value. */) |
790 (prompt, inherit_input_method, seconds) | 790 (prompt, inherit_input_method, seconds) |
791 Lisp_Object prompt, inherit_input_method, seconds; | 791 Lisp_Object prompt, inherit_input_method, seconds; |
792 { | 792 { |
793 Lisp_Object val; | 793 Lisp_Object val; |
794 int c; | |
795 | 794 |
796 if (! NILP (prompt)) | 795 if (! NILP (prompt)) |
797 message_with_string ("%s", prompt, 0); | 796 message_with_string ("%s", prompt, 0); |
798 val = read_filtered_event (1, 1, 1, ! NILP (inherit_input_method), seconds); | 797 val = read_filtered_event (1, 1, 1, ! NILP (inherit_input_method), seconds); |
799 c = XINT (val); | 798 |
800 return make_number (char_resolve_modifier_mask (c)); | 799 return (NILP (val) ? Qnil |
800 : make_number (char_resolve_modifier_mask (XINT (val)))); | |
801 } | 801 } |
802 | 802 |
803 DEFUN ("read-event", Fread_event, Sread_event, 0, 3, 0, | 803 DEFUN ("read-event", Fread_event, Sread_event, 0, 3, 0, |
804 doc: /* Read an event object from the input stream. | 804 doc: /* Read an event object from the input stream. |
805 If the optional argument PROMPT is non-nil, display that as a prompt. | 805 If the optional argument PROMPT is non-nil, display that as a prompt. |
834 floating-point value. */) | 834 floating-point value. */) |
835 (prompt, inherit_input_method, seconds) | 835 (prompt, inherit_input_method, seconds) |
836 Lisp_Object prompt, inherit_input_method, seconds; | 836 Lisp_Object prompt, inherit_input_method, seconds; |
837 { | 837 { |
838 Lisp_Object val; | 838 Lisp_Object val; |
839 int c; | |
840 | 839 |
841 if (! NILP (prompt)) | 840 if (! NILP (prompt)) |
842 message_with_string ("%s", prompt, 0); | 841 message_with_string ("%s", prompt, 0); |
842 | |
843 val = read_filtered_event (1, 1, 0, ! NILP (inherit_input_method), seconds); | 843 val = read_filtered_event (1, 1, 0, ! NILP (inherit_input_method), seconds); |
844 c = XINT (val); | 844 |
845 return make_number (char_resolve_modifier_mask (c)); | 845 return (NILP (val) ? Qnil |
846 : make_number (char_resolve_modifier_mask (XINT (val)))); | |
846 } | 847 } |
847 | 848 |
848 DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0, | 849 DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0, |
849 doc: /* Don't use this yourself. */) | 850 doc: /* Don't use this yourself. */) |
850 () | 851 () |