aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1997-04-11 08:21:38 +0000
committerRichard M. Stallman1997-04-11 08:21:38 +0000
commitf571ae0df29cade9ea6fa456a46d51f8ac7fa25b (patch)
tree17f536d7c7c10d469660e71b171b255e4b289226 /src
parent40b14a0cf38aa2cc536f69ec8a3998fd65f4d5b9 (diff)
downloademacs-f571ae0df29cade9ea6fa456a46d51f8ac7fa25b.tar.gz
emacs-f571ae0df29cade9ea6fa456a46d51f8ac7fa25b.zip
(read_key_sequence): New argument FIX_CURRENT_BUFFER.
Restore the current buffer from selected window on occasion. All callers changed.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 2cd50c12598..b16cb1a1f4a 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1183,7 +1183,7 @@ command_loop_1 ()
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)
@@ -5873,16 +5873,20 @@ follow_key (key, nmaps, current, defs, next)
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
5878static int 5881static int
5879read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, 5882read_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
@@ -6222,6 +6226,14 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
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 }
@@ -6942,7 +6954,7 @@ DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 4, 0,
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 {