Mercurial > hg > xemacs-beta
comparison src/event-stream.c @ 20:859a2309aef8 r19-15b93
Import from CVS: tag r19-15b93
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:50:05 +0200 |
parents | 0293115a14e9 |
children | ec9a17fef872 |
comparison
equal
deleted
inserted
replaced
19:ac1f612d5250 | 20:859a2309aef8 |
---|---|
249 keyboard and mouse events by pushing them here. | 249 keyboard and mouse events by pushing them here. |
250 | 250 |
251 Chained through event_next() | 251 Chained through event_next() |
252 command_event_queue_tail is a pointer to the last-added element. | 252 command_event_queue_tail is a pointer to the last-added element. |
253 */ | 253 */ |
254 static Lisp_Object process_event_queue; | |
255 static Lisp_Object process_event_queue_tail; | |
254 static Lisp_Object command_event_queue; | 256 static Lisp_Object command_event_queue; |
255 static Lisp_Object command_event_queue_tail; | 257 static Lisp_Object command_event_queue_tail; |
256 | 258 |
257 /* Nonzero means echo unfinished commands after this many seconds of pause. */ | 259 /* Nonzero means echo unfinished commands after this many seconds of pause. */ |
258 static int echo_keystrokes; | 260 static int echo_keystrokes; |
855 } | 857 } |
856 } | 858 } |
857 return 0; | 859 return 0; |
858 } | 860 } |
859 | 861 |
860 DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 0, 0 /* | 862 DEFUN ("input-pending-p", Finput_pending_p, 0, 0, 0, /* |
861 T if command input is currently available with no waiting. | 863 T if command input is currently available with no waiting. |
862 Actually, the value is nil only if we can be sure that no input is available. | 864 Actually, the value is nil only if we can be sure that no input is available. |
863 */ ) | 865 */ |
864 () | 866 ()) |
865 { | 867 { |
866 return ((detect_input_pending ()) ? Qt : Qnil); | 868 return ((detect_input_pending ()) ? Qt : Qnil); |
867 } | 869 } |
868 | 870 |
869 | 871 |
1292 signal_simple_error | 1294 signal_simple_error |
1293 ("timeout would exceed 32 bits when represented in milliseconds", secs); | 1295 ("timeout would exceed 32 bits when represented in milliseconds", secs); |
1294 return msecs; | 1296 return msecs; |
1295 } | 1297 } |
1296 | 1298 |
1297 DEFUN ("add-timeout", Fadd_timeout, Sadd_timeout, 3, 4, 0 /* | 1299 DEFUN ("add-timeout", Fadd_timeout, 3, 4, 0, /* |
1298 Add a timeout, to be signaled after the timeout period has elapsed. | 1300 Add a timeout, to be signaled after the timeout period has elapsed. |
1299 SECS is a number of seconds, expressed as an integer or a float. | 1301 SECS is a number of seconds, expressed as an integer or a float. |
1300 FUNCTION will be called after that many seconds have elapsed, with one | 1302 FUNCTION will be called after that many seconds have elapsed, with one |
1301 argument, the given OBJECT. If the optional RESIGNAL argument is provided, | 1303 argument, the given OBJECT. If the optional RESIGNAL argument is provided, |
1302 then after this timeout expires, `add-timeout' will automatically be called | 1304 then after this timeout expires, `add-timeout' will automatically be called |
1325 running Lisp code, use `add-async-timeout'. | 1327 running Lisp code, use `add-async-timeout'. |
1326 | 1328 |
1327 WARNING: if you are thinking of calling add-timeout from inside of a | 1329 WARNING: if you are thinking of calling add-timeout from inside of a |
1328 callback function as a way of resignalling a timeout, think again. There | 1330 callback function as a way of resignalling a timeout, think again. There |
1329 is a race condition. That's why the RESIGNAL argument exists. | 1331 is a race condition. That's why the RESIGNAL argument exists. |
1330 */ ) | 1332 */ |
1331 (secs, function, object, resignal) | 1333 (secs, function, object, resignal)) |
1332 Lisp_Object secs, function, object, resignal; | |
1333 { | 1334 { |
1334 unsigned long msecs = lisp_number_to_milliseconds (secs, 0); | 1335 unsigned long msecs = lisp_number_to_milliseconds (secs, 0); |
1335 unsigned long msecs2 = (NILP (resignal) ? 0 : | 1336 unsigned long msecs2 = (NILP (resignal) ? 0 : |
1336 lisp_number_to_milliseconds (resignal, 0)); | 1337 lisp_number_to_milliseconds (resignal, 0)); |
1337 int id; | 1338 int id; |
1340 lid = make_int (id); | 1341 lid = make_int (id); |
1341 if (id != XINT (lid)) abort (); | 1342 if (id != XINT (lid)) abort (); |
1342 return lid; | 1343 return lid; |
1343 } | 1344 } |
1344 | 1345 |
1345 DEFUN ("disable-timeout", Fdisable_timeout, Sdisable_timeout, 1, 1, 0 /* | 1346 DEFUN ("disable-timeout", Fdisable_timeout, 1, 1, 0, /* |
1346 Disable a timeout from signalling any more. | 1347 Disable a timeout from signalling any more. |
1347 ID should be a timeout id number as returned by `add-timeout'. If ID | 1348 ID should be a timeout id number as returned by `add-timeout'. If ID |
1348 corresponds to a one-shot timeout that has already signalled, nothing | 1349 corresponds to a one-shot timeout that has already signalled, nothing |
1349 will happen. | 1350 will happen. |
1350 | 1351 |
1351 It will not work to call this function on an id number returned by | 1352 It will not work to call this function on an id number returned by |
1352 `add-async-timeout'. Use `disable-async-timeout' for that. | 1353 `add-async-timeout'. Use `disable-async-timeout' for that. |
1353 */ ) | 1354 */ |
1354 (id) | 1355 (id)) |
1355 Lisp_Object id; | |
1356 { | 1356 { |
1357 CHECK_INT (id); | 1357 CHECK_INT (id); |
1358 event_stream_disable_wakeup (XINT (id), 0); | 1358 event_stream_disable_wakeup (XINT (id), 0); |
1359 return Qnil; | 1359 return Qnil; |
1360 } | 1360 } |
1361 | 1361 |
1362 DEFUN ("add-async-timeout", Fadd_async_timeout, Sadd_async_timeout, 3, 4, 0 /* | 1362 DEFUN ("add-async-timeout", Fadd_async_timeout, 3, 4, 0, /* |
1363 Add an asynchronous timeout, to be signaled after an interval has elapsed. | 1363 Add an asynchronous timeout, to be signaled after an interval has elapsed. |
1364 SECS is a number of seconds, expressed as an integer or a float. | 1364 SECS is a number of seconds, expressed as an integer or a float. |
1365 FUNCTION will be called after that many seconds have elapsed, with one | 1365 FUNCTION will be called after that many seconds have elapsed, with one |
1366 argument, the given OBJECT. If the optional RESIGNAL argument is provided, | 1366 argument, the given OBJECT. If the optional RESIGNAL argument is provided, |
1367 then after this timeout expires, `add-async-timeout' will automatically be | 1367 then after this timeout expires, `add-async-timeout' will automatically be |
1406 to nil. | 1406 to nil. |
1407 | 1407 |
1408 WARNING: if you are thinking of calling `add-async-timeout' from inside of a | 1408 WARNING: if you are thinking of calling `add-async-timeout' from inside of a |
1409 callback function as a way of resignalling a timeout, think again. There | 1409 callback function as a way of resignalling a timeout, think again. There |
1410 is a race condition. That's why the RESIGNAL argument exists. | 1410 is a race condition. That's why the RESIGNAL argument exists. |
1411 */ ) | 1411 */ |
1412 (secs, function, object, resignal) | 1412 (secs, function, object, resignal)) |
1413 Lisp_Object secs, function, object, resignal; | |
1414 { | 1413 { |
1415 unsigned long msecs = lisp_number_to_milliseconds (secs, 0); | 1414 unsigned long msecs = lisp_number_to_milliseconds (secs, 0); |
1416 unsigned long msecs2 = (NILP (resignal) ? 0 : | 1415 unsigned long msecs2 = (NILP (resignal) ? 0 : |
1417 lisp_number_to_milliseconds (resignal, 0)); | 1416 lisp_number_to_milliseconds (resignal, 0)); |
1418 int id; | 1417 int id; |
1421 lid = make_int (id); | 1420 lid = make_int (id); |
1422 if (id != XINT (lid)) abort (); | 1421 if (id != XINT (lid)) abort (); |
1423 return lid; | 1422 return lid; |
1424 } | 1423 } |
1425 | 1424 |
1426 DEFUN ("disable-async-timeout", Fdisable_async_timeout, | 1425 DEFUN ("disable-async-timeout", Fdisable_async_timeout, 1, 1, 0, /* |
1427 Sdisable_async_timeout, 1, 1, 0 /* | |
1428 Disable an asynchronous timeout from signalling any more. | 1426 Disable an asynchronous timeout from signalling any more. |
1429 ID should be a timeout id number as returned by `add-async-timeout'. If ID | 1427 ID should be a timeout id number as returned by `add-async-timeout'. If ID |
1430 corresponds to a one-shot timeout that has already signalled, nothing | 1428 corresponds to a one-shot timeout that has already signalled, nothing |
1431 will happen. | 1429 will happen. |
1432 | 1430 |
1433 It will not work to call this function on an id number returned by | 1431 It will not work to call this function on an id number returned by |
1434 `add-timeout'. Use `disable-timeout' for that. | 1432 `add-timeout'. Use `disable-timeout' for that. |
1435 */ ) | 1433 */ |
1436 (id) | 1434 (id)) |
1437 Lisp_Object id; | |
1438 { | 1435 { |
1439 CHECK_INT (id); | 1436 CHECK_INT (id); |
1440 event_stream_disable_wakeup (XINT (id), 1); | 1437 event_stream_disable_wakeup (XINT (id), 1); |
1441 return Qnil; | 1438 return Qnil; |
1442 } | 1439 } |
1443 | 1440 |
1444 | 1441 |
1445 /**********************************************************************/ | 1442 /**********************************************************************/ |
1446 /* enqueuing and dequeuing events */ | 1443 /* enqueuing and dequeuing events */ |
1447 /**********************************************************************/ | 1444 /**********************************************************************/ |
1445 | |
1446 /* Add an event to the back of the process_event_queue */ | |
1447 void | |
1448 enqueue_process_event (Lisp_Object event) | |
1449 { | |
1450 enqueue_event (event, &process_event_queue, &process_event_queue_tail); | |
1451 } | |
1452 | |
1453 Lisp_Object | |
1454 dequeue_process_event (void) | |
1455 { | |
1456 return dequeue_event (&process_event_queue, &process_event_queue_tail); | |
1457 } | |
1448 | 1458 |
1449 /* Add an event to the back of the command-event queue: it will be the next | 1459 /* Add an event to the back of the command-event queue: it will be the next |
1450 event read after all pending events. This only works on keyboard, | 1460 event read after all pending events. This only works on keyboard, |
1451 mouse-click, misc-user, and eval events. | 1461 mouse-click, misc-user, and eval events. |
1452 */ | 1462 */ |
1489 XEVENT (event)->event.magic_eval.internal_function = fun; | 1499 XEVENT (event)->event.magic_eval.internal_function = fun; |
1490 XEVENT (event)->event.magic_eval.object = object; | 1500 XEVENT (event)->event.magic_eval.object = object; |
1491 enqueue_command_event (event); | 1501 enqueue_command_event (event); |
1492 } | 1502 } |
1493 | 1503 |
1494 DEFUN ("enqueue-eval-event", Fenqueue_eval_event, Senqueue_eval_event, | 1504 DEFUN ("enqueue-eval-event", Fenqueue_eval_event, 2, 2, 0, /* |
1495 2, 2, 0 /* | |
1496 Add an eval event to the back of the eval event queue. | 1505 Add an eval event to the back of the eval event queue. |
1497 When this event is dispatched, FUNCTION (which should be a function | 1506 When this event is dispatched, FUNCTION (which should be a function |
1498 of one argument) will be called with OBJECT as its argument. | 1507 of one argument) will be called with OBJECT as its argument. |
1499 See `next-event' for a description of event types and how events | 1508 See `next-event' for a description of event types and how events |
1500 are received. | 1509 are received. |
1501 */ ) | 1510 */ |
1502 (function, object) | 1511 (function, object)) |
1503 Lisp_Object function, object; | |
1504 { | 1512 { |
1505 Lisp_Object event; | 1513 Lisp_Object event; |
1506 | 1514 |
1507 event = Fmake_event (); | 1515 event = Fmake_event (); |
1508 | 1516 |
1835 /* the number of keyboard characters read. callint.c wants this. | 1843 /* the number of keyboard characters read. callint.c wants this. |
1836 */ | 1844 */ |
1837 Charcount num_input_chars; | 1845 Charcount num_input_chars; |
1838 | 1846 |
1839 static void | 1847 static void |
1840 next_event_internal (Lisp_Object target_event, int allow_queued) | 1848 next_event_internal (Lisp_Object target_event, int allow_queued, |
1849 int allow_deferred) | |
1841 { | 1850 { |
1842 struct gcpro gcpro1; | 1851 struct gcpro gcpro1; |
1843 /* QUIT; This is incorrect - the caller must do this because some | 1852 /* QUIT; This is incorrect - the caller must do this because some |
1844 callers (ie, Fnext_event()) do not want to QUIT. */ | 1853 callers (ie, Fnext_event()) do not want to QUIT. */ |
1845 | 1854 |
1855 Fdeallocate_event (event); | 1864 Fdeallocate_event (event); |
1856 #ifdef DEBUG_XEMACS | 1865 #ifdef DEBUG_XEMACS |
1857 if (debug_emacs_events) | 1866 if (debug_emacs_events) |
1858 { | 1867 { |
1859 write_c_string ("(command event queue) ", | 1868 write_c_string ("(command event queue) ", |
1869 Qexternal_debugging_output); | |
1870 print_internal (target_event, Qexternal_debugging_output, 1); | |
1871 write_c_string ("\n", Qexternal_debugging_output); | |
1872 } | |
1873 #endif | |
1874 } | |
1875 else if (allow_deferred && !NILP (process_event_queue)) | |
1876 { | |
1877 Lisp_Object event = dequeue_process_event (); | |
1878 Fcopy_event (event, target_event); | |
1879 Fdeallocate_event (event); | |
1880 #ifdef DEBUG_EMACS | |
1881 if (debug_emacs_events) | |
1882 { | |
1883 write_c_string ("(process event queue) ", | |
1860 Qexternal_debugging_output); | 1884 Qexternal_debugging_output); |
1861 print_internal (target_event, Qexternal_debugging_output, 1); | 1885 print_internal (target_event, Qexternal_debugging_output, 1); |
1862 write_c_string ("\n", Qexternal_debugging_output); | 1886 write_c_string ("\n", Qexternal_debugging_output); |
1863 } | 1887 } |
1864 #endif | 1888 #endif |
1927 static void push_this_command_keys (Lisp_Object event); | 1951 static void push_this_command_keys (Lisp_Object event); |
1928 static void push_recent_keys (Lisp_Object event); | 1952 static void push_recent_keys (Lisp_Object event); |
1929 static void dribble_out_event (Lisp_Object event); | 1953 static void dribble_out_event (Lisp_Object event); |
1930 static void execute_internal_event (Lisp_Object event); | 1954 static void execute_internal_event (Lisp_Object event); |
1931 | 1955 |
1932 DEFUN ("next-event", Fnext_event, Snext_event, 0, 2, 0 /* | 1956 DEFUN ("next-event", Fnext_event, 0, 2, 0, /* |
1933 Return the next available event. | 1957 Return the next available event. |
1934 Pass this object to `dispatch-event' to handle it. | 1958 Pass this object to `dispatch-event' to handle it. |
1935 In most cases, you will want to use `next-command-event', which returns | 1959 In most cases, you will want to use `next-command-event', which returns |
1936 the next available \"user\" event (i.e. keypress, button-press, | 1960 the next available \"user\" event (i.e. keypress, button-press, |
1937 button-release, or menu selection) instead of this function. | 1961 button-release, or menu selection) instead of this function. |
1963 or by certain other conditions happening. | 1987 or by certain other conditions happening. |
1964 -- a magic event, indicating that some window-system-specific event | 1988 -- a magic event, indicating that some window-system-specific event |
1965 happened (such as an focus-change notification) that must be handled | 1989 happened (such as an focus-change notification) that must be handled |
1966 synchronously with other events. `dispatch-event' knows what to do with | 1990 synchronously with other events. `dispatch-event' knows what to do with |
1967 these events. | 1991 these events. |
1968 */ ) | 1992 */ |
1969 (event, prompt) | 1993 (event, prompt)) |
1970 Lisp_Object event, prompt; | |
1971 { | 1994 { |
1972 /* This function can GC */ | 1995 /* This function can GC */ |
1973 /* #### We start out using the selected console before an event | 1996 /* #### We start out using the selected console before an event |
1974 is received, for echoing the partially completed command. | 1997 is received, for echoing the partially completed command. |
1975 This is most definitely wrong -- there needs to be a separate | 1998 This is most definitely wrong -- there needs to be a separate |
2098 recent-keys. */ | 2121 recent-keys. */ |
2099 else | 2122 else |
2100 { | 2123 { |
2101 run_pre_idle_hook (); | 2124 run_pre_idle_hook (); |
2102 redisplay (); | 2125 redisplay (); |
2103 next_event_internal (event, 1); | 2126 next_event_internal (event, 1, 1); |
2104 Vquit_flag = Qnil; /* Read C-g as an event. */ | 2127 Vquit_flag = Qnil; /* Read C-g as an event. */ |
2105 store_this_key = 1; | 2128 store_this_key = 1; |
2106 } | 2129 } |
2107 } | 2130 } |
2108 | 2131 |
2211 RETURN: | 2234 RETURN: |
2212 UNGCPRO; | 2235 UNGCPRO; |
2213 return (event); | 2236 return (event); |
2214 } | 2237 } |
2215 | 2238 |
2216 DEFUN ("next-command-event", Fnext_command_event, Snext_command_event, | 2239 DEFUN ("next-command-event", Fnext_command_event, 0, 2, 0, /* |
2217 0, 2, 0 /* | |
2218 Return the next available \"user\" event. | 2240 Return the next available \"user\" event. |
2219 Pass this object to `dispatch-event' to handle it. | 2241 Pass this object to `dispatch-event' to handle it. |
2220 | 2242 |
2221 If EVENT is non-nil, it should be an event object and will be filled in | 2243 If EVENT is non-nil, it should be an event object and will be filled in |
2222 and returned; otherwise a new event object will be created and returned. | 2244 and returned; otherwise a new event object will be created and returned. |
2234 (button-press-event-p event) | 2256 (button-press-event-p event) |
2235 (button-release-event-p event) | 2257 (button-release-event-p event) |
2236 (misc-user-event-p event)))) | 2258 (misc-user-event-p event)))) |
2237 (dispatch-event event)) | 2259 (dispatch-event event)) |
2238 | 2260 |
2239 */ ) | 2261 */ |
2240 (event, prompt) | 2262 (event, prompt)) |
2241 Lisp_Object event, prompt; | |
2242 { | 2263 { |
2243 /* This function can GC */ | 2264 /* This function can GC */ |
2244 struct gcpro gcpro1; | 2265 struct gcpro gcpro1; |
2245 GCPRO1 (event); | 2266 GCPRO1 (event); |
2246 maybe_echo_keys (XCOMMAND_BUILDER | 2267 maybe_echo_keys (XCOMMAND_BUILDER |
2265 reset_command_builder_event_chain (command_builder); | 2286 reset_command_builder_event_chain (command_builder); |
2266 if (EVENTP (event)) | 2287 if (EVENTP (event)) |
2267 deallocate_event_chain (event); | 2288 deallocate_event_chain (event); |
2268 } | 2289 } |
2269 | 2290 |
2270 DEFUN ("discard-input", Fdiscard_input, Sdiscard_input, 0, 0, 0 /* | 2291 DEFUN ("discard-input", Fdiscard_input, 0, 0, 0, /* |
2271 Discard any pending \"user\" events. | 2292 Discard any pending \"user\" events. |
2272 Also cancel any kbd macro being defined. | 2293 Also cancel any kbd macro being defined. |
2273 A user event is a key press, button press, button release, or | 2294 A user event is a key press, button press, button release, or |
2274 \"other-user\" event (menu selection or scrollbar action). | 2295 \"other-user\" event (menu selection or scrollbar action). |
2275 */ ) | 2296 */ |
2276 () | 2297 ()) |
2277 { | 2298 { |
2278 /* This throws away user-input on the queue, but doesn't process any | 2299 /* This throws away user-input on the queue, but doesn't process any |
2279 events. Calling dispatch_event() here leads to a race condition. | 2300 events. Calling dispatch_event() here leads to a race condition. |
2280 */ | 2301 */ |
2281 Lisp_Object event = Fmake_event (); | 2302 Lisp_Object event = Fmake_event (); |
2301 || event_stream_event_pending_p (1)) | 2322 || event_stream_event_pending_p (1)) |
2302 { | 2323 { |
2303 /* This will take stuff off the command_event_queue, or read it | 2324 /* This will take stuff off the command_event_queue, or read it |
2304 from the event_stream, but it will not block. | 2325 from the event_stream, but it will not block. |
2305 */ | 2326 */ |
2306 next_event_internal (event, 1); | 2327 next_event_internal (event, 1, 1); |
2307 Vquit_flag = Qnil; /* Treat C-g as a user event (ignore it). | 2328 Vquit_flag = Qnil; /* Treat C-g as a user event (ignore it). |
2308 It is vitally important that we reset | 2329 It is vitally important that we reset |
2309 Vquit_flag here. Otherwise, if we're | 2330 Vquit_flag here. Otherwise, if we're |
2310 reading from a TTY console, | 2331 reading from a TTY console, |
2311 maybe_read_quit_event() will notice | 2332 maybe_read_quit_event() will notice |
2358 /**********************************************************************/ | 2379 /**********************************************************************/ |
2359 | 2380 |
2360 /* #### Is (accept-process-output nil 3) supposed to be like (sleep-for 3)? | 2381 /* #### Is (accept-process-output nil 3) supposed to be like (sleep-for 3)? |
2361 */ | 2382 */ |
2362 | 2383 |
2363 DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output, | 2384 DEFUN ("accept-process-output", Faccept_process_output, 0, 3, 0, /* |
2364 0, 3, 0 /* | |
2365 Allow any pending output from subprocesses to be read by Emacs. | 2385 Allow any pending output from subprocesses to be read by Emacs. |
2366 It is read into the process' buffers or given to their filter functions. | 2386 It is read into the process' buffers or given to their filter functions. |
2367 Non-nil arg PROCESS means do not return until some output has been received | 2387 Non-nil arg PROCESS means do not return until some output has been received |
2368 from PROCESS. | 2388 from PROCESS. Nil arg PROCESS means do not return until some output has |
2389 been received from any process. | |
2369 If the second arg is non-nil, it is the maximum number of seconds to wait: | 2390 If the second arg is non-nil, it is the maximum number of seconds to wait: |
2370 this function will return after that much time even if no input has arrived | 2391 this function will return after that much time even if no input has arrived |
2371 from PROCESS. This argument may be a float, meaning wait some fractional | 2392 from PROCESS. This argument may be a float, meaning wait some fractional |
2372 part of a second. | 2393 part of a second. |
2373 If the third arg is non-nil, it is a number of milliseconds that is added | 2394 If the third arg is non-nil, it is a number of milliseconds that is added |
2374 to the second arg. (This exists only for compatibility.) | 2395 to the second arg. (This exists only for compatibility.) |
2375 Return non-nil iff we received any output before the timeout expired. | 2396 Return non-nil iff we received any output before the timeout expired. |
2376 */ ) | 2397 */ |
2377 (process, timeout_secs, timeout_msecs) | 2398 (process, timeout_secs, timeout_msecs)) |
2378 Lisp_Object process, timeout_secs, timeout_msecs; | |
2379 { | 2399 { |
2380 /* This function can GC */ | 2400 /* This function can GC */ |
2381 struct gcpro gcpro1, gcpro2; | 2401 struct gcpro gcpro1, gcpro2; |
2382 Lisp_Object event = Qnil; | 2402 Lisp_Object event = Qnil; |
2383 Lisp_Object result = Qnil; | 2403 Lisp_Object result = Qnil; |
2384 int timeout_id; | 2404 int timeout_id; |
2385 int timeout_enabled = 0; | 2405 int timeout_enabled = 0; |
2406 int done = 0; | |
2386 struct buffer *old_buffer = current_buffer; | 2407 struct buffer *old_buffer = current_buffer; |
2387 | 2408 |
2388 /* We preserve the current buffer but nothing else. If a focus | 2409 /* We preserve the current buffer but nothing else. If a focus |
2389 change alters the selected window then the top level event loop | 2410 change alters the selected window then the top level event loop |
2390 will eventually alter current_buffer to match. In the mean time | 2411 will eventually alter current_buffer to match. In the mean time |
2393 if (!NILP (process)) | 2414 if (!NILP (process)) |
2394 CHECK_PROCESS (process); | 2415 CHECK_PROCESS (process); |
2395 | 2416 |
2396 GCPRO2 (event, process); | 2417 GCPRO2 (event, process); |
2397 | 2418 |
2398 if (!NILP (process) && (!NILP (timeout_secs) || !NILP (timeout_msecs))) | 2419 if (!NILP (timeout_secs) || !NILP (timeout_msecs)) |
2399 { | 2420 { |
2400 unsigned long msecs = 0; | 2421 unsigned long msecs = 0; |
2401 if (!NILP (timeout_secs)) | 2422 if (!NILP (timeout_secs)) |
2402 msecs = lisp_number_to_milliseconds (timeout_secs, 1); | 2423 msecs = lisp_number_to_milliseconds (timeout_secs, 1); |
2403 if (!NILP (timeout_msecs)) | 2424 if (!NILP (timeout_msecs)) |
2412 } | 2433 } |
2413 } | 2434 } |
2414 | 2435 |
2415 event = Fmake_event (); | 2436 event = Fmake_event (); |
2416 | 2437 |
2417 while (!NILP (process) | 2438 while (!done && |
2439 ((NILP (process) && timeout_enabled) || | |
2440 (NILP (process) && event_stream_event_pending_p (0)) || | |
2441 (!NILP (process)))) | |
2418 /* Calling detect_input_pending() is the wrong thing here, because | 2442 /* Calling detect_input_pending() is the wrong thing here, because |
2419 that considers the Vunread_command_events and command_event_queue. | 2443 that considers the Vunread_command_events and command_event_queue. |
2420 We don't need to look at the command_event_queue because we are | 2444 We don't need to look at the command_event_queue because we are |
2421 only interested in process events, which don't go on that. In | 2445 only interested in process events, which don't go on that. In |
2422 fact, we can't read from it anyway, because we put stuff on it. | 2446 fact, we can't read from it anyway, because we put stuff on it. |
2427 to dispatch any process events that may be on the queue. It is | 2451 to dispatch any process events that may be on the queue. It is |
2428 not clear to me that this is important, because the top-level | 2452 not clear to me that this is important, because the top-level |
2429 loop will process it, and I don't think that there is ever a | 2453 loop will process it, and I don't think that there is ever a |
2430 time when one calls accept-process-output with a nil argument | 2454 time when one calls accept-process-output with a nil argument |
2431 and really need the processes to be handled. */ | 2455 and really need the processes to be handled. */ |
2432 || (!EQ (result, Qt) && event_stream_event_pending_p (0))) | |
2433 { | 2456 { |
2434 /* If our timeout has arrived, we move along. */ | 2457 /* If our timeout has arrived, we move along. */ |
2435 if (timeout_enabled && !event_stream_wakeup_pending_p (timeout_id, 0)) | 2458 if (timeout_enabled && !event_stream_wakeup_pending_p (timeout_id, 0)) |
2436 { | 2459 { |
2437 timeout_enabled = 0; | 2460 timeout_enabled = 0; |
2438 process = Qnil; /* We're done. */ | 2461 done = 1; /* We're done. */ |
2462 continue; /* Don't call next_event_internal */ | |
2439 } | 2463 } |
2440 | 2464 |
2441 QUIT; /* next_event_internal() does not QUIT, so check for ^G | 2465 QUIT; /* next_event_internal() does not QUIT, so check for ^G |
2442 before reading output from the process - this makes it | 2466 before reading output from the process - this makes it |
2443 less likely that the filter will actually be aborted. | 2467 less likely that the filter will actually be aborted. |
2444 */ | 2468 */ |
2445 | 2469 |
2446 next_event_internal (event, 0); | 2470 next_event_internal (event, 0, 1); |
2447 /* If C-g was pressed while we were waiting, Vquit_flag got | 2471 /* If C-g was pressed while we were waiting, Vquit_flag got |
2448 set and next_event_internal() also returns C-g. When | 2472 set and next_event_internal() also returns C-g. When |
2449 we enqueue the C-g below, it will get discarded. The | 2473 we enqueue the C-g below, it will get discarded. The |
2450 next time through, QUIT will be called and will signal a quit. */ | 2474 next time through, QUIT will be called and will signal a quit. */ |
2451 switch (XEVENT_TYPE (event)) | 2475 switch (XEVENT_TYPE (event)) |
2452 { | 2476 { |
2453 case process_event: | 2477 case process_event: |
2454 { | 2478 { |
2455 if (EQ (XEVENT (event)->event.process.process, process)) | 2479 if (NILP (process) || |
2480 EQ (XEVENT (event)->event.process.process, process)) | |
2456 { | 2481 { |
2457 process = Qnil; | 2482 done = 1; |
2458 /* RMS's version always returns nil when proc is nil, | 2483 /* RMS's version always returns nil when proc is nil, |
2459 and only returns t if input ever arrived on proc. */ | 2484 and only returns t if input ever arrived on proc. */ |
2460 result = Qt; | 2485 result = Qt; |
2461 } | 2486 } |
2462 | 2487 |
2467 /* We execute the event even if it's ours, and notice that it's | 2492 /* We execute the event even if it's ours, and notice that it's |
2468 happened above. */ | 2493 happened above. */ |
2469 case pointer_motion_event: | 2494 case pointer_motion_event: |
2470 case magic_event: | 2495 case magic_event: |
2471 { | 2496 { |
2497 EXECUTE_INTERNAL: | |
2472 execute_internal_event (event); | 2498 execute_internal_event (event); |
2473 break; | 2499 break; |
2474 } | 2500 } |
2475 default: | 2501 default: |
2476 { | 2502 { |
2488 UNGCPRO; | 2514 UNGCPRO; |
2489 current_buffer = old_buffer; | 2515 current_buffer = old_buffer; |
2490 return result; | 2516 return result; |
2491 } | 2517 } |
2492 | 2518 |
2493 DEFUN ("sleep-for", Fsleep_for, Ssleep_for, 1, 1, 0 /* | 2519 DEFUN ("sleep-for", Fsleep_for, 1, 1, 0, /* |
2494 Pause, without updating display, for ARG seconds. | 2520 Pause, without updating display, for ARG seconds. |
2495 ARG may be a float, meaning pause for some fractional part of a second. | 2521 ARG may be a float, meaning pause for some fractional part of a second. |
2496 */ ) | 2522 */ |
2497 (seconds) | 2523 (seconds)) |
2498 Lisp_Object seconds; | |
2499 { | 2524 { |
2500 /* This function can GC */ | 2525 /* This function can GC */ |
2501 unsigned long msecs = lisp_number_to_milliseconds (seconds, 1); | 2526 unsigned long msecs = lisp_number_to_milliseconds (seconds, 1); |
2502 int id; | 2527 int id; |
2503 Lisp_Object event = Qnil; | 2528 Lisp_Object event = Qnil; |
2519 */ | 2544 */ |
2520 /* We're a generator of the command_event_queue, so we can't be a | 2545 /* We're a generator of the command_event_queue, so we can't be a |
2521 consumer as well. We don't care about command and eval-events | 2546 consumer as well. We don't care about command and eval-events |
2522 anyway. | 2547 anyway. |
2523 */ | 2548 */ |
2524 next_event_internal (event, 0); /* blocks */ | 2549 next_event_internal (event, 0, 0); /* blocks */ |
2525 /* See the comment in accept-process-output about Vquit_flag */ | 2550 /* See the comment in accept-process-output about Vquit_flag */ |
2526 switch (XEVENT_TYPE (event)) | 2551 switch (XEVENT_TYPE (event)) |
2527 { | 2552 { |
2553 case process_event: | |
2554 { | |
2555 /* Avoid calling filter functions recursively by squirreling | |
2556 away process events */ | |
2557 enqueue_process_event (Fcopy_event (event, Qnil)); | |
2558 goto DONE_LABEL; | |
2559 } | |
2560 | |
2528 case timeout_event: | 2561 case timeout_event: |
2529 /* We execute the event even if it's ours, and notice that it's | 2562 /* We execute the event even if it's ours, and notice that it's |
2530 happened above. */ | 2563 happened above. */ |
2531 case pointer_motion_event: | 2564 case pointer_motion_event: |
2532 case process_event: | |
2533 case magic_event: | 2565 case magic_event: |
2534 { | 2566 { |
2535 EXECUTE_INTERNAL: | 2567 EXECUTE_INTERNAL: |
2536 execute_internal_event (event); | 2568 execute_internal_event (event); |
2537 break; | 2569 break; |
2547 Fdeallocate_event (event); | 2579 Fdeallocate_event (event); |
2548 UNGCPRO; | 2580 UNGCPRO; |
2549 return Qnil; | 2581 return Qnil; |
2550 } | 2582 } |
2551 | 2583 |
2552 DEFUN ("sit-for", Fsit_for, Ssit_for, 1, 2, 0 /* | 2584 DEFUN ("sit-for", Fsit_for, 1, 2, 0, /* |
2553 Perform redisplay, then wait ARG seconds or until user input is available. | 2585 Perform redisplay, then wait ARG seconds or until user input is available. |
2554 ARG may be a float, meaning a fractional part of a second. | 2586 ARG may be a float, meaning a fractional part of a second. |
2555 Optional second arg non-nil means don't redisplay, just wait for input. | 2587 Optional second arg non-nil means don't redisplay, just wait for input. |
2556 Redisplay is preempted as always if user input arrives, and does not | 2588 Redisplay is preempted as always if user input arrives, and does not |
2557 happen if input is available before it starts. | 2589 happen if input is available before it starts. |
2558 Value is t if waited the full time with no input arriving. | 2590 Value is t if waited the full time with no input arriving. |
2559 */ ) | 2591 */ |
2560 (seconds, nodisplay) | 2592 (seconds, nodisplay)) |
2561 Lisp_Object seconds, nodisplay; | |
2562 { | 2593 { |
2563 /* This function can GC */ | 2594 /* This function can GC */ |
2564 unsigned long msecs = lisp_number_to_milliseconds (seconds, 1); | 2595 unsigned long msecs = lisp_number_to_milliseconds (seconds, 1); |
2565 Lisp_Object event, result; | 2596 Lisp_Object event, result; |
2566 struct gcpro gcpro1; | 2597 struct gcpro gcpro1; |
2625 */ | 2656 */ |
2626 /* We're a generator of the command_event_queue, so we can't be a | 2657 /* We're a generator of the command_event_queue, so we can't be a |
2627 consumer as well. In fact, we know there's nothing on the | 2658 consumer as well. In fact, we know there's nothing on the |
2628 command_event_queue that we didn't just put there. | 2659 command_event_queue that we didn't just put there. |
2629 */ | 2660 */ |
2630 next_event_internal (event, 0); /* blocks */ | 2661 next_event_internal (event, 0, 0); /* blocks */ |
2631 /* See the comment in accept-process-output about Vquit_flag */ | 2662 /* See the comment in accept-process-output about Vquit_flag */ |
2632 | 2663 |
2633 if (command_event_p (event)) | 2664 if (command_event_p (event)) |
2634 { | 2665 { |
2635 result = Qnil; | 2666 result = Qnil; |
2641 { | 2672 { |
2642 /* eval-events get delayed until later. */ | 2673 /* eval-events get delayed until later. */ |
2643 enqueue_command_event (Fcopy_event (event, Qnil)); | 2674 enqueue_command_event (Fcopy_event (event, Qnil)); |
2644 break; | 2675 break; |
2645 } | 2676 } |
2677 | |
2678 case process_event: | |
2679 { | |
2680 /* Avoid recursive calls to process filters */ | |
2681 enqueue_process_event (Fcopy_event (event, Qnil)); | |
2682 break; | |
2683 } | |
2684 | |
2646 case timeout_event: | 2685 case timeout_event: |
2647 /* We execute the event even if it's ours, and notice that it's | 2686 /* We execute the event even if it's ours, and notice that it's |
2648 happened above. */ | 2687 happened above. */ |
2649 default: | 2688 default: |
2650 { | 2689 { |
2695 /* We're a generator of the command_event_queue, so we can't be a | 2734 /* We're a generator of the command_event_queue, so we can't be a |
2696 consumer as well. Also, we have no reason to consult the | 2735 consumer as well. Also, we have no reason to consult the |
2697 command_event_queue; there are only user and eval-events there, | 2736 command_event_queue; there are only user and eval-events there, |
2698 and we'd just have to put them back anyway. | 2737 and we'd just have to put them back anyway. |
2699 */ | 2738 */ |
2700 next_event_internal (event, 0); | 2739 next_event_internal (event, 0, 1); |
2701 /* See the comment in accept-process-output about Vquit_flag */ | 2740 /* See the comment in accept-process-output about Vquit_flag */ |
2702 if (command_event_p (event) | 2741 if (command_event_p (event) |
2703 || (XEVENT_TYPE (event) == eval_event) | 2742 || (XEVENT_TYPE (event) == eval_event) |
2704 || (XEVENT_TYPE (event) == magic_eval_event)) | 2743 || (XEVENT_TYPE (event) == magic_eval_event)) |
2705 enqueue_command_event_1 (event); | 2744 enqueue_command_event_1 (event); |
2793 get a SIGCHLD). */ | 2832 get a SIGCHLD). */ |
2794 || (readstatus == -1 && errno == EIO) | 2833 || (readstatus == -1 && errno == EIO) |
2795 #endif | 2834 #endif |
2796 ) | 2835 ) |
2797 { | 2836 { |
2798 /* Currently, we rely on SIGCHLD to indicate that | 2837 /* Currently, we rely on SIGCHLD to indicate that the |
2799 the process has terminated. Unfortunately, it | 2838 process has terminated. Unfortunately, on some systems |
2800 appears that on some systems the SIGCHLD gets | 2839 the SIGCHLD gets missed some of the time. So we put an |
2801 missed some of the time. So, we put in am | 2840 additional check in status_notify() to see whether a |
2802 additional check in status_notify() to see | 2841 process has terminated. We must tell status_notify() |
2803 whether a process has terminated. We have to | 2842 to enable that check, and we do so now. */ |
2804 tell status_notify() to enable that check, and | |
2805 we do so now. */ | |
2806 kick_status_notify (); | 2843 kick_status_notify (); |
2807 } | 2844 } |
2808 else | 2845 else |
2809 { | 2846 { |
2810 /* Deactivate network connection */ | 2847 /* Deactivate network connection */ |
3130 | 3167 |
3131 #define RECENT_KEYS_SIZE 100 | 3168 #define RECENT_KEYS_SIZE 100 |
3132 Lisp_Object recent_keys_ring; | 3169 Lisp_Object recent_keys_ring; |
3133 int recent_keys_ring_index; | 3170 int recent_keys_ring_index; |
3134 | 3171 |
3135 DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0 /* | 3172 DEFUN ("recent-keys", Frecent_keys, 0, 0, 0, /* |
3136 Return vector of last 100 or so keyboard or mouse button events read. | 3173 Return vector of last 100 or so keyboard or mouse button events read. |
3137 This copies the event objects into a new vector; it is safe to keep and | 3174 This copies the event objects into a new vector; it is safe to keep and |
3138 modify them. | 3175 modify them. |
3139 */ ) | 3176 */ |
3140 () | 3177 ()) |
3141 { | 3178 { |
3142 struct gcpro gcpro1; | 3179 struct gcpro gcpro1; |
3143 Lisp_Object val = Qnil; | 3180 Lisp_Object val = Qnil; |
3144 int size = XVECTOR (recent_keys_ring)->size; | 3181 int size = XVECTOR (recent_keys_ring)->size; |
3145 int start, nkeys, i, j; | 3182 int start, nkeys, i, j; |
3615 #### There should be a cleaner way of handling this. */ | 3652 #### There should be a cleaner way of handling this. */ |
3616 call0 (Qauto_show_make_point_visible); | 3653 call0 (Qauto_show_make_point_visible); |
3617 } | 3654 } |
3618 | 3655 |
3619 | 3656 |
3620 DEFUN ("dispatch-event", Fdispatch_event, Sdispatch_event, 1, 1, 0 /* | 3657 DEFUN ("dispatch-event", Fdispatch_event, 1, 1, 0, /* |
3621 Given an event object as returned by `next-event', execute it. | 3658 Given an event object as returned by `next-event', execute it. |
3622 | 3659 |
3623 Key-press, button-press, and button-release events get accumulated | 3660 Key-press, button-press, and button-release events get accumulated |
3624 until a complete key sequence (see `read-key-sequence') is reached, | 3661 until a complete key sequence (see `read-key-sequence') is reached, |
3625 at which point the sequence is looked up in the current keymaps and | 3662 at which point the sequence is looked up in the current keymaps and |
3635 | 3672 |
3636 Process events cause the subprocess's output to be read and acted upon | 3673 Process events cause the subprocess's output to be read and acted upon |
3637 appropriately (see `start-process'). | 3674 appropriately (see `start-process'). |
3638 | 3675 |
3639 Magic events are handled as necessary. | 3676 Magic events are handled as necessary. |
3640 */ ) | 3677 */ |
3641 (event) | 3678 (event)) |
3642 Lisp_Object event; | |
3643 { | 3679 { |
3644 /* This function can GC */ | 3680 /* This function can GC */ |
3645 struct command_builder *command_builder; | 3681 struct command_builder *command_builder; |
3646 struct Lisp_Event *ev; | 3682 struct Lisp_Event *ev; |
3647 Lisp_Object console; | 3683 Lisp_Object console; |
3843 } | 3879 } |
3844 } | 3880 } |
3845 return (Qnil); | 3881 return (Qnil); |
3846 } | 3882 } |
3847 | 3883 |
3848 DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 3, 0 /* | 3884 DEFUN ("read-key-sequence", Fread_key_sequence, 1, 3, 0, /* |
3849 Read a sequence of keystrokes or mouse clicks. | 3885 Read a sequence of keystrokes or mouse clicks. |
3850 Returns a vector of the event objects read. The vector and the event | 3886 Returns a vector of the event objects read. The vector and the event |
3851 objects it contains are freshly created (and will not be side-effected | 3887 objects it contains are freshly created (and will not be side-effected |
3852 by subsequent calls to this function). | 3888 by subsequent calls to this function). |
3853 | 3889 |
3876 related function. | 3912 related function. |
3877 | 3913 |
3878 `read-key-sequence' checks `function-key-map' for function key | 3914 `read-key-sequence' checks `function-key-map' for function key |
3879 sequences, where they wouldn't conflict with ordinary bindings. See | 3915 sequences, where they wouldn't conflict with ordinary bindings. See |
3880 `function-key-map' for more details. | 3916 `function-key-map' for more details. |
3881 */ ) | 3917 */ |
3882 (prompt, continue_echo, dont_downcase_last) | 3918 (prompt, continue_echo, dont_downcase_last)) |
3883 Lisp_Object prompt, continue_echo, dont_downcase_last; | |
3884 { | 3919 { |
3885 /* This function can GC */ | 3920 /* This function can GC */ |
3886 struct console *con = XCONSOLE (Vselected_console); /* #### correct? | 3921 struct console *con = XCONSOLE (Vselected_console); /* #### correct? |
3887 Probably not -- see | 3922 Probably not -- see |
3888 comment in | 3923 comment in |
3934 Vquit_flag = Qnil; /* In case we read a ^G; do not call check_quit() here */ | 3969 Vquit_flag = Qnil; /* In case we read a ^G; do not call check_quit() here */ |
3935 Fdeallocate_event (event); | 3970 Fdeallocate_event (event); |
3936 RETURN_UNGCPRO (unbind_to (speccount, result)); | 3971 RETURN_UNGCPRO (unbind_to (speccount, result)); |
3937 } | 3972 } |
3938 | 3973 |
3939 DEFUN ("this-command-keys", Fthis_command_keys, Sthis_command_keys, 0, 0, 0 /* | 3974 DEFUN ("this-command-keys", Fthis_command_keys, 0, 0, 0, /* |
3940 Return a vector of the keyboard or mouse button events that were used | 3975 Return a vector of the keyboard or mouse button events that were used |
3941 to invoke this command. This copies the vector and the events; it is safe | 3976 to invoke this command. This copies the vector and the events; it is safe |
3942 to keep and modify them. | 3977 to keep and modify them. |
3943 */ ) | 3978 */ |
3944 () | 3979 ()) |
3945 { | 3980 { |
3946 Lisp_Object event; | 3981 Lisp_Object event; |
3947 Lisp_Object result; | 3982 Lisp_Object result; |
3948 int len; | 3983 int len; |
3949 | 3984 |
3957 EVENT_CHAIN_LOOP (event, Vthis_command_keys) | 3992 EVENT_CHAIN_LOOP (event, Vthis_command_keys) |
3958 vector_data (XVECTOR (result))[len++] = Fcopy_event (event, Qnil); | 3993 vector_data (XVECTOR (result))[len++] = Fcopy_event (event, Qnil); |
3959 return (result); | 3994 return (result); |
3960 } | 3995 } |
3961 | 3996 |
3962 DEFUN ("reset-this-command-lengths", Freset_this_command_lengths, | 3997 DEFUN ("reset-this-command-lengths", Freset_this_command_lengths, 0, 0, 0, /* |
3963 Sreset_this_command_lengths, 0, 0, 0 /* | |
3964 Used for complicated reasons in `universal-argument-other-key'. | 3998 Used for complicated reasons in `universal-argument-other-key'. |
3965 | 3999 |
3966 `universal-argument-other-key' rereads the event just typed. | 4000 `universal-argument-other-key' rereads the event just typed. |
3967 It then gets translated through `function-key-map'. | 4001 It then gets translated through `function-key-map'. |
3968 The translated event gets included in the echo area and in | 4002 The translated event gets included in the echo area and in |
3970 That is not right. | 4004 That is not right. |
3971 | 4005 |
3972 Calling this function directs the translated event to replace | 4006 Calling this function directs the translated event to replace |
3973 the original event, so that only one version of the event actually | 4007 the original event, so that only one version of the event actually |
3974 appears in the echo area and in the value of `this-command-keys.'. | 4008 appears in the echo area and in the value of `this-command-keys.'. |
3975 */ ) | 4009 */ |
3976 () | 4010 ()) |
3977 { | 4011 { |
3978 /* #### I don't understand this at all, so currently it does nothing. | 4012 /* #### I don't understand this at all, so currently it does nothing. |
3979 If there is ever a problem, maybe someone should investigate. */ | 4013 If there is ever a problem, maybe someone should investigate. */ |
3980 return Qnil; | 4014 return Qnil; |
3981 } | 4015 } |
4013 else | 4047 else |
4014 Fprinc (event, Vdribble_file); | 4048 Fprinc (event, Vdribble_file); |
4015 Lstream_flush (XLSTREAM (Vdribble_file)); | 4049 Lstream_flush (XLSTREAM (Vdribble_file)); |
4016 } | 4050 } |
4017 | 4051 |
4018 DEFUN ("open-dribble-file", Fopen_dribble_file, Sopen_dribble_file, 1, 1, | 4052 DEFUN ("open-dribble-file", Fopen_dribble_file, 1, 1, |
4019 "FOpen dribble file: " /* | 4053 "FOpen dribble file: ", /* |
4020 Start writing all keyboard characters to a dribble file called FILE. | 4054 Start writing all keyboard characters to a dribble file called FILE. |
4021 If FILE is nil, close any open dribble file. | 4055 If FILE is nil, close any open dribble file. |
4022 */ ) | 4056 */ |
4023 (file) | 4057 (file)) |
4024 Lisp_Object file; | |
4025 { | 4058 { |
4026 /* This function can GC */ | 4059 /* This function can GC */ |
4027 /* XEmacs change: always close existing dribble file. */ | 4060 /* XEmacs change: always close existing dribble file. */ |
4028 /* FSFmacs uses FILE *'s here. With lstreams, that's unnecessary. */ | 4061 /* FSFmacs uses FILE *'s here. With lstreams, that's unnecessary. */ |
4029 if (!NILP (Vdribble_file)) | 4062 if (!NILP (Vdribble_file)) |
4057 | 4090 |
4058 deferror (&Qundefined_keystroke_sequence, "undefined-keystroke-sequence", | 4091 deferror (&Qundefined_keystroke_sequence, "undefined-keystroke-sequence", |
4059 "Undefined keystroke sequence", Qerror); | 4092 "Undefined keystroke sequence", Qerror); |
4060 defsymbol (&Qcommand_execute, "command-execute"); | 4093 defsymbol (&Qcommand_execute, "command-execute"); |
4061 | 4094 |
4062 defsubr (&Srecent_keys); | 4095 DEFSUBR (Frecent_keys); |
4063 defsubr (&Sinput_pending_p); | 4096 DEFSUBR (Finput_pending_p); |
4064 defsubr (&Senqueue_eval_event); | 4097 DEFSUBR (Fenqueue_eval_event); |
4065 defsubr (&Snext_event); | 4098 DEFSUBR (Fnext_event); |
4066 defsubr (&Snext_command_event); | 4099 DEFSUBR (Fnext_command_event); |
4067 defsubr (&Sdiscard_input); | 4100 DEFSUBR (Fdiscard_input); |
4068 defsubr (&Ssit_for); | 4101 DEFSUBR (Fsit_for); |
4069 defsubr (&Ssleep_for); | 4102 DEFSUBR (Fsleep_for); |
4070 defsubr (&Saccept_process_output); | 4103 DEFSUBR (Faccept_process_output); |
4071 defsubr (&Sadd_timeout); | 4104 DEFSUBR (Fadd_timeout); |
4072 defsubr (&Sdisable_timeout); | 4105 DEFSUBR (Fdisable_timeout); |
4073 defsubr (&Sadd_async_timeout); | 4106 DEFSUBR (Fadd_async_timeout); |
4074 defsubr (&Sdisable_async_timeout); | 4107 DEFSUBR (Fdisable_async_timeout); |
4075 defsubr (&Sdispatch_event); | 4108 DEFSUBR (Fdispatch_event); |
4076 defsubr (&Sread_key_sequence); | 4109 DEFSUBR (Fread_key_sequence); |
4077 defsubr (&Sthis_command_keys); | 4110 DEFSUBR (Fthis_command_keys); |
4078 defsubr (&Sreset_this_command_lengths); | 4111 DEFSUBR (Freset_this_command_lengths); |
4079 defsubr (&Sopen_dribble_file); | 4112 DEFSUBR (Fopen_dribble_file); |
4080 | 4113 |
4081 defsymbol (&Qpre_command_hook, "pre-command-hook"); | 4114 defsymbol (&Qpre_command_hook, "pre-command-hook"); |
4082 defsymbol (&Qpost_command_hook, "post-command-hook"); | 4115 defsymbol (&Qpost_command_hook, "post-command-hook"); |
4083 defsymbol (&Qunread_command_events, "unread-command-events"); | 4116 defsymbol (&Qunread_command_events, "unread-command-events"); |
4084 defsymbol (&Qunread_command_event, "unread-command-event"); | 4117 defsymbol (&Qunread_command_event, "unread-command-event"); |
4120 num_input_chars = 0; | 4153 num_input_chars = 0; |
4121 | 4154 |
4122 command_event_queue = Qnil; | 4155 command_event_queue = Qnil; |
4123 staticpro (&command_event_queue); | 4156 staticpro (&command_event_queue); |
4124 command_event_queue_tail = Qnil; | 4157 command_event_queue_tail = Qnil; |
4158 | |
4159 process_event_queue = Qnil; | |
4160 staticpro (&process_event_queue); | |
4161 process_event_queue_tail = Qnil; | |
4125 | 4162 |
4126 Vlast_selected_frame = Qnil; | 4163 Vlast_selected_frame = Qnil; |
4127 staticpro (&Vlast_selected_frame); | 4164 staticpro (&Vlast_selected_frame); |
4128 | 4165 |
4129 pending_timeout_list = Qnil; | 4166 pending_timeout_list = Qnil; |