Mercurial > emacs
comparison src/keyboard.c @ 17389:ab5d66b86b2c
(read_key_sequence): New argument FIX_CURRENT_BUFFER.
Restore the current buffer from selected window on occasion.
All callers changed.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 11 Apr 1997 08:21:38 +0000 |
parents | 0bd89f686cb6 |
children | b2629af2145e |
comparison
equal
deleted
inserted
replaced
17388:5c4602f0c45d | 17389:ab5d66b86b2c |
---|---|
1181 | 1181 |
1182 this_command = Qnil; | 1182 this_command = Qnil; |
1183 | 1183 |
1184 /* Read next key sequence; i gets its length. */ | 1184 /* Read next key sequence; i gets its length. */ |
1185 i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0], | 1185 i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0], |
1186 Qnil, 0, 1); | 1186 Qnil, 0, 1, 1); |
1187 | 1187 |
1188 /* A filter may have run while we were reading the input. */ | 1188 /* A filter may have run while we were reading the input. */ |
1189 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) | 1189 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) |
1190 set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); | 1190 set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); |
1191 | 1191 |
5871 If the sequence starts with a mouse click, we read the key sequence | 5871 If the sequence starts with a mouse click, we read the key sequence |
5872 with respect to the buffer clicked on, not the current buffer. | 5872 with respect to the buffer clicked on, not the current buffer. |
5873 | 5873 |
5874 If the user switches frames in the midst of a key sequence, we put | 5874 If the user switches frames in the midst of a key sequence, we put |
5875 off the switch-frame event until later; the next call to | 5875 off the switch-frame event until later; the next call to |
5876 read_char will return it. */ | 5876 read_char will return it. |
5877 | |
5878 If FIX_CURRENT_BUFFER is nonzero, we restore current_buffer | |
5879 from the selected window's buffer. */ | |
5877 | 5880 |
5878 static int | 5881 static int |
5879 read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | 5882 read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, |
5880 can_return_switch_frame) | 5883 can_return_switch_frame, fix_current_buffer) |
5881 Lisp_Object *keybuf; | 5884 Lisp_Object *keybuf; |
5882 int bufsize; | 5885 int bufsize; |
5883 Lisp_Object prompt; | 5886 Lisp_Object prompt; |
5884 int dont_downcase_last; | 5887 int dont_downcase_last; |
5885 int can_return_switch_frame; | 5888 int can_return_switch_frame; |
5889 int fix_current_buffer; | |
5886 { | 5890 { |
5887 int count = specpdl_ptr - specpdl; | 5891 int count = specpdl_ptr - specpdl; |
5888 | 5892 |
5889 /* How many keys there are in the current key sequence. */ | 5893 /* How many keys there are in the current key sequence. */ |
5890 int t; | 5894 int t; |
6220 /* If the current buffer has been changed from under us, the | 6224 /* If the current buffer has been changed from under us, the |
6221 keymap may have changed, so replay the sequence. */ | 6225 keymap may have changed, so replay the sequence. */ |
6222 if (BUFFERP (key)) | 6226 if (BUFFERP (key)) |
6223 { | 6227 { |
6224 mock_input = t; | 6228 mock_input = t; |
6229 /* Reset the current buffer from the selected window | |
6230 in case something changed the former and not the latter. | |
6231 This is to be more consistent with the behavior | |
6232 of the command_loop_1. */ | |
6233 if (fix_current_buffer) | |
6234 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) | |
6235 Fset_buffer (XWINDOW (selected_window)->buffer); | |
6236 | |
6225 orig_local_map = get_local_map (PT, current_buffer); | 6237 orig_local_map = get_local_map (PT, current_buffer); |
6226 goto replay_sequence; | 6238 goto replay_sequence; |
6227 } | 6239 } |
6228 | 6240 |
6229 /* If we have a quit that was typed in another frame, and | 6241 /* If we have a quit that was typed in another frame, and |
6940 this_single_command_key_start = 0; | 6952 this_single_command_key_start = 0; |
6941 } | 6953 } |
6942 | 6954 |
6943 i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])), | 6955 i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])), |
6944 prompt, ! NILP (dont_downcase_last), | 6956 prompt, ! NILP (dont_downcase_last), |
6945 ! NILP (can_return_switch_frame)); | 6957 ! NILP (can_return_switch_frame), 0); |
6946 | 6958 |
6947 if (i == -1) | 6959 if (i == -1) |
6948 { | 6960 { |
6949 Vquit_flag = Qt; | 6961 Vquit_flag = Qt; |
6950 QUIT; | 6962 QUIT; |