Mercurial > emacs
comparison src/keyboard.c @ 22945:58a8427745ec
(Vthis_command): Renamed from this_command.
(real_this_command): New variable, but not a Lisp variable;
updated like Vthis_command, but never altered by Lisp programs.
(command_loop_1): Use real_this_command to set Vreal_last_command.
(read_char): When input method returns no chars, call cancel_echoing.
Restore the previous echo area message and this_command_keys, too.
(Vinput_method_previous_message): New variable.
(syms_of_keyboard): Set up lisp variable.
(Qinput_method_exit_on_first_char, Qinput_method_use_echo_area): New variables.
(syms_of_keyboard): Initialize them.
(Fread_key_sequence): New arg COMMAND_LOOP.
Bind those variables.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 08 Aug 1998 03:13:39 +0000 |
parents | 1cda5e4bddba |
children | c7c48ac2e34b |
comparison
equal
deleted
inserted
replaced
22944:c2bb9ab28588 | 22945:58a8427745ec |
---|---|
315 int last_auto_save; | 315 int last_auto_save; |
316 | 316 |
317 /* The command being executed by the command loop. | 317 /* The command being executed by the command loop. |
318 Commands may set this, and the value set will be copied into | 318 Commands may set this, and the value set will be copied into |
319 current_kboard->Vlast_command instead of the actual command. */ | 319 current_kboard->Vlast_command instead of the actual command. */ |
320 Lisp_Object this_command; | 320 Lisp_Object Vthis_command; |
321 | |
322 /* This is like Vthis_command, except that commands never set it. */ | |
323 Lisp_Object real_this_command; | |
321 | 324 |
322 /* The value of point when the last command was executed. */ | 325 /* The value of point when the last command was executed. */ |
323 int last_point_position; | 326 int last_point_position; |
324 | 327 |
325 /* The buffer that was current when the last command was started. */ | 328 /* The buffer that was current when the last command was started. */ |
366 | 369 |
367 /* If non-nil, this implements the current input method. */ | 370 /* If non-nil, this implements the current input method. */ |
368 Lisp_Object Vinput_method_function; | 371 Lisp_Object Vinput_method_function; |
369 Lisp_Object Qinput_method_function; | 372 Lisp_Object Qinput_method_function; |
370 | 373 |
374 /* When we call Vinput_method_function, | |
375 this holds the echo area message that was just erased. */ | |
376 Lisp_Object Vinput_method_previous_message; | |
377 | |
371 /* Non-nil means deactivate the mark at end of this command. */ | 378 /* Non-nil means deactivate the mark at end of this command. */ |
372 Lisp_Object Vdeactivate_mark; | 379 Lisp_Object Vdeactivate_mark; |
373 | 380 |
374 /* Menu bar specified in Lucid Emacs fashion. */ | 381 /* Menu bar specified in Lucid Emacs fashion. */ |
375 | 382 |
393 Lisp_Object Vdeferred_action_list; | 400 Lisp_Object Vdeferred_action_list; |
394 | 401 |
395 /* Function to call to handle deferred actions, when there are any. */ | 402 /* Function to call to handle deferred actions, when there are any. */ |
396 Lisp_Object Vdeferred_action_function; | 403 Lisp_Object Vdeferred_action_function; |
397 Lisp_Object Qdeferred_action_function; | 404 Lisp_Object Qdeferred_action_function; |
405 | |
406 Lisp_Object Qinput_method_exit_on_first_char; | |
407 Lisp_Object Qinput_method_use_echo_area; | |
398 | 408 |
399 /* File in which we write all commands we read. */ | 409 /* File in which we write all commands we read. */ |
400 FILE *dribble; | 410 FILE *dribble; |
401 | 411 |
402 /* Nonzero if input is available. */ | 412 /* Nonzero if input is available. */ |
1183 && !NILP (sit_for (0, post_command_idle_delay, 0, 1, 1))) | 1193 && !NILP (sit_for (0, post_command_idle_delay, 0, 1, 1))) |
1184 safe_run_hooks (Qpost_command_idle_hook); | 1194 safe_run_hooks (Qpost_command_idle_hook); |
1185 } | 1195 } |
1186 | 1196 |
1187 /* Do this after running Vpost_command_hook, for consistency. */ | 1197 /* Do this after running Vpost_command_hook, for consistency. */ |
1188 current_kboard->Vlast_command = this_command; | 1198 current_kboard->Vlast_command = Vthis_command; |
1189 current_kboard->Vreal_last_command = this_command; | 1199 current_kboard->Vreal_last_command = real_this_command; |
1190 | 1200 |
1191 while (1) | 1201 while (1) |
1192 { | 1202 { |
1193 /* Make sure the current window's buffer is selected. */ | 1203 /* Make sure the current window's buffer is selected. */ |
1194 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) | 1204 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) |
1251 call0 (Qrecompute_lucid_menubar); | 1261 call0 (Qrecompute_lucid_menubar); |
1252 | 1262 |
1253 before_command_key_count = this_command_key_count; | 1263 before_command_key_count = this_command_key_count; |
1254 before_command_echo_length = echo_length (); | 1264 before_command_echo_length = echo_length (); |
1255 | 1265 |
1256 this_command = Qnil; | 1266 Vthis_command = Qnil; |
1267 real_this_command = Qnil; | |
1257 | 1268 |
1258 /* Read next key sequence; i gets its length. */ | 1269 /* Read next key sequence; i gets its length. */ |
1259 i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0], | 1270 i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0], |
1260 Qnil, 0, 1, 1); | 1271 Qnil, 0, 1, 1); |
1261 | 1272 |
1316 last_point_position = PT; | 1327 last_point_position = PT; |
1317 XSETBUFFER (last_point_position_buffer, prev_buffer); | 1328 XSETBUFFER (last_point_position_buffer, prev_buffer); |
1318 | 1329 |
1319 /* Execute the command. */ | 1330 /* Execute the command. */ |
1320 | 1331 |
1321 this_command = cmd; | 1332 Vthis_command = cmd; |
1333 real_this_command = cmd; | |
1322 /* Note that the value cell will never directly contain nil | 1334 /* Note that the value cell will never directly contain nil |
1323 if the symbol is a local variable. */ | 1335 if the symbol is a local variable. */ |
1324 if (!NILP (Vpre_command_hook) && !NILP (Vrun_hooks)) | 1336 if (!NILP (Vpre_command_hook) && !NILP (Vrun_hooks)) |
1325 safe_run_hooks (Qpre_command_hook); | 1337 safe_run_hooks (Qpre_command_hook); |
1326 | 1338 |
1327 if (NILP (this_command)) | 1339 if (NILP (Vthis_command)) |
1328 { | 1340 { |
1329 /* nil means key is undefined. */ | 1341 /* nil means key is undefined. */ |
1330 bitch_at_user (); | 1342 bitch_at_user (); |
1331 current_kboard->defining_kbd_macro = Qnil; | 1343 current_kboard->defining_kbd_macro = Qnil; |
1332 update_mode_lines = 1; | 1344 update_mode_lines = 1; |
1339 /* In case we jump to directly_done. */ | 1351 /* In case we jump to directly_done. */ |
1340 Vcurrent_prefix_arg = current_kboard->Vprefix_arg; | 1352 Vcurrent_prefix_arg = current_kboard->Vprefix_arg; |
1341 | 1353 |
1342 /* Recognize some common commands in common situations and | 1354 /* Recognize some common commands in common situations and |
1343 do them directly. */ | 1355 do them directly. */ |
1344 if (EQ (this_command, Qforward_char) && PT < ZV) | 1356 if (EQ (Vthis_command, Qforward_char) && PT < ZV) |
1345 { | 1357 { |
1346 struct Lisp_Char_Table *dp | 1358 struct Lisp_Char_Table *dp |
1347 = window_display_table (XWINDOW (selected_window)); | 1359 = window_display_table (XWINDOW (selected_window)); |
1348 lose = FETCH_CHAR (PT_BYTE); | 1360 lose = FETCH_CHAR (PT_BYTE); |
1349 SET_PT (PT + 1); | 1361 SET_PT (PT + 1); |
1368 && NILP (XWINDOW (selected_window)->column_number_displayed) | 1380 && NILP (XWINDOW (selected_window)->column_number_displayed) |
1369 && NILP (Vexecuting_macro)) | 1381 && NILP (Vexecuting_macro)) |
1370 no_redisplay = direct_output_forward_char (1); | 1382 no_redisplay = direct_output_forward_char (1); |
1371 goto directly_done; | 1383 goto directly_done; |
1372 } | 1384 } |
1373 else if (EQ (this_command, Qbackward_char) && PT > BEGV) | 1385 else if (EQ (Vthis_command, Qbackward_char) && PT > BEGV) |
1374 { | 1386 { |
1375 struct Lisp_Char_Table *dp | 1387 struct Lisp_Char_Table *dp |
1376 = window_display_table (XWINDOW (selected_window)); | 1388 = window_display_table (XWINDOW (selected_window)); |
1377 SET_PT (PT - 1); | 1389 SET_PT (PT - 1); |
1378 lose = FETCH_CHAR (PT_BYTE); | 1390 lose = FETCH_CHAR (PT_BYTE); |
1394 && NILP (XWINDOW (selected_window)->column_number_displayed) | 1406 && NILP (XWINDOW (selected_window)->column_number_displayed) |
1395 && NILP (Vexecuting_macro)) | 1407 && NILP (Vexecuting_macro)) |
1396 no_redisplay = direct_output_forward_char (-1); | 1408 no_redisplay = direct_output_forward_char (-1); |
1397 goto directly_done; | 1409 goto directly_done; |
1398 } | 1410 } |
1399 else if (EQ (this_command, Qself_insert_command) | 1411 else if (EQ (Vthis_command, Qself_insert_command) |
1400 /* Try this optimization only on ascii keystrokes. */ | 1412 /* Try this optimization only on ascii keystrokes. */ |
1401 && INTEGERP (last_command_char)) | 1413 && INTEGERP (last_command_char)) |
1402 { | 1414 { |
1403 unsigned int c = XINT (last_command_char); | 1415 unsigned int c = XINT (last_command_char); |
1404 int value; | 1416 int value; |
1478 /* Here for a command that isn't executed directly */ | 1490 /* Here for a command that isn't executed directly */ |
1479 | 1491 |
1480 nonundocount = 0; | 1492 nonundocount = 0; |
1481 if (NILP (current_kboard->Vprefix_arg)) | 1493 if (NILP (current_kboard->Vprefix_arg)) |
1482 Fundo_boundary (); | 1494 Fundo_boundary (); |
1483 Fcommand_execute (this_command, Qnil, Qnil, Qnil); | 1495 Fcommand_execute (Vthis_command, Qnil, Qnil, Qnil); |
1484 } | 1496 } |
1485 directly_done: ; | 1497 directly_done: ; |
1486 current_kboard->Vlast_prefix_arg = Vcurrent_prefix_arg; | 1498 current_kboard->Vlast_prefix_arg = Vcurrent_prefix_arg; |
1487 | 1499 |
1488 /* Note that the value cell will never directly contain nil | 1500 /* Note that the value cell will never directly contain nil |
1516 If the command didn't actually create a prefix arg, | 1528 If the command didn't actually create a prefix arg, |
1517 but is merely a frame event that is transparent to prefix args, | 1529 but is merely a frame event that is transparent to prefix args, |
1518 then the above doesn't apply. */ | 1530 then the above doesn't apply. */ |
1519 if (NILP (current_kboard->Vprefix_arg) || CONSP (last_command_char)) | 1531 if (NILP (current_kboard->Vprefix_arg) || CONSP (last_command_char)) |
1520 { | 1532 { |
1521 current_kboard->Vlast_command = this_command; | 1533 current_kboard->Vlast_command = Vthis_command; |
1522 current_kboard->Vreal_last_command = this_command; | 1534 current_kboard->Vreal_last_command = real_this_command; |
1523 cancel_echoing (); | 1535 cancel_echoing (); |
1524 this_command_key_count = 0; | 1536 this_command_key_count = 0; |
1525 this_single_command_key_start = 0; | 1537 this_single_command_key_start = 0; |
1526 } | 1538 } |
1527 | 1539 |
1786 int count; | 1798 int count; |
1787 jmp_buf local_getcjmp; | 1799 jmp_buf local_getcjmp; |
1788 jmp_buf save_jump; | 1800 jmp_buf save_jump; |
1789 int key_already_recorded = 0; | 1801 int key_already_recorded = 0; |
1790 Lisp_Object tem, save; | 1802 Lisp_Object tem, save; |
1803 Lisp_Object echo_area_message; | |
1791 Lisp_Object also_record; | 1804 Lisp_Object also_record; |
1792 int reread; | 1805 int reread; |
1793 struct gcpro gcpro1; | 1806 struct gcpro gcpro1, gcpro2; |
1794 | 1807 |
1795 also_record = Qnil; | 1808 also_record = Qnil; |
1796 | 1809 |
1797 before_command_key_count = this_command_key_count; | 1810 before_command_key_count = this_command_key_count; |
1798 before_command_echo_length = echo_length (); | 1811 before_command_echo_length = echo_length (); |
1799 c = Qnil; | 1812 c = Qnil; |
1800 | 1813 echo_area_message = Qnil; |
1801 GCPRO1 (c); | 1814 |
1815 GCPRO2 (c, echo_area_message); | |
1802 | 1816 |
1803 retry: | 1817 retry: |
1804 | 1818 |
1805 reread = 0; | 1819 reread = 0; |
1806 if (CONSP (Vunread_post_input_method_events)) | 1820 if (CONSP (Vunread_post_input_method_events)) |
2272 any_kboard_state (); | 2286 any_kboard_state (); |
2273 | 2287 |
2274 goto retry; | 2288 goto retry; |
2275 } | 2289 } |
2276 | 2290 |
2277 /* Wipe the echo area. */ | |
2278 if (echo_area_glyphs) | |
2279 safe_run_hooks (Qecho_area_clear_hook); | |
2280 echo_area_glyphs = 0; | |
2281 | |
2282 /* Handle things that only apply to characters. */ | 2291 /* Handle things that only apply to characters. */ |
2283 if (INTEGERP (c)) | 2292 if (INTEGERP (c)) |
2284 { | 2293 { |
2285 /* If kbd_buffer_get_event gave us an EOF, return that. */ | 2294 /* If kbd_buffer_get_event gave us an EOF, return that. */ |
2286 if (XINT (c) == -1) | 2295 if (XINT (c) == -1) |
2329 and the keyboard macro being defined, if any. */ | 2338 and the keyboard macro being defined, if any. */ |
2330 record_char (c); | 2339 record_char (c); |
2331 if (! NILP (also_record)) | 2340 if (! NILP (also_record)) |
2332 record_char (also_record); | 2341 record_char (also_record); |
2333 | 2342 |
2343 /* Wipe the echo area. | |
2344 But first, if we are about to use an input method, | |
2345 save the echo area contents for it to refer to. */ | |
2346 if (INTEGERP (c) | |
2347 && ! NILP (Vinput_method_function) | |
2348 && (unsigned) XINT (c) >= ' ' | |
2349 && (unsigned) XINT (c) < 127) | |
2350 Vinput_method_previous_message = echo_area_message = Fcurrent_message (); | |
2351 | |
2352 /* Now wipe the echo area. */ | |
2353 if (echo_area_glyphs) | |
2354 safe_run_hooks (Qecho_area_clear_hook); | |
2355 echo_area_glyphs = 0; | |
2356 | |
2334 reread_for_input_method: | 2357 reread_for_input_method: |
2335 from_macro: | 2358 from_macro: |
2336 /* Pass this to the input method, if appropriate. */ | 2359 /* Pass this to the input method, if appropriate. */ |
2337 if (INTEGERP (c)) | 2360 if (INTEGERP (c) |
2338 { | 2361 && ! NILP (Vinput_method_function) |
2339 /* If this is a printing character, run the input method. */ | 2362 && (unsigned) XINT (c) >= ' ' |
2340 if (! NILP (Vinput_method_function) | 2363 && (unsigned) XINT (c) < 127) |
2341 && (unsigned) XINT (c) >= ' ' | 2364 { |
2342 && (unsigned) XINT (c) < 127) | 2365 Lisp_Object keys; |
2343 { | 2366 int key_count = this_command_key_count - 1; |
2344 int saved = current_kboard->immediate_echo; | 2367 int saved = current_kboard->immediate_echo; |
2345 tem = call1 (Vinput_method_function, c); | 2368 struct gcpro gcpro1; |
2346 current_kboard->immediate_echo = saved; | 2369 |
2347 /* The input method can return no events. */ | 2370 keys = Fcopy_sequence (this_command_keys); |
2348 if (! CONSP (tem)) | 2371 GCPRO1 (keys); |
2349 goto retry; | 2372 tem = call1 (Vinput_method_function, c); |
2350 /* It returned one event or more. */ | 2373 UNGCPRO; |
2351 c = XCONS (tem)->car; | 2374 current_kboard->immediate_echo = saved; |
2352 Vunread_post_input_method_events | 2375 /* The input method can return no events. */ |
2353 = nconc2 (XCONS (tem)->cdr, Vunread_post_input_method_events); | 2376 if (! CONSP (tem)) |
2354 } | 2377 { |
2378 /* Bring back the previous message, if any. */ | |
2379 if (! NILP (Vinput_method_previous_message)) | |
2380 message_with_string ("%s", echo_area_message, 0); | |
2381 this_command_keys = keys; | |
2382 this_command_key_count = key_count; | |
2383 cancel_echoing (); | |
2384 goto retry; | |
2385 } | |
2386 /* It returned one event or more. */ | |
2387 c = XCONS (tem)->car; | |
2388 Vunread_post_input_method_events | |
2389 = nconc2 (XCONS (tem)->cdr, Vunread_post_input_method_events); | |
2355 } | 2390 } |
2356 | 2391 |
2357 reread_first: | 2392 reread_first: |
2358 | 2393 |
2359 if (this_command_key_count == 0 || ! reread) | 2394 if (this_command_key_count == 0 || ! reread) |
7609 key sequence, or at the start of the sequence but CAN-RETURN-SWITCH-FRAME\n\ | 7644 key sequence, or at the start of the sequence but CAN-RETURN-SWITCH-FRAME\n\ |
7610 is nil, then the event will be put off until after the current key sequence.\n\ | 7645 is nil, then the event will be put off until after the current key sequence.\n\ |
7611 \n\ | 7646 \n\ |
7612 `read-key-sequence' checks `function-key-map' for function key\n\ | 7647 `read-key-sequence' checks `function-key-map' for function key\n\ |
7613 sequences, where they wouldn't conflict with ordinary bindings. See\n\ | 7648 sequences, where they wouldn't conflict with ordinary bindings. See\n\ |
7614 `function-key-map' for more details.") | 7649 `function-key-map' for more details.\n\ |
7650 \n\ | |
7651 The optional fifth argument COMMAND-LOOP, if non-nil, means\n\ | |
7652 that this key sequence is being read by something that will\n\ | |
7653 read commands one after another. It should be nil if the caller\n\ | |
7654 will read just one key sequence.") | |
7615 (prompt, continue_echo, dont_downcase_last, can_return_switch_frame) | 7655 (prompt, continue_echo, dont_downcase_last, can_return_switch_frame) |
7616 #endif | 7656 #endif |
7617 | 7657 |
7618 DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 4, 0, | 7658 DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 5, 0, |
7619 0) | 7659 0) |
7620 (prompt, continue_echo, dont_downcase_last, can_return_switch_frame) | 7660 (prompt, continue_echo, dont_downcase_last, can_return_switch_frame, |
7661 command_loop) | |
7621 Lisp_Object prompt, continue_echo, dont_downcase_last; | 7662 Lisp_Object prompt, continue_echo, dont_downcase_last; |
7622 Lisp_Object can_return_switch_frame; | 7663 Lisp_Object can_return_switch_frame, command_loop; |
7623 { | 7664 { |
7624 Lisp_Object keybuf[30]; | 7665 Lisp_Object keybuf[30]; |
7625 register int i; | 7666 register int i; |
7626 struct gcpro gcpro1, gcpro2; | 7667 struct gcpro gcpro1, gcpro2; |
7668 int count = specpdl_ptr - specpdl; | |
7627 | 7669 |
7628 if (!NILP (prompt)) | 7670 if (!NILP (prompt)) |
7629 CHECK_STRING (prompt, 0); | 7671 CHECK_STRING (prompt, 0); |
7630 QUIT; | 7672 QUIT; |
7631 | 7673 |
7674 specbind (Qinput_method_exit_on_first_char, | |
7675 (NILP (command_loop) ? Qt : Qnil)); | |
7676 specbind (Qinput_method_use_echo_area, | |
7677 (NILP (command_loop) ? Qt : Qnil)); | |
7678 | |
7632 bzero (keybuf, sizeof keybuf); | 7679 bzero (keybuf, sizeof keybuf); |
7633 GCPRO1 (keybuf[0]); | 7680 GCPRO1 (keybuf[0]); |
7634 gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); | 7681 gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); |
7635 | 7682 |
7636 if (NILP (continue_echo)) | 7683 if (NILP (continue_echo)) |
7647 { | 7694 { |
7648 Vquit_flag = Qt; | 7695 Vquit_flag = Qt; |
7649 QUIT; | 7696 QUIT; |
7650 } | 7697 } |
7651 UNGCPRO; | 7698 UNGCPRO; |
7652 return make_event_array (i, keybuf); | 7699 return unbind_to (count, make_event_array (i, keybuf)); |
7653 } | 7700 } |
7654 | 7701 |
7655 DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, | 7702 DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, |
7656 Sread_key_sequence_vector, 1, 4, 0, | 7703 Sread_key_sequence_vector, 1, 5, 0, |
7657 "Like `read-key-sequence' but always return a vector.") | 7704 "Like `read-key-sequence' but always return a vector.") |
7658 (prompt, continue_echo, dont_downcase_last, can_return_switch_frame) | 7705 (prompt, continue_echo, dont_downcase_last, can_return_switch_frame, |
7706 command_loop) | |
7659 Lisp_Object prompt, continue_echo, dont_downcase_last; | 7707 Lisp_Object prompt, continue_echo, dont_downcase_last; |
7660 Lisp_Object can_return_switch_frame; | 7708 Lisp_Object can_return_switch_frame, command_loop; |
7661 { | 7709 { |
7662 Lisp_Object keybuf[30]; | 7710 Lisp_Object keybuf[30]; |
7663 register int i; | 7711 register int i; |
7664 struct gcpro gcpro1, gcpro2; | 7712 struct gcpro gcpro1, gcpro2; |
7713 int count = specpdl_ptr - specpdl; | |
7665 | 7714 |
7666 if (!NILP (prompt)) | 7715 if (!NILP (prompt)) |
7667 CHECK_STRING (prompt, 0); | 7716 CHECK_STRING (prompt, 0); |
7668 QUIT; | 7717 QUIT; |
7669 | 7718 |
7719 specbind (Qinput_method_exit_on_first_char, | |
7720 (NILP (command_loop) ? Qt : Qnil)); | |
7721 specbind (Qinput_method_use_echo_area, | |
7722 (NILP (command_loop) ? Qt : Qnil)); | |
7723 | |
7670 bzero (keybuf, sizeof keybuf); | 7724 bzero (keybuf, sizeof keybuf); |
7671 GCPRO1 (keybuf[0]); | 7725 GCPRO1 (keybuf[0]); |
7672 gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); | 7726 gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); |
7673 | 7727 |
7674 if (NILP (continue_echo)) | 7728 if (NILP (continue_echo)) |
7685 { | 7739 { |
7686 Vquit_flag = Qt; | 7740 Vquit_flag = Qt; |
7687 QUIT; | 7741 QUIT; |
7688 } | 7742 } |
7689 UNGCPRO; | 7743 UNGCPRO; |
7690 return Fvector (i, keybuf); | 7744 return unbind_to (count, Fvector (i, keybuf)); |
7691 } | 7745 } |
7692 | 7746 |
7693 DEFUN ("command-execute", Fcommand_execute, Scommand_execute, 1, 4, 0, | 7747 DEFUN ("command-execute", Fcommand_execute, Scommand_execute, 1, 4, 0, |
7694 "Execute CMD as an editor command.\n\ | 7748 "Execute CMD as an editor command.\n\ |
7695 CMD must be a symbol that satisfies the `commandp' predicate.\n\ | 7749 CMD must be a symbol that satisfies the `commandp' predicate.\n\ |
7868 | 7922 |
7869 UNGCPRO; | 7923 UNGCPRO; |
7870 | 7924 |
7871 function = Fintern (function, Qnil); | 7925 function = Fintern (function, Qnil); |
7872 current_kboard->Vprefix_arg = prefixarg; | 7926 current_kboard->Vprefix_arg = prefixarg; |
7873 this_command = function; | 7927 Vthis_command = function; |
7928 real_this_command = function; | |
7874 | 7929 |
7875 /* If enabled, show which key runs this command. */ | 7930 /* If enabled, show which key runs this command. */ |
7876 if (!NILP (Vsuggest_key_bindings) | 7931 if (!NILP (Vsuggest_key_bindings) |
7877 && NILP (Vexecuting_macro) | 7932 && NILP (Vexecuting_macro) |
7878 && SYMBOLP (function)) | 7933 && SYMBOLP (function)) |
8734 syms_of_keyboard () | 8789 syms_of_keyboard () |
8735 { | 8790 { |
8736 staticpro (&item_properties); | 8791 staticpro (&item_properties); |
8737 item_properties = Qnil; | 8792 item_properties = Qnil; |
8738 | 8793 |
8794 staticpro (&real_this_command); | |
8795 real_this_command = Qnil; | |
8796 | |
8739 Qtimer_event_handler = intern ("timer-event-handler"); | 8797 Qtimer_event_handler = intern ("timer-event-handler"); |
8740 staticpro (&Qtimer_event_handler); | 8798 staticpro (&Qtimer_event_handler); |
8741 | 8799 |
8742 Qdisabled_command_hook = intern ("disabled-command-hook"); | 8800 Qdisabled_command_hook = intern ("disabled-command-hook"); |
8743 staticpro (&Qdisabled_command_hook); | 8801 staticpro (&Qdisabled_command_hook); |
8842 staticpro (&Qpolling_period); | 8900 staticpro (&Qpolling_period); |
8843 | 8901 |
8844 Qinput_method_function = intern ("input-method-function"); | 8902 Qinput_method_function = intern ("input-method-function"); |
8845 staticpro (&Qinput_method_function); | 8903 staticpro (&Qinput_method_function); |
8846 | 8904 |
8905 Qinput_method_exit_on_first_char = intern ("input-method-exit-on-first-char"); | |
8906 staticpro (&Qinput_method_exit_on_first_char); | |
8907 Qinput_method_use_echo_area = intern ("input-method-use-echo-area"); | |
8908 staticpro (&Qinput_method_use_echo_area); | |
8909 | |
8910 Fset (Qinput_method_exit_on_first_char, Qnil); | |
8911 Fset (Qinput_method_use_echo_area, Qnil); | |
8912 | |
8847 { | 8913 { |
8848 struct event_head *p; | 8914 struct event_head *p; |
8849 | 8915 |
8850 for (p = head_table; | 8916 for (p = head_table; |
8851 p < head_table + (sizeof (head_table) / sizeof (head_table[0])); | 8917 p < head_table + (sizeof (head_table) / sizeof (head_table[0])); |
8998 was a kill command."); | 9064 was a kill command."); |
8999 | 9065 |
9000 DEFVAR_KBOARD ("real-last-command", Vreal_last_command, | 9066 DEFVAR_KBOARD ("real-last-command", Vreal_last_command, |
9001 "Same as `last-command', but never altered by Lisp code."); | 9067 "Same as `last-command', but never altered by Lisp code."); |
9002 | 9068 |
9003 DEFVAR_LISP ("this-command", &this_command, | 9069 DEFVAR_LISP ("this-command", &Vthis_command, |
9004 "The command now being executed.\n\ | 9070 "The command now being executed.\n\ |
9005 The command can set this variable; whatever is put here\n\ | 9071 The command can set this variable; whatever is put here\n\ |
9006 will be in `last-command' during the following command."); | 9072 will be in `last-command' during the following command."); |
9007 this_command = Qnil; | 9073 Vthis_command = Qnil; |
9008 | 9074 |
9009 DEFVAR_INT ("auto-save-interval", &auto_save_interval, | 9075 DEFVAR_INT ("auto-save-interval", &auto_save_interval, |
9010 "*Number of keyboard input characters between auto-saves.\n\ | 9076 "*Number of keyboard input characters between auto-saves.\n\ |
9011 Zero means disable autosaving due to number of characters typed."); | 9077 Zero means disable autosaving due to number of characters typed."); |
9012 auto_save_interval = 300; | 9078 auto_save_interval = 300; |
9245 so it will not be called recursively.\n\ | 9311 so it will not be called recursively.\n\ |
9246 \n\ | 9312 \n\ |
9247 The function should return a list of zero or more events\n\ | 9313 The function should return a list of zero or more events\n\ |
9248 to be used as input. If it wants to put back some events\n\ | 9314 to be used as input. If it wants to put back some events\n\ |
9249 to be reconsidered, separately, by the input method,\n\ | 9315 to be reconsidered, separately, by the input method,\n\ |
9250 it can add them to the beginning of `unread-command-events'."); | 9316 it can add them to the beginning of `unread-command-events'.\n\ |
9317 \n\ | |
9318 The input method function can find in `input-method-previous-method'\n\ | |
9319 the previous echo area message.\n\ | |
9320 \n\ | |
9321 The input method function should refer to the variables\n\ | |
9322 `input-method-use-echo-area' and `input-method-exit-on-first-char'\n\ | |
9323 for guidance on what to do."); | |
9251 Vinput_method_function = Qnil; | 9324 Vinput_method_function = Qnil; |
9325 | |
9326 DEFVAR_LISP ("input-method-previous-message", | |
9327 &Vinput_method_previous_message, | |
9328 "When `input-mehod-function' is called, hold the previous echo area message.\n\ | |
9329 This variable exists because `read-event' clears the echo area\n\ | |
9330 before running the input method. It is nil if there was no message."); | |
9331 Vinput_method_previous_message = Qnil; | |
9252 } | 9332 } |
9253 | 9333 |
9254 void | 9334 void |
9255 keys_of_keyboard () | 9335 keys_of_keyboard () |
9256 { | 9336 { |