diff options
| author | Richard M. Stallman | 1996-04-12 06:01:29 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-04-12 06:01:29 +0000 |
| commit | 4ec4ed6a5e1822f2fcef1e05fa2ea743fc0fb467 (patch) | |
| tree | a3799b81ce7ecdff638156e11b3579d4f2eaeabb | |
| parent | 9f083d57ee959a8390a457ffce173be6851bb222 (diff) | |
| download | emacs-4ec4ed6a5e1822f2fcef1e05fa2ea743fc0fb467.tar.gz emacs-4ec4ed6a5e1822f2fcef1e05fa2ea743fc0fb467.zip | |
(read_char): Use detect_input_pending_run_timers
before redisplay, not detect_input_pending.
(readable_events): Don't touch timers at all if DO_TIMERS_NOW is 0.
(timer_check): Always run timers directly.
Bind inhibit-quit to t here.
| -rw-r--r-- | src/keyboard.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 15f8eed53cb..4d570cf6b4c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -1747,7 +1747,8 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1747 | goto reread_first; | 1747 | goto reread_first; |
| 1748 | } | 1748 | } |
| 1749 | 1749 | ||
| 1750 | if (commandflag >= 0 && !input_pending && !detect_input_pending ()) | 1750 | if (commandflag >= 0 && !input_pending |
| 1751 | && !detect_input_pending_run_timers (0)) | ||
| 1751 | redisplay (); | 1752 | redisplay (); |
| 1752 | 1753 | ||
| 1753 | /* Message turns off echoing unless more keystrokes turn it on again. */ | 1754 | /* Message turns off echoing unless more keystrokes turn it on again. */ |
| @@ -1770,7 +1771,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1770 | /* Don't bring up a menu if we already have another event. */ | 1771 | /* Don't bring up a menu if we already have another event. */ |
| 1771 | && NILP (Vunread_command_events) | 1772 | && NILP (Vunread_command_events) |
| 1772 | && unread_command_char < 0 | 1773 | && unread_command_char < 0 |
| 1773 | && !detect_input_pending ()) | 1774 | && !detect_input_pending_run_timers (0)) |
| 1774 | { | 1775 | { |
| 1775 | c = read_char_minibuf_menu_prompt (commandflag, nmaps, maps); | 1776 | c = read_char_minibuf_menu_prompt (commandflag, nmaps, maps); |
| 1776 | if (! NILP (c)) | 1777 | if (! NILP (c)) |
| @@ -1856,7 +1857,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1856 | if (commandflag != 0 | 1857 | if (commandflag != 0 |
| 1857 | && auto_save_interval > 0 | 1858 | && auto_save_interval > 0 |
| 1858 | && num_nonmacro_input_chars - last_auto_save > max (auto_save_interval, 20) | 1859 | && num_nonmacro_input_chars - last_auto_save > max (auto_save_interval, 20) |
| 1859 | && !detect_input_pending ()) | 1860 | && !detect_input_pending_run_timers (0)) |
| 1860 | { | 1861 | { |
| 1861 | Fdo_auto_save (Qnil, Qnil); | 1862 | Fdo_auto_save (Qnil, Qnil); |
| 1862 | /* Hooks can actually change some buffers in auto save. */ | 1863 | /* Hooks can actually change some buffers in auto save. */ |
| @@ -1916,7 +1917,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1916 | /* If we have auto-saved and there is still no input | 1917 | /* If we have auto-saved and there is still no input |
| 1917 | available, garbage collect if there has been enough | 1918 | available, garbage collect if there has been enough |
| 1918 | consing going on to make it worthwhile. */ | 1919 | consing going on to make it worthwhile. */ |
| 1919 | if (!detect_input_pending () | 1920 | if (!detect_input_pending_run_timers (0) |
| 1920 | && consing_since_gc > gc_cons_threshold / 2) | 1921 | && consing_since_gc > gc_cons_threshold / 2) |
| 1921 | Fgarbage_collect (); | 1922 | Fgarbage_collect (); |
| 1922 | 1923 | ||
| @@ -2027,7 +2028,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2027 | non_reread: | 2028 | non_reread: |
| 2028 | 2029 | ||
| 2029 | /* Now that we have read an event, Emacs is not idle-- | 2030 | /* Now that we have read an event, Emacs is not idle-- |
| 2030 | unless the event was a timer event. */ | 2031 | unless the event was a timer event (not used now). */ |
| 2031 | if (! (CONSP (c) && EQ (XCONS (c)->car, Qtimer_event))) | 2032 | if (! (CONSP (c) && EQ (XCONS (c)->car, Qtimer_event))) |
| 2032 | timer_stop_idle (); | 2033 | timer_stop_idle (); |
| 2033 | 2034 | ||
| @@ -2036,7 +2037,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2036 | if (NILP (c)) | 2037 | if (NILP (c)) |
| 2037 | { | 2038 | { |
| 2038 | if (commandflag >= 0 | 2039 | if (commandflag >= 0 |
| 2039 | && !input_pending && !detect_input_pending ()) | 2040 | && !input_pending && !detect_input_pending_run_timers (0)) |
| 2040 | redisplay (); | 2041 | redisplay (); |
| 2041 | 2042 | ||
| 2042 | goto wrong_kboard; | 2043 | goto wrong_kboard; |
| @@ -2354,7 +2355,9 @@ static int | |||
| 2354 | readable_events (do_timers_now) | 2355 | readable_events (do_timers_now) |
| 2355 | int do_timers_now; | 2356 | int do_timers_now; |
| 2356 | { | 2357 | { |
| 2357 | timer_check (do_timers_now); | 2358 | if (do_timers_now) |
| 2359 | timer_check (do_timers_now); | ||
| 2360 | |||
| 2358 | if (kbd_fetch_ptr != kbd_store_ptr) | 2361 | if (kbd_fetch_ptr != kbd_store_ptr) |
| 2359 | return 1; | 2362 | return 1; |
| 2360 | #ifdef HAVE_MOUSE | 2363 | #ifdef HAVE_MOUSE |
| @@ -2860,6 +2863,7 @@ swallow_events (do_display) | |||
| 2860 | abort (); | 2863 | abort (); |
| 2861 | #endif | 2864 | #endif |
| 2862 | } | 2865 | } |
| 2866 | /* Note that timer_event is currently never used. */ | ||
| 2863 | else if (event->kind == timer_event) | 2867 | else if (event->kind == timer_event) |
| 2864 | { | 2868 | { |
| 2865 | Lisp_Object tem, lisp_event; | 2869 | Lisp_Object tem, lisp_event; |
| @@ -2939,8 +2943,11 @@ struct input_event last_timer_event; | |||
| 2939 | timer is triggering now, return zero seconds. | 2943 | timer is triggering now, return zero seconds. |
| 2940 | If no timer is active, return -1 seconds. | 2944 | If no timer is active, return -1 seconds. |
| 2941 | 2945 | ||
| 2942 | If a timer is ripe now, either queue a timer-event, | 2946 | If a timer is ripe, we run it, with quitting turned off. |
| 2943 | or call the timer's handler function here if DO_IT_NOW is nonzero. */ | 2947 | |
| 2948 | DO_IT_NOW is now ignored. It used to mean that we should | ||
| 2949 | run the timer directly instead of queueing a timer-event. | ||
| 2950 | Now we always run timers directly. */ | ||
| 2944 | 2951 | ||
| 2945 | EMACS_TIME | 2952 | EMACS_TIME |
| 2946 | timer_check (do_it_now) | 2953 | timer_check (do_it_now) |
| @@ -3092,10 +3099,13 @@ timer_check (do_it_now) | |||
| 3092 | vector[0] = Qt; | 3099 | vector[0] = Qt; |
| 3093 | 3100 | ||
| 3094 | /* Run the timer or queue a timer event. */ | 3101 | /* Run the timer or queue a timer event. */ |
| 3095 | if (do_it_now) | 3102 | if (1) |
| 3096 | { | 3103 | { |
| 3097 | Lisp_Object tem, event; | 3104 | Lisp_Object tem, event; |
| 3098 | int was_locked = single_kboard; | 3105 | int was_locked = single_kboard; |
| 3106 | int count = specpdl_ptr - specpdl; | ||
| 3107 | |||
| 3108 | specbind (Qinhibit_quit, Qt); | ||
| 3099 | 3109 | ||
| 3100 | tem = get_keymap_1 (Vspecial_event_map, 0, 0); | 3110 | tem = get_keymap_1 (Vspecial_event_map, 0, 0); |
| 3101 | tem = get_keyelt (access_keymap (tem, Qtimer_event, 0, 0), | 3111 | tem = get_keyelt (access_keymap (tem, Qtimer_event, 0, 0), |
| @@ -3104,6 +3114,8 @@ timer_check (do_it_now) | |||
| 3104 | Fcommand_execute (tem, Qnil, Fvector (1, &event), Qt); | 3114 | Fcommand_execute (tem, Qnil, Fvector (1, &event), Qt); |
| 3105 | timers_run++; | 3115 | timers_run++; |
| 3106 | 3116 | ||
| 3117 | unbind_to (count, Qnil); | ||
| 3118 | |||
| 3107 | /* Resume allowing input from any kboard, if that was true before. */ | 3119 | /* Resume allowing input from any kboard, if that was true before. */ |
| 3108 | if (!was_locked) | 3120 | if (!was_locked) |
| 3109 | any_kboard_state (); | 3121 | any_kboard_state (); |
| @@ -3111,6 +3123,7 @@ timer_check (do_it_now) | |||
| 3111 | /* Since we have handled the event, | 3123 | /* Since we have handled the event, |
| 3112 | we don't need to tell the caller to wake up and do it. */ | 3124 | we don't need to tell the caller to wake up and do it. */ |
| 3113 | } | 3125 | } |
| 3126 | #if 0 | ||
| 3114 | else | 3127 | else |
| 3115 | { | 3128 | { |
| 3116 | /* Generate a timer event so the caller will handle it. */ | 3129 | /* Generate a timer event so the caller will handle it. */ |
| @@ -3138,6 +3151,7 @@ timer_check (do_it_now) | |||
| 3138 | UNGCPRO; | 3151 | UNGCPRO; |
| 3139 | return nexttime; | 3152 | return nexttime; |
| 3140 | } | 3153 | } |
| 3154 | #endif /* 0 */ | ||
| 3141 | } | 3155 | } |
| 3142 | } | 3156 | } |
| 3143 | else | 3157 | else |
| @@ -3637,6 +3651,7 @@ make_lispy_event (event) | |||
| 3637 | / sizeof (lispy_function_keys[0]))); | 3651 | / sizeof (lispy_function_keys[0]))); |
| 3638 | break; | 3652 | break; |
| 3639 | 3653 | ||
| 3654 | /* Note that timer_event is currently never used. */ | ||
| 3640 | case timer_event: | 3655 | case timer_event: |
| 3641 | return Fcons (Qtimer_event, Fcons (Fcdr (event->frame_or_window), Qnil)); | 3656 | return Fcons (Qtimer_event, Fcons (Fcdr (event->frame_or_window), Qnil)); |
| 3642 | 3657 | ||