[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/keyboard.c,v
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] Changes to emacs/src/keyboard.c,v |
Date: |
Wed, 26 Jul 2006 18:13:34 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Chong Yidong <cyd> 06/07/26 18:13:34
Index: keyboard.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/keyboard.c,v
retrieving revision 1.860
retrieving revision 1.861
diff -u -b -r1.860 -r1.861
--- keyboard.c 18 Jul 2006 13:28:16 -0000 1.860
+++ keyboard.c 26 Jul 2006 18:13:33 -0000 1.861
@@ -2385,15 +2385,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 +2678,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 +2861,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 +3210,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 +3220,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 +3899,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 +3946,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);
- }
#endif /* not VMS */
}
@@ -8282,7 +8308,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 +8681,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 +8884,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.
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Eli Zaretskii, 2006/07/07
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Chong Yidong, 2006/07/10
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Kim F. Storm, 2006/07/11
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Kim F. Storm, 2006/07/12
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Richard M. Stallman, 2006/07/17
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Kim F. Storm, 2006/07/18
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v,
Chong Yidong <=
- [Emacs-diffs] Changes to emacs/src/keyboard.c,v, Richard M. Stallman, 2006/07/28