diff options
| author | Kim F. Storm | 2006-07-11 20:10:56 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2006-07-11 20:10:56 +0000 |
| commit | 666dc232b0361c65e3a22cfa16bf733a6c043c1b (patch) | |
| tree | 7140666183e3ef4760cf242c600f032924b2688c /src | |
| parent | 7ca462f695b60384865a9458a7abe79098a0d679 (diff) | |
| download | emacs-666dc232b0361c65e3a22cfa16bf733a6c043c1b.tar.gz emacs-666dc232b0361c65e3a22cfa16bf733a6c043c1b.zip | |
(command_loop_1, read_char, Fexecute_extended_command):
Update/simplify sit_for calls.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 50 |
1 files changed, 16 insertions, 34 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index b955daa41d9..5e808739d6b 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -1488,11 +1488,10 @@ command_loop_1 () | |||
| 1488 | /* Bind inhibit-quit to t so that C-g gets read in | 1488 | /* Bind inhibit-quit to t so that C-g gets read in |
| 1489 | rather than quitting back to the minibuffer. */ | 1489 | rather than quitting back to the minibuffer. */ |
| 1490 | int count = SPECPDL_INDEX (); | 1490 | int count = SPECPDL_INDEX (); |
| 1491 | double duration = extract_float (Vminibuffer_message_timeout); | ||
| 1492 | specbind (Qinhibit_quit, Qt); | 1491 | specbind (Qinhibit_quit, Qt); |
| 1493 | 1492 | ||
| 1494 | sit_for ((int) duration, (duration - (int) duration) * 1000000, | 1493 | sit_for (Vminibuffer_message_timeout, 0, 2); |
| 1495 | 0, Qt, Qt); | 1494 | |
| 1496 | /* Clear the echo area. */ | 1495 | /* Clear the echo area. */ |
| 1497 | message2 (0, 0, 0); | 1496 | message2 (0, 0, 0); |
| 1498 | safe_run_hooks (Qecho_area_clear_hook); | 1497 | safe_run_hooks (Qecho_area_clear_hook); |
| @@ -2691,8 +2690,6 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2691 | /* Or not echoing before and echoing allowed. */ | 2690 | /* Or not echoing before and echoing allowed. */ |
| 2692 | || (!echo_kboard && ok_to_echo_at_next_pause))) | 2691 | || (!echo_kboard && ok_to_echo_at_next_pause))) |
| 2693 | { | 2692 | { |
| 2694 | Lisp_Object tem0; | ||
| 2695 | |||
| 2696 | /* After a mouse event, start echoing right away. | 2693 | /* After a mouse event, start echoing right away. |
| 2697 | This is because we are probably about to display a menu, | 2694 | This is because we are probably about to display a menu, |
| 2698 | and we don't want to delay before doing so. */ | 2695 | and we don't want to delay before doing so. */ |
| @@ -2700,13 +2697,11 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2700 | echo_now (); | 2697 | echo_now (); |
| 2701 | else | 2698 | else |
| 2702 | { | 2699 | { |
| 2703 | int sec, usec; | 2700 | Lisp_Object tem0; |
| 2704 | double duration = extract_float (Vecho_keystrokes); | 2701 | |
| 2705 | sec = (int) duration; | ||
| 2706 | usec = (duration - sec) * 1000000; | ||
| 2707 | save_getcjmp (save_jump); | 2702 | save_getcjmp (save_jump); |
| 2708 | restore_getcjmp (local_getcjmp); | 2703 | restore_getcjmp (local_getcjmp); |
| 2709 | tem0 = sit_for (sec, usec, 1, 1, 0); | 2704 | tem0 = sit_for (Vecho_keystrokes, 1, 1); |
| 2710 | restore_getcjmp (save_jump); | 2705 | restore_getcjmp (save_jump); |
| 2711 | if (EQ (tem0, Qt) | 2706 | if (EQ (tem0, Qt) |
| 2712 | && ! CONSP (Vunread_command_events)) | 2707 | && ! CONSP (Vunread_command_events)) |
| @@ -2773,11 +2768,11 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2773 | && XINT (Vauto_save_timeout) > 0) | 2768 | && XINT (Vauto_save_timeout) > 0) |
| 2774 | { | 2769 | { |
| 2775 | Lisp_Object tem0; | 2770 | Lisp_Object tem0; |
| 2771 | int timeout = delay_level * XFASTINT (Vauto_save_timeout) / 4; | ||
| 2776 | 2772 | ||
| 2777 | save_getcjmp (save_jump); | 2773 | save_getcjmp (save_jump); |
| 2778 | restore_getcjmp (local_getcjmp); | 2774 | restore_getcjmp (local_getcjmp); |
| 2779 | tem0 = sit_for (delay_level * XFASTINT (Vauto_save_timeout) / 4, | 2775 | tem0 = sit_for (make_number (timeout), 1, 1); |
| 2780 | 0, 1, 1, 0); | ||
| 2781 | restore_getcjmp (save_jump); | 2776 | restore_getcjmp (save_jump); |
| 2782 | 2777 | ||
| 2783 | if (EQ (tem0, Qt) | 2778 | if (EQ (tem0, Qt) |
| @@ -9884,22 +9879,14 @@ give to the command you invoke, if it asks for an argument. */) | |||
| 9884 | /* But first wait, and skip the message if there is input. */ | 9879 | /* But first wait, and skip the message if there is input. */ |
| 9885 | Lisp_Object waited; | 9880 | Lisp_Object waited; |
| 9886 | 9881 | ||
| 9887 | if (!NILP (echo_area_buffer[0])) | 9882 | /* If this command displayed something in the echo area; |
| 9888 | { | 9883 | wait a few seconds, then display our suggestion message. */ |
| 9889 | /* This command displayed something in the echo area; | 9884 | if (NILP (echo_area_buffer[0])) |
| 9890 | so wait a few seconds, then display our suggestion message. */ | 9885 | waited = sit_for (make_number (0), 0, 2); |
| 9891 | if (NUMBERP (Vsuggest_key_bindings)) | 9886 | else if (NUMBERP (Vsuggest_key_bindings)) |
| 9892 | { | 9887 | waited = sit_for (Vminibuffer_message_timeout, 0, 2); |
| 9893 | double duration = extract_float (Vminibuffer_message_timeout); | ||
| 9894 | waited = sit_for ((int) duration, | ||
| 9895 | (duration - (int) duration) * 1000000, | ||
| 9896 | 0, Qt, Qt); | ||
| 9897 | } | ||
| 9898 | else | ||
| 9899 | waited = sit_for (2, 0, 0, Qt, Qt); | ||
| 9900 | } | ||
| 9901 | else | 9888 | else |
| 9902 | waited = sit_for (0, 0, 0, Qt, Qt); | 9889 | waited = sit_for (make_number (2), 0, 2); |
| 9903 | 9890 | ||
| 9904 | if (!NILP (waited) && ! CONSP (Vunread_command_events)) | 9891 | if (!NILP (waited) && ! CONSP (Vunread_command_events)) |
| 9905 | { | 9892 | { |
| @@ -9922,14 +9909,9 @@ give to the command you invoke, if it asks for an argument. */) | |||
| 9922 | strlen (newmessage), | 9909 | strlen (newmessage), |
| 9923 | STRING_MULTIBYTE (binding)); | 9910 | STRING_MULTIBYTE (binding)); |
| 9924 | if (NUMBERP (Vsuggest_key_bindings)) | 9911 | if (NUMBERP (Vsuggest_key_bindings)) |
| 9925 | { | 9912 | waited = sit_for (Vsuggest_key_bindings, 0, 2); |
| 9926 | double duration = extract_float (Vsuggest_key_bindings); | ||
| 9927 | waited = sit_for ((int) duration, | ||
| 9928 | (duration - (int) duration) * 1000000, | ||
| 9929 | 0, Qt, Qt); | ||
| 9930 | } | ||
| 9931 | else | 9913 | else |
| 9932 | waited = sit_for (2, 0, 0, Qt, Qt); | 9914 | waited = sit_for (make_number (2), 0, 2); |
| 9933 | 9915 | ||
| 9934 | if (!NILP (waited) && message_p) | 9916 | if (!NILP (waited) && message_p) |
| 9935 | restore_message (); | 9917 | restore_message (); |