Mercurial > emacs
comparison src/keyboard.c @ 18886:c24b5da01b1f
(Fcommand_execute): gcpro c.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 20 Jul 1997 17:46:17 +0000 |
parents | 7626e0d30719 |
children | e7a1ad118598 |
comparison
equal
deleted
inserted
replaced
18885:f7b6579204b8 | 18886:c24b5da01b1f |
---|---|
1696 int nmaps; | 1696 int nmaps; |
1697 Lisp_Object *maps; | 1697 Lisp_Object *maps; |
1698 Lisp_Object prev_event; | 1698 Lisp_Object prev_event; |
1699 int *used_mouse_menu; | 1699 int *used_mouse_menu; |
1700 { | 1700 { |
1701 register Lisp_Object c; | 1701 Lisp_Object c; |
1702 int count; | 1702 int count; |
1703 jmp_buf local_getcjmp; | 1703 jmp_buf local_getcjmp; |
1704 jmp_buf save_jump; | 1704 jmp_buf save_jump; |
1705 int key_already_recorded = 0; | 1705 int key_already_recorded = 0; |
1706 Lisp_Object tem, save; | 1706 Lisp_Object tem, save; |
1707 Lisp_Object also_record; | 1707 Lisp_Object also_record; |
1708 struct gcpro gcpro1; | |
1709 | |
1708 also_record = Qnil; | 1710 also_record = Qnil; |
1709 | 1711 |
1710 before_command_key_count = this_command_key_count; | 1712 before_command_key_count = this_command_key_count; |
1711 before_command_echo_length = echo_length (); | 1713 before_command_echo_length = echo_length (); |
1714 | |
1715 GCPRO1 (c); | |
1712 | 1716 |
1713 retry: | 1717 retry: |
1714 | 1718 |
1715 if (CONSP (Vunread_command_events)) | 1719 if (CONSP (Vunread_command_events)) |
1716 { | 1720 { |
1764 to force an early exit. */ | 1768 to force an early exit. */ |
1765 if (EQ (Vexecuting_macro, Qt) | 1769 if (EQ (Vexecuting_macro, Qt) |
1766 || executing_macro_index >= XFASTINT (Flength (Vexecuting_macro))) | 1770 || executing_macro_index >= XFASTINT (Flength (Vexecuting_macro))) |
1767 { | 1771 { |
1768 XSETINT (c, -1); | 1772 XSETINT (c, -1); |
1769 return c; | 1773 RETURN_UNGCPRO (c); |
1770 } | 1774 } |
1771 | 1775 |
1772 c = Faref (Vexecuting_macro, make_number (executing_macro_index)); | 1776 c = Faref (Vexecuting_macro, make_number (executing_macro_index)); |
1773 if (STRINGP (Vexecuting_macro) | 1777 if (STRINGP (Vexecuting_macro) |
1774 && (XINT (c) & 0x80)) | 1778 && (XINT (c) & 0x80)) |
1927 c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu); | 1931 c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu); |
1928 | 1932 |
1929 /* Now that we have read an event, Emacs is not idle. */ | 1933 /* Now that we have read an event, Emacs is not idle. */ |
1930 timer_stop_idle (); | 1934 timer_stop_idle (); |
1931 | 1935 |
1932 return c; | 1936 RETURN_UNGCPRO (c); |
1933 } | 1937 } |
1934 | 1938 |
1935 /* Maybe autosave and/or garbage collect due to idleness. */ | 1939 /* Maybe autosave and/or garbage collect due to idleness. */ |
1936 | 1940 |
1937 if (INTERACTIVE && NILP (c)) | 1941 if (INTERACTIVE && NILP (c)) |
2102 } | 2106 } |
2103 | 2107 |
2104 non_reread_1: | 2108 non_reread_1: |
2105 | 2109 |
2106 /* Buffer switch events are only for internal wakeups | 2110 /* Buffer switch events are only for internal wakeups |
2107 so don't show them to the user. */ | 2111 so don't show them to the user. |
2108 if (BUFFERP (c)) | 2112 Also, don't record a key if we already did. */ |
2109 return c; | 2113 if (BUFFERP (c) || key_already_recorded) |
2110 | 2114 RETURN_UNGCPRO (c); |
2111 if (key_already_recorded) | |
2112 return c; | |
2113 | 2115 |
2114 /* Process special events within read_char | 2116 /* Process special events within read_char |
2115 and loop around to read another event. */ | 2117 and loop around to read another event. */ |
2116 save = Vquit_flag; | 2118 save = Vquit_flag; |
2117 Vquit_flag = Qnil; | 2119 Vquit_flag = Qnil; |
2141 /* Handle things that only apply to characters. */ | 2143 /* Handle things that only apply to characters. */ |
2142 if (INTEGERP (c)) | 2144 if (INTEGERP (c)) |
2143 { | 2145 { |
2144 /* If kbd_buffer_get_event gave us an EOF, return that. */ | 2146 /* If kbd_buffer_get_event gave us an EOF, return that. */ |
2145 if (XINT (c) == -1) | 2147 if (XINT (c) == -1) |
2146 return c; | 2148 RETURN_UNGCPRO (c); |
2147 | 2149 |
2148 if (STRINGP (Vkeyboard_translate_table) | 2150 if (STRINGP (Vkeyboard_translate_table) |
2149 && XSTRING (Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) | 2151 && XSTRING (Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) |
2150 XSETINT (c, XSTRING (Vkeyboard_translate_table)->data[XFASTINT (c)]); | 2152 XSETINT (c, XSTRING (Vkeyboard_translate_table)->data[XFASTINT (c)]); |
2151 else if ((VECTORP (Vkeyboard_translate_table) | 2153 else if ((VECTORP (Vkeyboard_translate_table) |
2187 | 2189 |
2188 record_char (c); | 2190 record_char (c); |
2189 if (! NILP (also_record)) | 2191 if (! NILP (also_record)) |
2190 record_char (also_record); | 2192 record_char (also_record); |
2191 | 2193 |
2194 UNGCPRO; | |
2195 | |
2192 from_macro: | 2196 from_macro: |
2193 reread_first: | 2197 reread_first: |
2198 | |
2194 before_command_key_count = this_command_key_count; | 2199 before_command_key_count = this_command_key_count; |
2195 before_command_echo_length = echo_length (); | 2200 before_command_echo_length = echo_length (); |
2196 | 2201 |
2197 /* Don't echo mouse motion events. */ | 2202 /* Don't echo mouse motion events. */ |
2198 if (echo_keystrokes | 2203 if (echo_keystrokes |
2245 c = read_char (0, 0, 0, Qnil, 0); | 2250 c = read_char (0, 0, 0, Qnil, 0); |
2246 while (BUFFERP (c)); | 2251 while (BUFFERP (c)); |
2247 } | 2252 } |
2248 } | 2253 } |
2249 | 2254 |
2250 return c; | 2255 RETURN_UNGCPRO (c); |
2251 } | 2256 } |
2252 | 2257 |
2253 /* Record a key that came from a mouse menu. | 2258 /* Record a key that came from a mouse menu. |
2254 Record it for echoing, for this-command-keys, and so on. */ | 2259 Record it for echoing, for this-command-keys, and so on. */ |
2255 | 2260 |