diff options
| author | Richard M. Stallman | 1998-08-18 09:00:14 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-08-18 09:00:14 +0000 |
| commit | bb49a192245a1a8d8b5f1f53d9895edc32b80f2a (patch) | |
| tree | a35581891acdd55a68b9e145ce7a96a0742f30f2 /src/lread.c | |
| parent | dcb6bf2b6fd0f4dc2aa3b57efde1badaf1717bd3 (diff) | |
| download | emacs-bb49a192245a1a8d8b5f1f53d9895edc32b80f2a.tar.gz emacs-bb49a192245a1a8d8b5f1f53d9895edc32b80f2a.zip | |
(read_filtered_event): New arg INPUT_METHOD. Calls changed.
(Fread_event): New args PROMPT and SUPPRESS-INPUT-METHOD.
(Fread_char, Fread_char_exclusive): Likewise.
Diffstat (limited to 'src/lread.c')
| -rw-r--r-- | src/lread.c | 58 |
1 files changed, 42 insertions, 16 deletions
diff --git a/src/lread.c b/src/lread.c index ead6e87e59a..8ff3bd4206d 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -423,11 +423,15 @@ extern Lisp_Object read_char (); | |||
| 423 | If ERROR_NONASCII is non-zero, we signal an error if the input we | 423 | If ERROR_NONASCII is non-zero, we signal an error if the input we |
| 424 | get isn't an ASCII character with modifiers. If it's zero but | 424 | get isn't an ASCII character with modifiers. If it's zero but |
| 425 | ASCII_REQUIRED is non-zero, we just re-read until we get an ASCII | 425 | ASCII_REQUIRED is non-zero, we just re-read until we get an ASCII |
| 426 | character. */ | 426 | character. |
| 427 | |||
| 428 | If INPUT_METHOD is nonzero, we invoke the current input method | ||
| 429 | if the character warrants that. */ | ||
| 427 | 430 | ||
| 428 | Lisp_Object | 431 | Lisp_Object |
| 429 | read_filtered_event (no_switch_frame, ascii_required, error_nonascii) | 432 | read_filtered_event (no_switch_frame, ascii_required, error_nonascii, |
| 430 | int no_switch_frame, ascii_required, error_nonascii; | 433 | input_method) |
| 434 | int no_switch_frame, ascii_required, error_nonascii, input_method; | ||
| 431 | { | 435 | { |
| 432 | #ifdef standalone | 436 | #ifdef standalone |
| 433 | return make_number (getchar ()); | 437 | return make_number (getchar ()); |
| @@ -438,7 +442,9 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii) | |||
| 438 | 442 | ||
| 439 | /* Read until we get an acceptable event. */ | 443 | /* Read until we get an acceptable event. */ |
| 440 | retry: | 444 | retry: |
| 441 | val = read_char (0, 0, 0, Qnil, 0); | 445 | val = read_char (0, 0, 0, |
| 446 | (input_method ? Qnil : Qt), | ||
| 447 | 0); | ||
| 442 | 448 | ||
| 443 | if (BUFFERP (val)) | 449 | if (BUFFERP (val)) |
| 444 | goto retry; | 450 | goto retry; |
| @@ -493,7 +499,7 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii) | |||
| 493 | #endif | 499 | #endif |
| 494 | } | 500 | } |
| 495 | 501 | ||
| 496 | DEFUN ("read-char", Fread_char, Sread_char, 0, 0, 0, | 502 | DEFUN ("read-char", Fread_char, Sread_char, 0, 2, 0, |
| 497 | "Read a character from the command input (keyboard or macro).\n\ | 503 | "Read a character from the command input (keyboard or macro).\n\ |
| 498 | It is returned as a number.\n\ | 504 | It is returned as a number.\n\ |
| 499 | If the user generates an event which is not a character (i.e. a mouse\n\ | 505 | If the user generates an event which is not a character (i.e. a mouse\n\ |
| @@ -501,25 +507,45 @@ click or function key event), `read-char' signals an error. As an\n\ | |||
| 501 | exception, switch-frame events are put off until non-ASCII events can\n\ | 507 | exception, switch-frame events are put off until non-ASCII events can\n\ |
| 502 | be read.\n\ | 508 | be read.\n\ |
| 503 | If you want to read non-character events, or ignore them, call\n\ | 509 | If you want to read non-character events, or ignore them, call\n\ |
| 504 | `read-event' or `read-char-exclusive' instead.") | 510 | `read-event' or `read-char-exclusive' instead.\n\ |
| 505 | () | 511 | \n\ |
| 512 | If the optional argument PROMPT is non-nil, display that as a prompt.\n\ | ||
| 513 | If the optional argument SUPPRESS-INPUT-METHOD is non-nil,\n\ | ||
| 514 | disable input method processing for this character.") | ||
| 515 | (prompt, suppress_input_method) | ||
| 516 | Lisp_Object prompt, suppress_input_method; | ||
| 506 | { | 517 | { |
| 507 | return read_filtered_event (1, 1, 1); | 518 | if (! NILP (prompt)) |
| 519 | message_with_string ("%s", prompt, 0); | ||
| 520 | return read_filtered_event (1, 1, 1, NILP (suppress_input_method)); | ||
| 508 | } | 521 | } |
| 509 | 522 | ||
| 510 | DEFUN ("read-event", Fread_event, Sread_event, 0, 0, 0, | 523 | DEFUN ("read-event", Fread_event, Sread_event, 0, 2, 0, |
| 511 | "Read an event object from the input stream.") | 524 | "Read an event object from the input stream.\n\ |
| 512 | () | 525 | If the optional argument PROMPT is non-nil, display that as a prompt.\n\ |
| 526 | If the optional argument SUPPRESS-INPUT-METHOD is non-nil,\n\ | ||
| 527 | disable input method processing for this character.") | ||
| 528 | (prompt, suppress_input_method) | ||
| 529 | Lisp_Object prompt, suppress_input_method; | ||
| 513 | { | 530 | { |
| 514 | return read_filtered_event (0, 0, 0); | 531 | if (! NILP (prompt)) |
| 532 | message_with_string ("%s", prompt, 0); | ||
| 533 | return read_filtered_event (0, 0, 0, NILP (suppress_input_method)); | ||
| 515 | } | 534 | } |
| 516 | 535 | ||
| 517 | DEFUN ("read-char-exclusive", Fread_char_exclusive, Sread_char_exclusive, 0, 0, 0, | 536 | DEFUN ("read-char-exclusive", Fread_char_exclusive, Sread_char_exclusive, 0, 2, 0, |
| 518 | "Read a character from the command input (keyboard or macro).\n\ | 537 | "Read a character from the command input (keyboard or macro).\n\ |
| 519 | It is returned as a number. Non-character events are ignored.") | 538 | It is returned as a number. Non-character events are ignored.\n\ |
| 520 | () | 539 | \n\ |
| 540 | If the optional argument PROMPT is non-nil, display that as a prompt.\n\ | ||
| 541 | If the optional argument SUPPRESS-INPUT-METHOD is non-nil,\n\ | ||
| 542 | disable input method processing for this character.") | ||
| 543 | (prompt, suppress_input_method) | ||
| 544 | Lisp_Object prompt, suppress_input_method; | ||
| 521 | { | 545 | { |
| 522 | return read_filtered_event (1, 1, 0); | 546 | if (! NILP (prompt)) |
| 547 | message_with_string ("%s", prompt, 0); | ||
| 548 | return read_filtered_event (1, 1, 0, NILP (suppress_input_method)); | ||
| 523 | } | 549 | } |
| 524 | 550 | ||
| 525 | DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0, | 551 | DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0, |