Mercurial > emacs
diff src/keyboard.c @ 90573:858cb33ae39d
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 357-381)
- Merge from gnus--rel--5.10
- Update from CVS
- Merge from erc--emacs--21
* gnus--rel--5.10 (patch 116-122)
- Update from CVS
- Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-98
author | Miles Bader <miles@gnu.org> |
---|---|
date | Thu, 03 Aug 2006 11:45:23 +0000 |
parents | 8a8e69664178 4c683d3ba427 |
children | 7f3f771c85fa |
line wrap: on
line diff
--- a/src/keyboard.c Thu Aug 03 00:41:54 2006 +0000 +++ b/src/keyboard.c Thu Aug 03 11:45:23 2006 +0000 @@ -2032,6 +2032,8 @@ safe_run_hooks_1 (hook) Lisp_Object hook; { + if (NILP (Vrun_hooks)) + return Qnil; return call1 (Vrun_hooks, Vinhibit_quit); } @@ -2385,15 +2387,20 @@ if we used a mouse menu to read the input, or zero otherwise. If USED_MOUSE_MENU is null, we don't dereference it. + If END_TIME is non-null, it is a pointer to an EMACS_TIME + specifying the maximum time to wait until. If no input arrives by + that time, stop waiting and return nil. + Value is t if we showed a menu and the user rejected it. */ Lisp_Object -read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) +read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) int commandflag; int nmaps; Lisp_Object *maps; Lisp_Object prev_event; int *used_mouse_menu; + EMACS_TIME *end_time; { volatile Lisp_Object c; int count; @@ -2673,6 +2680,7 @@ start echoing if enough time elapses. */ if (minibuf_level == 0 + && !end_time && !current_kboard->immediate_echo && this_command_key_count > 0 && ! noninteractive @@ -2855,11 +2863,19 @@ { KBOARD *kb; + if (end_time) + { + EMACS_TIME now; + EMACS_GET_TIME (now); + if (EMACS_TIME_GE (now, *end_time)) + goto exit; + } + /* Actually read a character, waiting if necessary. */ save_getcjmp (save_jump); restore_getcjmp (local_getcjmp); timer_start_idle (); - c = kbd_buffer_get_event (&kb, used_mouse_menu); + c = kbd_buffer_get_event (&kb, used_mouse_menu, end_time); restore_getcjmp (save_jump); #ifdef MULTI_KBOARD @@ -3196,7 +3212,7 @@ cancel_echoing (); do - c = read_char (0, 0, 0, Qnil, 0); + c = read_char (0, 0, 0, Qnil, 0, NULL); while (BUFFERP (c)); /* Remove the help from the frame */ unbind_to (count, Qnil); @@ -3206,7 +3222,7 @@ { cancel_echoing (); do - c = read_char (0, 0, 0, Qnil, 0); + c = read_char (0, 0, 0, Qnil, 0, NULL); while (BUFFERP (c)); } } @@ -3885,9 +3901,10 @@ We always read and discard one event. */ static Lisp_Object -kbd_buffer_get_event (kbp, used_mouse_menu) +kbd_buffer_get_event (kbp, used_mouse_menu, end_time) KBOARD **kbp; int *used_mouse_menu; + EMACS_TIME *end_time; { register int c; Lisp_Object obj; @@ -3931,13 +3948,24 @@ if (!NILP (do_mouse_tracking) && some_mouse_moved ()) break; #endif - { + if (end_time) + { + EMACS_TIME duration; + EMACS_GET_TIME (duration); + EMACS_SUB_TIME (duration, *end_time, duration); + if (EMACS_TIME_NEG_P (duration)) + return Qnil; + else + wait_reading_process_output (EMACS_SECS (duration), + EMACS_USECS (duration), + -1, 1, Qnil, NULL, 0); + } + else wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); - if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr) - /* Pass 1 for EXPECT since we just waited to have input. */ - read_avail_input (1); - } + if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr) + /* Pass 1 for EXPECT since we just waited to have input. */ + read_avail_input (1); #endif /* not VMS */ } @@ -8282,7 +8310,7 @@ orig_defn_macro = current_kboard->defining_kbd_macro; current_kboard->defining_kbd_macro = Qnil; do - obj = read_char (commandflag, 0, 0, Qt, 0); + obj = read_char (commandflag, 0, 0, Qt, 0, NULL); while (BUFFERP (obj)); current_kboard->defining_kbd_macro = orig_defn_macro; @@ -8655,7 +8683,7 @@ /* Read the first char of the sequence specially, before setting up any keymaps, in case a filter runs and switches buffers on us. */ first_event = read_char (NILP (prompt), 0, submaps, last_nonmenu_event, - &junk); + &junk, NULL); #endif /* GOBBLE_FIRST_EVENT */ orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); @@ -8858,7 +8886,7 @@ #endif key = read_char (NILP (prompt), nmaps, (Lisp_Object *) submaps, last_nonmenu_event, - &used_mouse_menu); + &used_mouse_menu, NULL); } /* read_char returns t when it shows a menu and the user rejects it.