Mercurial > emacs
comparison src/keyboard.c @ 101000:ee5456efd63c
(last_command_char): For clarity, rename to...
(last_command-event): ... and update all users.
(last_input_char): For clarity, rename to...
(last_input_event): ... and update all users.
(last-command-char, last-input-char): Move to subr.el as aliases.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Fri, 09 Jan 2009 03:30:02 +0000 |
parents | e038c1a8307c |
children | 7981035d8c66 |
comparison
equal
deleted
inserted
replaced
100999:58dada904f85 | 101000:ee5456efd63c |
---|---|
257 int command_loop_level; | 257 int command_loop_level; |
258 | 258 |
259 /* Total number of times command_loop has read a key sequence. */ | 259 /* Total number of times command_loop has read a key sequence. */ |
260 EMACS_INT num_input_keys; | 260 EMACS_INT num_input_keys; |
261 | 261 |
262 /* Last input character read as a command. */ | 262 /* Last input event read as a command. */ |
263 Lisp_Object last_command_char; | 263 Lisp_Object last_command_event; |
264 | 264 |
265 /* Last input character read as a command, not counting menus | 265 /* Last input character read as a command, not counting menus |
266 reached by the mouse. */ | 266 reached by the mouse. */ |
267 Lisp_Object last_nonmenu_event; | 267 Lisp_Object last_nonmenu_event; |
268 | 268 |
269 /* Last input character read for any purpose. */ | 269 /* Last input event read for any purpose. */ |
270 Lisp_Object last_input_char; | 270 Lisp_Object last_input_event; |
271 | 271 |
272 /* If not Qnil, a list of objects to be read as subsequent command input. */ | 272 /* If not Qnil, a list of objects to be read as subsequent command input. */ |
273 Lisp_Object Vunread_command_events; | 273 Lisp_Object Vunread_command_events; |
274 | 274 |
275 /* If not Qnil, a list of objects to be read as subsequent command input | 275 /* If not Qnil, a list of objects to be read as subsequent command input |
1554 } | 1554 } |
1555 | 1555 |
1556 /* Do this after running Vpost_command_hook, for consistency. */ | 1556 /* Do this after running Vpost_command_hook, for consistency. */ |
1557 current_kboard->Vlast_command = Vthis_command; | 1557 current_kboard->Vlast_command = Vthis_command; |
1558 current_kboard->Vreal_last_command = real_this_command; | 1558 current_kboard->Vreal_last_command = real_this_command; |
1559 if (!CONSP (last_command_char)) | 1559 if (!CONSP (last_command_event)) |
1560 current_kboard->Vlast_repeatable_command = real_this_command; | 1560 current_kboard->Vlast_repeatable_command = real_this_command; |
1561 | 1561 |
1562 while (1) | 1562 while (1) |
1563 { | 1563 { |
1564 if (! FRAME_LIVE_P (XFRAME (selected_frame))) | 1564 if (! FRAME_LIVE_P (XFRAME (selected_frame))) |
1654 this_command_key_count_reset = 0; | 1654 this_command_key_count_reset = 0; |
1655 this_single_command_key_start = 0; | 1655 this_single_command_key_start = 0; |
1656 goto finalize; | 1656 goto finalize; |
1657 } | 1657 } |
1658 | 1658 |
1659 last_command_char = keybuf[i - 1]; | 1659 last_command_event = keybuf[i - 1]; |
1660 | 1660 |
1661 /* If the previous command tried to force a specific window-start, | 1661 /* If the previous command tried to force a specific window-start, |
1662 forget about that, in case this command moves point far away | 1662 forget about that, in case this command moves point far away |
1663 from that position. But also throw away beg_unchanged and | 1663 from that position. But also throw away beg_unchanged and |
1664 end_unchanged information in that case, so that redisplay will | 1664 end_unchanged information in that case, so that redisplay will |
1819 direct_output_forward_char (-1); | 1819 direct_output_forward_char (-1); |
1820 goto directly_done; | 1820 goto directly_done; |
1821 } | 1821 } |
1822 else if (EQ (Vthis_command, Qself_insert_command) | 1822 else if (EQ (Vthis_command, Qself_insert_command) |
1823 /* Try this optimization only on char keystrokes. */ | 1823 /* Try this optimization only on char keystrokes. */ |
1824 && NATNUMP (last_command_char) | 1824 && NATNUMP (last_command_event) |
1825 && CHAR_VALID_P (XFASTINT (last_command_char), 0)) | 1825 && CHAR_VALID_P (XFASTINT (last_command_event), 0)) |
1826 { | 1826 { |
1827 unsigned int c | 1827 unsigned int c |
1828 = translate_char (Vtranslation_table_for_input, | 1828 = translate_char (Vtranslation_table_for_input, |
1829 XFASTINT (last_command_char)); | 1829 XFASTINT (last_command_event)); |
1830 int value; | 1830 int value; |
1831 if (NILP (Vexecuting_kbd_macro) | 1831 if (NILP (Vexecuting_kbd_macro) |
1832 && !EQ (minibuf_window, selected_window)) | 1832 && !EQ (minibuf_window, selected_window)) |
1833 { | 1833 { |
1834 if (!nonundocount || nonundocount >= 20) | 1834 if (!nonundocount || nonundocount >= 20) |
1928 not echo it a second time. | 1928 not echo it a second time. |
1929 | 1929 |
1930 If the command didn't actually create a prefix arg, | 1930 If the command didn't actually create a prefix arg, |
1931 but is merely a frame event that is transparent to prefix args, | 1931 but is merely a frame event that is transparent to prefix args, |
1932 then the above doesn't apply. */ | 1932 then the above doesn't apply. */ |
1933 if (NILP (current_kboard->Vprefix_arg) || CONSP (last_command_char)) | 1933 if (NILP (current_kboard->Vprefix_arg) || CONSP (last_command_event)) |
1934 { | 1934 { |
1935 current_kboard->Vlast_command = Vthis_command; | 1935 current_kboard->Vlast_command = Vthis_command; |
1936 current_kboard->Vreal_last_command = real_this_command; | 1936 current_kboard->Vreal_last_command = real_this_command; |
1937 if (!CONSP (last_command_char)) | 1937 if (!CONSP (last_command_event)) |
1938 current_kboard->Vlast_repeatable_command = real_this_command; | 1938 current_kboard->Vlast_repeatable_command = real_this_command; |
1939 cancel_echoing (); | 1939 cancel_echoing (); |
1940 this_command_key_count = 0; | 1940 this_command_key_count = 0; |
1941 this_command_key_count_reset = 0; | 1941 this_command_key_count_reset = 0; |
1942 this_single_command_key_start = 0; | 1942 this_single_command_key_start = 0; |
3092 int was_locked = single_kboard; | 3092 int was_locked = single_kboard; |
3093 int count = SPECPDL_INDEX (); | 3093 int count = SPECPDL_INDEX (); |
3094 record_single_kboard_state (); | 3094 record_single_kboard_state (); |
3095 #endif | 3095 #endif |
3096 | 3096 |
3097 last_input_char = c; | 3097 last_input_event = c; |
3098 Fcommand_execute (tem, Qnil, Fvector (1, &last_input_char), Qt); | 3098 Fcommand_execute (tem, Qnil, Fvector (1, &last_input_event), Qt); |
3099 | 3099 |
3100 if (CONSP (c) && EQ (XCAR (c), Qselect_window) && !end_time) | 3100 if (CONSP (c) && EQ (XCAR (c), Qselect_window) && !end_time) |
3101 /* We stopped being idle for this event; undo that. This | 3101 /* We stopped being idle for this event; undo that. This |
3102 prevents automatic window selection (under | 3102 prevents automatic window selection (under |
3103 mouse_autoselect_window from acting as a real input event, for | 3103 mouse_autoselect_window from acting as a real input event, for |
3334 add_command_key (c); | 3334 add_command_key (c); |
3335 if (! NILP (also_record)) | 3335 if (! NILP (also_record)) |
3336 add_command_key (also_record); | 3336 add_command_key (also_record); |
3337 } | 3337 } |
3338 | 3338 |
3339 last_input_char = c; | 3339 last_input_event = c; |
3340 num_input_events++; | 3340 num_input_events++; |
3341 | 3341 |
3342 /* Process the help character specially if enabled */ | 3342 /* Process the help character specially if enabled */ |
3343 if (!NILP (Vhelp_form) && help_char_p (c)) | 3343 if (!NILP (Vhelp_form) && help_char_p (c)) |
3344 { | 3344 { |
3411 | 3411 |
3412 /* Record this character as part of the current key. */ | 3412 /* Record this character as part of the current key. */ |
3413 add_command_key (c); | 3413 add_command_key (c); |
3414 | 3414 |
3415 /* Re-reading in the middle of a command */ | 3415 /* Re-reading in the middle of a command */ |
3416 last_input_char = c; | 3416 last_input_event = c; |
3417 num_input_events++; | 3417 num_input_events++; |
3418 } | 3418 } |
3419 | 3419 |
3420 /* Return 1 if should recognize C as "the help character". */ | 3420 /* Return 1 if should recognize C as "the help character". */ |
3421 | 3421 |
11868 defsubr (&Scurrent_input_mode); | 11868 defsubr (&Scurrent_input_mode); |
11869 defsubr (&Sexecute_extended_command); | 11869 defsubr (&Sexecute_extended_command); |
11870 defsubr (&Sposn_at_point); | 11870 defsubr (&Sposn_at_point); |
11871 defsubr (&Sposn_at_x_y); | 11871 defsubr (&Sposn_at_x_y); |
11872 | 11872 |
11873 DEFVAR_LISP ("last-command-char", &last_command_char, | 11873 DEFVAR_LISP ("last-command-event", &last_command_event, |
11874 doc: /* Last input event that was part of a command. */); | |
11875 | |
11876 DEFVAR_LISP_NOPRO ("last-command-event", &last_command_char, | |
11877 doc: /* Last input event that was part of a command. */); | 11874 doc: /* Last input event that was part of a command. */); |
11878 | 11875 |
11879 DEFVAR_LISP ("last-nonmenu-event", &last_nonmenu_event, | 11876 DEFVAR_LISP ("last-nonmenu-event", &last_nonmenu_event, |
11880 doc: /* Last input event in a command, except for mouse menu events. | 11877 doc: /* Last input event in a command, except for mouse menu events. |
11881 Mouse menus give back keys that don't look like mouse events; | 11878 Mouse menus give back keys that don't look like mouse events; |
11882 this variable holds the actual mouse event that led to the menu, | 11879 this variable holds the actual mouse event that led to the menu, |
11883 so that you can determine whether the command was run by mouse or not. */); | 11880 so that you can determine whether the command was run by mouse or not. */); |
11884 | 11881 |
11885 DEFVAR_LISP ("last-input-char", &last_input_char, | 11882 DEFVAR_LISP ("last-input-event", &last_input_event, |
11886 doc: /* Last input event. */); | 11883 doc: /* Last input event. */); |
11887 | |
11888 DEFVAR_LISP_NOPRO ("last-input-event", &last_input_char, | |
11889 doc: /* Last input event. */); | |
11890 | 11884 |
11891 DEFVAR_LISP ("unread-command-events", &Vunread_command_events, | 11885 DEFVAR_LISP ("unread-command-events", &Vunread_command_events, |
11892 doc: /* List of events to be read as the command input. | 11886 doc: /* List of events to be read as the command input. |
11893 These events are processed first, before actual keyboard input. | 11887 These events are processed first, before actual keyboard input. |
11894 Events read from this list are not normally added to `this-command-keys', | 11888 Events read from this list are not normally added to `this-command-keys', |