comparison src/event-stream.c @ 211:78478c60bfcd r20-4b4

Import from CVS: tag r20-4b4
author cvs
date Mon, 13 Aug 2007 10:05:51 +0200
parents 41ff10fd062f
children 78f53ef88e17
comparison
equal deleted inserted replaced
210:49f55ca3ba57 211:78478c60bfcd
177 /* The buffer that was current when the last command was started. */ 177 /* The buffer that was current when the last command was started. */
178 Lisp_Object last_point_position_buffer; 178 Lisp_Object last_point_position_buffer;
179 179
180 /* A (16bit . 16bit) representation of the time of the last-command-event. */ 180 /* A (16bit . 16bit) representation of the time of the last-command-event. */
181 Lisp_Object Vlast_input_time; 181 Lisp_Object Vlast_input_time;
182
183 /* A (16bit 16bit usec) representation of the time
184 of the last-command-event. */
185 Lisp_Object Vlast_command_event_time;
182 186
183 /* Character to recognize as the help char. */ 187 /* Character to recognize as the help char. */
184 Lisp_Object Vhelp_char; 188 Lisp_Object Vhelp_char;
185 189
186 /* Form to execute when help char is typed. */ 190 /* Form to execute when help char is typed. */
345 */ 349 */
346 static Lisp_Object command_event_queue; 350 static Lisp_Object command_event_queue;
347 static Lisp_Object command_event_queue_tail; 351 static Lisp_Object command_event_queue_tail;
348 352
349 /* Nonzero means echo unfinished commands after this many seconds of pause. */ 353 /* Nonzero means echo unfinished commands after this many seconds of pause. */
350 static int echo_keystrokes; 354 static Lisp_Object Vecho_keystrokes;
351 355
352 /* The number of keystrokes since the last auto-save. */ 356 /* The number of keystrokes since the last auto-save. */
353 static int keystrokes_since_auto_save; 357 static int keystrokes_since_auto_save;
354 358
355 /* Used by the C-g signal handler so that it will never "hard quit" 359 /* Used by the C-g signal handler so that it will never "hard quit"
700 704
701 static void 705 static void
702 maybe_echo_keys (struct command_builder *command_builder, int no_snooze) 706 maybe_echo_keys (struct command_builder *command_builder, int no_snooze)
703 { 707 {
704 /* This function can GC */ 708 /* This function can GC */
709 double echo_keystrokes;
705 struct frame *f = selected_frame (); 710 struct frame *f = selected_frame ();
706 /* Message turns off echoing unless more keystrokes turn it on again. */ 711 /* Message turns off echoing unless more keystrokes turn it on again. */
707 if (echo_area_active (f) && !EQ (Qcommand, echo_area_status (f))) 712 if (echo_area_active (f) && !EQ (Qcommand, echo_area_status (f)))
708 return; 713 return;
709 714
715 if (INTP (Vecho_keystrokes) || FLOATP (Vecho_keystrokes))
716 echo_keystrokes = extract_float (Vecho_keystrokes);
717 else
718 echo_keystrokes = 0;
719
710 if (minibuf_level == 0 720 if (minibuf_level == 0
711 && echo_keystrokes > 0 721 && echo_keystrokes > 0.0
712 && !lw_menu_active) 722 && !lw_menu_active)
713 { 723 {
714 if (!no_snooze) 724 if (!no_snooze)
715 { 725 {
716 /* #### C-g here will cause QUIT. Setting dont_check_for_quit 726 /* #### C-g here will cause QUIT. Setting dont_check_for_quit
717 doesn't work. See check_quit. */ 727 doesn't work. See check_quit. */
718 if (NILP (Fsit_for (make_int (echo_keystrokes), Qnil))) 728 if (NILP (Fsit_for (Vecho_keystrokes, Qnil)))
719 /* input came in, so don't echo. */ 729 /* input came in, so don't echo. */
720 return; 730 return;
721 } 731 }
722 732
723 echo_area_message (f, command_builder->echo_buf, Qnil, 0, 733 echo_area_message (f, command_builder->echo_buf, Qnil, 0,
2215 EMACS_GET_TIME (t); 2225 EMACS_GET_TIME (t);
2216 if (!CONSP (Vlast_input_time)) 2226 if (!CONSP (Vlast_input_time))
2217 Vlast_input_time = Fcons (Qnil, Qnil); 2227 Vlast_input_time = Fcons (Qnil, Qnil);
2218 XCAR (Vlast_input_time) = make_int ((EMACS_SECS (t) >> 16) & 0xffff); 2228 XCAR (Vlast_input_time) = make_int ((EMACS_SECS (t) >> 16) & 0xffff);
2219 XCDR (Vlast_input_time) = make_int ((EMACS_SECS (t) >> 0) & 0xffff); 2229 XCDR (Vlast_input_time) = make_int ((EMACS_SECS (t) >> 0) & 0xffff);
2230 if (!CONSP (Vlast_command_event_time))
2231 Vlast_command_event_time = list3 (Qnil, Qnil, Qnil);
2232 XCAR (Vlast_command_event_time) =
2233 make_int ((EMACS_SECS (t) >> 16) & 0xffff);
2234 XCAR (XCDR (Vlast_command_event_time)) =
2235 make_int ((EMACS_SECS (t) >> 0) & 0xffff);
2236 XCAR (XCDR (XCDR (Vlast_command_event_time)))
2237 = make_int (EMACS_USECS (t));
2220 } 2238 }
2221 2239
2222 /* If this key came from the keyboard or from a keyboard macro, then 2240 /* If this key came from the keyboard or from a keyboard macro, then
2223 it goes into the recent-keys and this-command-keys vectors. 2241 it goes into the recent-keys and this-command-keys vectors.
2224 If this key came from the keyboard, and we're defining a keyboard 2242 If this key came from the keyboard, and we're defining a keyboard
4916 last_point_position_buffer = Qnil; 4934 last_point_position_buffer = Qnil;
4917 staticpro (&last_point_position_buffer); 4935 staticpro (&last_point_position_buffer);
4918 4936
4919 recursive_sit_for = Qnil; 4937 recursive_sit_for = Qnil;
4920 4938
4921 DEFVAR_INT ("echo-keystrokes", &echo_keystrokes /* 4939 DEFVAR_LISP ("echo-keystrokes", &Vecho_keystrokes /*
4922 *Nonzero means echo unfinished commands after this many seconds of pause. 4940 *Nonzero means echo unfinished commands after this many seconds of pause.
4923 */ ); 4941 */ );
4924 echo_keystrokes = 1; 4942 Vecho_keystrokes = make_int (1);
4925 4943
4926 DEFVAR_INT ("auto-save-interval", &auto_save_interval /* 4944 DEFVAR_INT ("auto-save-interval", &auto_save_interval /*
4927 *Number of keyboard input characters between auto-saves. 4945 *Number of keyboard input characters between auto-saves.
4928 Zero means disable autosaving due to number of characters typed. 4946 Zero means disable autosaving due to number of characters typed.
4929 See also the variable `auto-save-timeout'. 4947 See also the variable `auto-save-timeout'.
5047 The time (in seconds since Jan 1, 1970) of the last-command-event, 5065 The time (in seconds since Jan 1, 1970) of the last-command-event,
5048 represented as a cons of two 16-bit integers. This is destructively 5066 represented as a cons of two 16-bit integers. This is destructively
5049 modified, so copy it if you want to keep it. 5067 modified, so copy it if you want to keep it.
5050 */ ); 5068 */ );
5051 Vlast_input_time = Qnil; 5069 Vlast_input_time = Qnil;
5070
5071 DEFVAR_LISP ("last-command-event-time", &Vlast_command_event_time /*
5072 The time (in seconds since Jan 1, 1970) of the last-command-event,
5073 represented as a list of three integers. The first integer contains
5074 the most significant 16 bits of the number of seconds, and the second
5075 integer contains the least significant 16 bits. The third integer
5076 contains the remainder number of microseconds, if the current system
5077 supports microsecond clock resolution. This list is destructively
5078 modified, so copy it if you want to keep it.
5079 */ );
5080 Vlast_command_event_time = Qnil;
5052 5081
5053 DEFVAR_LISP ("unread-command-events", &Vunread_command_events /* 5082 DEFVAR_LISP ("unread-command-events", &Vunread_command_events /*
5054 List of event objects to be read as next command input events. 5083 List of event objects to be read as next command input events.
5055 This can be used to simulate the receipt of events from the user. 5084 This can be used to simulate the receipt of events from the user.
5056 Normally this is nil. 5085 Normally this is nil.