aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-08-03 11:36:48 +0000
committerGerd Moellmann2001-08-03 11:36:48 +0000
commitf4e05d97a864e835f1852a3d4276696b0211a71a (patch)
treebd426027689963a5325418bf9e44c39226a3ab30 /src
parent18f9986a54c53f7712fee3bda487fb49771183f3 (diff)
downloademacs-f4e05d97a864e835f1852a3d4276696b0211a71a.tar.gz
emacs-f4e05d97a864e835f1852a3d4276696b0211a71a.zip
(read_key_sequence): Check that key is an integer
before comparing it with quit_char. (add_command_key): Use larger_vector. (read_char_x_menu_prompt): Instead of converting symbol and integer events into conses (EVENT . nil), use (EVENT . disabled) which cannot be confused with legal events. (read_char): When reading from Vunread_command_events, check for events of the form (EVENT . disabled) instead of (EVENT . nil).
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 66519b6370a..754df8bbda1 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -885,8 +885,6 @@ static void
885add_command_key (key) 885add_command_key (key)
886 Lisp_Object key; 886 Lisp_Object key;
887{ 887{
888 int size = XVECTOR (this_command_keys)->size;
889
890 /* If reset-this-command-length was called recently, obey it now. 888 /* If reset-this-command-length was called recently, obey it now.
891 See the doc string of that function for an explanation of why. */ 889 See the doc string of that function for an explanation of why. */
892 if (before_command_restore_flag) 890 if (before_command_restore_flag)
@@ -898,20 +896,15 @@ add_command_key (key)
898 before_command_restore_flag = 0; 896 before_command_restore_flag = 0;
899 } 897 }
900 898
901 if (this_command_key_count >= size) 899 if (this_command_key_count >= ASIZE (this_command_keys))
902 { 900 this_command_keys = larger_vector (this_command_keys,
903 Lisp_Object new_keys; 901 2 * ASIZE (this_command_keys),
904 902 Qnil);
905 new_keys = Fmake_vector (make_number (size * 2), Qnil);
906 bcopy (XVECTOR (this_command_keys)->contents,
907 XVECTOR (new_keys)->contents,
908 size * sizeof (Lisp_Object));
909
910 this_command_keys = new_keys;
911 }
912 903
913 XVECTOR (this_command_keys)->contents[this_command_key_count++] = key; 904 AREF (this_command_keys, this_command_key_count) = key;
905 ++this_command_key_count;
914} 906}
907
915 908
916Lisp_Object 909Lisp_Object
917recursive_edit_1 () 910recursive_edit_1 ()
@@ -2149,10 +2142,10 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2149 /* Undo what read_char_x_menu_prompt did when it unread 2142 /* Undo what read_char_x_menu_prompt did when it unread
2150 additional keys returned by Fx_popup_menu. */ 2143 additional keys returned by Fx_popup_menu. */
2151 if (CONSP (c) 2144 if (CONSP (c)
2152 && (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c))) 2145 && EQ (XCDR (c), Qdisabled)
2153 && NILP (XCDR (c))) 2146 && (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c))))
2154 c = XCAR (c); 2147 c = XCAR (c);
2155 2148
2156 /* If the queued event is something that used the mouse, 2149 /* If the queued event is something that used the mouse,
2157 set used_mouse_menu accordingly. */ 2150 set used_mouse_menu accordingly. */
2158 if (used_mouse_menu 2151 if (used_mouse_menu
@@ -7421,14 +7414,12 @@ read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu)
7421 to indicate that they came from a mouse menu, 7414 to indicate that they came from a mouse menu,
7422 so that when present in last_nonmenu_event 7415 so that when present in last_nonmenu_event
7423 they won't confuse things. */ 7416 they won't confuse things. */
7424 for (tem = XCDR (value); !NILP (tem); 7417 for (tem = XCDR (value); !NILP (tem); tem = XCDR (tem))
7425 tem = XCDR (tem))
7426 { 7418 {
7427 record_menu_key (XCAR (tem)); 7419 record_menu_key (XCAR (tem));
7428 if (SYMBOLP (XCAR (tem)) 7420 if (SYMBOLP (XCAR (tem))
7429 || INTEGERP (XCAR (tem))) 7421 || INTEGERP (XCAR (tem)))
7430 XCAR (tem) 7422 XCAR (tem) = Fcons (XCAR (tem), Qdisabled);
7431 = Fcons (XCAR (tem), Qnil);
7432 } 7423 }
7433 7424
7434 /* If we got more than one event, put all but the first 7425 /* If we got more than one event, put all but the first
@@ -8183,7 +8174,9 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8183 /* If we have a quit that was typed in another frame, and 8174 /* If we have a quit that was typed in another frame, and
8184 quit_throw_to_read_char switched buffers, 8175 quit_throw_to_read_char switched buffers,
8185 replay to get the right keymap. */ 8176 replay to get the right keymap. */
8186 if (XINT (key) == quit_char && current_buffer != starting_buffer) 8177 if (INTEGERP (key)
8178 && XINT (key) == quit_char
8179 && current_buffer != starting_buffer)
8187 { 8180 {
8188 GROW_RAW_KEYBUF; 8181 GROW_RAW_KEYBUF;
8189 XVECTOR (raw_keybuf)->contents[raw_keybuf_count++] = key; 8182 XVECTOR (raw_keybuf)->contents[raw_keybuf_count++] = key;