diff options
| author | Kenichi Handa | 2008-03-05 04:28:59 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2008-03-05 04:28:59 +0000 |
| commit | fb26c2afce8201277010c833e466585869cd9a5c (patch) | |
| tree | 2d2293f7a84b2f102a36dc0644f03ae3118e821c /src | |
| parent | c571ad7c4394cab5ae7d0f6e2c1bacb4d5826409 (diff) | |
| download | emacs-fb26c2afce8201277010c833e466585869cd9a5c.tar.gz emacs-fb26c2afce8201277010c833e466585869cd9a5c.zip | |
(Fread_char): Resolve modifiers.
(Fread_char_exclusive): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lread.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/lread.c b/src/lread.c index dc8684eb05c..c1ee53056ac 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -771,10 +771,13 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii, | |||
| 771 | DEFUN ("read-char", Fread_char, Sread_char, 0, 3, 0, | 771 | DEFUN ("read-char", Fread_char, Sread_char, 0, 3, 0, |
| 772 | doc: /* Read a character from the command input (keyboard or macro). | 772 | doc: /* Read a character from the command input (keyboard or macro). |
| 773 | It is returned as a number. | 773 | It is returned as a number. |
| 774 | If the character has modifiers, they are resolved and reflected to the | ||
| 775 | character code if possible (e.g. C-SPC -> 0). | ||
| 776 | |||
| 774 | If the user generates an event which is not a character (i.e. a mouse | 777 | If the user generates an event which is not a character (i.e. a mouse |
| 775 | click or function key event), `read-char' signals an error. As an | 778 | click or function key event), `read-char' signals an error. As an |
| 776 | exception, switch-frame events are put off until non-ASCII events can | 779 | exception, switch-frame events are put off until non-character events |
| 777 | be read. | 780 | can be read. |
| 778 | If you want to read non-character events, or ignore them, call | 781 | If you want to read non-character events, or ignore them, call |
| 779 | `read-event' or `read-char-exclusive' instead. | 782 | `read-event' or `read-char-exclusive' instead. |
| 780 | 783 | ||
| @@ -789,9 +792,14 @@ floating-point value. */) | |||
| 789 | (prompt, inherit_input_method, seconds) | 792 | (prompt, inherit_input_method, seconds) |
| 790 | Lisp_Object prompt, inherit_input_method, seconds; | 793 | Lisp_Object prompt, inherit_input_method, seconds; |
| 791 | { | 794 | { |
| 795 | Lisp_Object val; | ||
| 796 | int c; | ||
| 797 | |||
| 792 | if (! NILP (prompt)) | 798 | if (! NILP (prompt)) |
| 793 | message_with_string ("%s", prompt, 0); | 799 | message_with_string ("%s", prompt, 0); |
| 794 | return read_filtered_event (1, 1, 1, ! NILP (inherit_input_method), seconds); | 800 | val = read_filtered_event (1, 1, 1, ! NILP (inherit_input_method), seconds); |
| 801 | c = XINT (val); | ||
| 802 | return make_number (char_resolve_modifier_mask (c)); | ||
| 795 | } | 803 | } |
| 796 | 804 | ||
| 797 | DEFUN ("read-event", Fread_event, Sread_event, 0, 3, 0, | 805 | DEFUN ("read-event", Fread_event, Sread_event, 0, 3, 0, |
| @@ -815,6 +823,8 @@ floating-point value. */) | |||
| 815 | DEFUN ("read-char-exclusive", Fread_char_exclusive, Sread_char_exclusive, 0, 3, 0, | 823 | DEFUN ("read-char-exclusive", Fread_char_exclusive, Sread_char_exclusive, 0, 3, 0, |
| 816 | doc: /* Read a character from the command input (keyboard or macro). | 824 | doc: /* Read a character from the command input (keyboard or macro). |
| 817 | It is returned as a number. Non-character events are ignored. | 825 | It is returned as a number. Non-character events are ignored. |
| 826 | If the character has modifiers, they are resolved and reflected to the | ||
| 827 | character code if possible (e.g. C-SPC -> 0). | ||
| 818 | 828 | ||
| 819 | If the optional argument PROMPT is non-nil, display that as a prompt. | 829 | If the optional argument PROMPT is non-nil, display that as a prompt. |
| 820 | If the optional argument INHERIT-INPUT-METHOD is non-nil and some | 830 | If the optional argument INHERIT-INPUT-METHOD is non-nil and some |
| @@ -827,9 +837,14 @@ floating-point value. */) | |||
| 827 | (prompt, inherit_input_method, seconds) | 837 | (prompt, inherit_input_method, seconds) |
| 828 | Lisp_Object prompt, inherit_input_method, seconds; | 838 | Lisp_Object prompt, inherit_input_method, seconds; |
| 829 | { | 839 | { |
| 840 | Lisp_Object val; | ||
| 841 | int c; | ||
| 842 | |||
| 830 | if (! NILP (prompt)) | 843 | if (! NILP (prompt)) |
| 831 | message_with_string ("%s", prompt, 0); | 844 | message_with_string ("%s", prompt, 0); |
| 832 | return read_filtered_event (1, 1, 0, ! NILP (inherit_input_method), seconds); | 845 | val = read_filtered_event (1, 1, 0, ! NILP (inherit_input_method), seconds); |
| 846 | c = XINT (val); | ||
| 847 | return make_number (char_resolve_modifier_mask (c)); | ||
| 833 | } | 848 | } |
| 834 | 849 | ||
| 835 | DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0, | 850 | DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0, |