diff options
| author | Karoly Lorentey | 2006-01-03 01:50:46 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2006-01-03 01:50:46 +0000 |
| commit | b3e6f69c10973ff7b040ced07a3a084960619681 (patch) | |
| tree | 27d84923989971dd576d9d38f111f99c9b2cf2ce /src | |
| parent | 0103b7c9f971e43ea4420a3f41704d85ad8f06ee (diff) | |
| download | emacs-b3e6f69c10973ff7b040ced07a3a084960619681.tar.gz emacs-b3e6f69c10973ff7b040ced07a3a084960619681.zip | |
Overhaul and simplify single_kboard API. Allow calls to `recursive-edit' in process filters. Small fixes.
* lisp/server.el (server-process-filter): Protect `display-splash-screen'
call in a condition-case. Explain why.
* src/callint.c (Fcall_interactively): Update call to
`temporarily_switch_to_single_kboard'.
* src/fns.c (Fy_or_n_p): Ditto.
* src/frame.c (Fdelete_frame): Remove unused variable `count'.
* src/keyboard.c (wrong_kboard_jmpbuf): Remove global variable.
* src/keyboard.c (read_char): Add wrong_kboard_jmpbuf parameter to allow
for recursive calls. Update longjmp invocations. Remember the
original current_kboard, and longjmp to `wrong_kboard_jmpbuf' when a
filter, timer or sentinel changes it. Comment out unnecessary calls to
`record_single_kboard_state' and `any_kboard_state'. Update recursive
calls.
* src/keyboard.c (read_key_sequence): Add `wrong_kboard_jmpbuf' local
variable. Update setjmp and read_char calls. Abort if
interrupted_kboard died in read_char.
* src/keyboard.c (any_kboard_state, single_kboard_state)
(record_single_kboard_state): Comment out obsolete functions.
(push_frame_kboard): Remove function.
(pop_kboard): Switch out of single_kboard mode if the
kboard has been deleted.
(temporarily_switch_to_single_kboard): Change first
parameter to a frame pointer. Throw an error when caller wants to
change kboards while in single_kboard mode.
(restore_kboard_configuration): Abort if pop_kboard changed
the kboard in single_kboard mode.
(Frecursive_edit): Switch to single_kboard mode only in
nested command loops.
(cmd_error, command_loop, command_loop_1, timer_check):
Comment out unnecessary call to `any_kboard_state' and
`record_single_kboard_state'.
* src/keyboard.c (delete_kboard): Exit single_kboard mode if we have just
deleted that kboard.
* src/keyboard.c (interrupt_signal): Use `Fkill_emacs' to exit Emacs, not
`fatal_error_signal'.
* src/keyboard.h (read_char, single_kboard_state)
(record_single_kboard_state): Remove.
(temporarily_switch_to_single_kboard): Update.
* src/lread.c: Include setjmp.h. Update declaration of `read_char'.
(read_filtered_event): Call `read_char' with a local
`wrong_kboard_jmpbuf'.
* src/minibuf.c (read_minibuf): Update call to
`temporarily_switch_to_single_kboard'.
* src/termchar.h (tty_display_info): Rename `previous_terminal_frame'
member to `previous_frame'.
* src/xdisp.c (redisplay_internal): Update references to
`previous_terminal_frame'.
(display_mode_line, Fformat_mode_line): Replace calls to
`push_frame_kboard' with `push_kboard'.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-489
Diffstat (limited to 'src')
| -rw-r--r-- | src/callint.c | 3 | ||||
| -rw-r--r-- | src/fns.c | 2 | ||||
| -rw-r--r-- | src/frame.c | 1 | ||||
| -rw-r--r-- | src/keyboard.c | 147 | ||||
| -rw-r--r-- | src/keyboard.h | 5 | ||||
| -rw-r--r-- | src/lread.c | 12 | ||||
| -rw-r--r-- | src/minibuf.c | 2 | ||||
| -rw-r--r-- | src/termchar.h | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 8 |
9 files changed, 125 insertions, 59 deletions
diff --git a/src/callint.c b/src/callint.c index d44d2f20ca0..38db2ea92ec 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -875,12 +875,11 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */) | |||
| 875 | real_this_command= save_real_this_command; | 875 | real_this_command= save_real_this_command; |
| 876 | current_kboard->Vlast_command = save_last_command; | 876 | current_kboard->Vlast_command = save_last_command; |
| 877 | 877 | ||
| 878 | temporarily_switch_to_single_kboard (NULL); | ||
| 879 | |||
| 880 | { | 878 | { |
| 881 | Lisp_Object val; | 879 | Lisp_Object val; |
| 882 | specbind (Qcommand_debug_status, Qnil); | 880 | specbind (Qcommand_debug_status, Qnil); |
| 883 | 881 | ||
| 882 | temporarily_switch_to_single_kboard (NULL); | ||
| 884 | val = Ffuncall (count + 1, args); | 883 | val = Ffuncall (count + 1, args); |
| 885 | UNGCPRO; | 884 | UNGCPRO; |
| 886 | return unbind_to (speccount, val); | 885 | return unbind_to (speccount, val); |
| @@ -3308,7 +3308,7 @@ is nil and `use-dialog-box' is non-nil. */) | |||
| 3308 | Fraise_frame (mini_frame); | 3308 | Fraise_frame (mini_frame); |
| 3309 | } | 3309 | } |
| 3310 | 3310 | ||
| 3311 | temporarily_switch_to_single_kboard (FRAME_KBOARD (SELECTED_FRAME ())); | 3311 | temporarily_switch_to_single_kboard (SELECTED_FRAME ()); |
| 3312 | obj = read_filtered_event (1, 0, 0, 0); | 3312 | obj = read_filtered_event (1, 0, 0, 0); |
| 3313 | 3313 | ||
| 3314 | cursor_in_echo_area = 0; | 3314 | cursor_in_echo_area = 0; |
diff --git a/src/frame.c b/src/frame.c index 9648783ee72..6b848ea2fef 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -1406,7 +1406,6 @@ The functions are run with one arg, the frame to be deleted. */) | |||
| 1406 | if (!NILP (Vrun_hooks) | 1406 | if (!NILP (Vrun_hooks) |
| 1407 | && NILP (Fframe_parameter (frame, intern ("tooltip")))) | 1407 | && NILP (Fframe_parameter (frame, intern ("tooltip")))) |
| 1408 | { | 1408 | { |
| 1409 | int count = SPECPDL_INDEX (); | ||
| 1410 | Lisp_Object args[2]; | 1409 | Lisp_Object args[2]; |
| 1411 | struct gcpro gcpro1, gcpro2; | 1410 | struct gcpro gcpro1, gcpro2; |
| 1412 | 1411 | ||
diff --git a/src/keyboard.c b/src/keyboard.c index 6646ea62e66..cd10c1fde6c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -670,7 +670,6 @@ static void save_getcjmp (); | |||
| 670 | static void restore_getcjmp P_ ((jmp_buf)); | 670 | static void restore_getcjmp P_ ((jmp_buf)); |
| 671 | static Lisp_Object apply_modifiers P_ ((int, Lisp_Object)); | 671 | static Lisp_Object apply_modifiers P_ ((int, Lisp_Object)); |
| 672 | static void clear_event P_ ((struct input_event *)); | 672 | static void clear_event P_ ((struct input_event *)); |
| 673 | static void any_kboard_state P_ ((void)); | ||
| 674 | static Lisp_Object restore_kboard_configuration P_ ((Lisp_Object)); | 673 | static Lisp_Object restore_kboard_configuration P_ ((Lisp_Object)); |
| 675 | static SIGTYPE interrupt_signal P_ ((int signalnum)); | 674 | static SIGTYPE interrupt_signal P_ ((int signalnum)); |
| 676 | static void handle_interrupt P_ ((void)); | 675 | static void handle_interrupt P_ ((void)); |
| @@ -1034,7 +1033,8 @@ This function is called by the editor initialization to begin editing. */) | |||
| 1034 | like it is done in the splash screen display, we have to | 1033 | like it is done in the splash screen display, we have to |
| 1035 | make sure that we restore single_kboard as command_loop_1 | 1034 | make sure that we restore single_kboard as command_loop_1 |
| 1036 | would have done if it were left normally. */ | 1035 | would have done if it were left normally. */ |
| 1037 | temporarily_switch_to_single_kboard (FRAME_KBOARD (SELECTED_FRAME ())); | 1036 | if (command_loop_level > 0) |
| 1037 | temporarily_switch_to_single_kboard (SELECTED_FRAME ()); | ||
| 1038 | record_unwind_protect (recursive_edit_unwind, buffer); | 1038 | record_unwind_protect (recursive_edit_unwind, buffer); |
| 1039 | 1039 | ||
| 1040 | recursive_edit_1 (); | 1040 | recursive_edit_1 (); |
| @@ -1054,6 +1054,8 @@ recursive_edit_unwind (buffer) | |||
| 1054 | } | 1054 | } |
| 1055 | 1055 | ||
| 1056 | 1056 | ||
| 1057 | #if 0 /* These two functions are now replaced with | ||
| 1058 | temporarily_switch_to_single_kboard. */ | ||
| 1057 | static void | 1059 | static void |
| 1058 | any_kboard_state () | 1060 | any_kboard_state () |
| 1059 | { | 1061 | { |
| @@ -1084,6 +1086,7 @@ single_kboard_state () | |||
| 1084 | single_kboard = 1; | 1086 | single_kboard = 1; |
| 1085 | #endif | 1087 | #endif |
| 1086 | } | 1088 | } |
| 1089 | #endif | ||
| 1087 | 1090 | ||
| 1088 | /* If we're in single_kboard state for kboard KBOARD, | 1091 | /* If we're in single_kboard state for kboard KBOARD, |
| 1089 | get out of it. */ | 1092 | get out of it. */ |
| @@ -1127,13 +1130,6 @@ push_kboard (k) | |||
| 1127 | } | 1130 | } |
| 1128 | 1131 | ||
| 1129 | void | 1132 | void |
| 1130 | push_frame_kboard (f) | ||
| 1131 | FRAME_PTR f; | ||
| 1132 | { | ||
| 1133 | push_kboard (f->terminal->kboard); | ||
| 1134 | } | ||
| 1135 | |||
| 1136 | void | ||
| 1137 | pop_kboard () | 1133 | pop_kboard () |
| 1138 | { | 1134 | { |
| 1139 | #ifdef MULTI_KBOARD | 1135 | #ifdef MULTI_KBOARD |
| @@ -1153,37 +1149,55 @@ pop_kboard () | |||
| 1153 | { | 1149 | { |
| 1154 | /* The terminal we remembered has been deleted. */ | 1150 | /* The terminal we remembered has been deleted. */ |
| 1155 | current_kboard = FRAME_KBOARD (SELECTED_FRAME ()); | 1151 | current_kboard = FRAME_KBOARD (SELECTED_FRAME ()); |
| 1152 | single_kboard = 0; | ||
| 1156 | } | 1153 | } |
| 1157 | kboard_stack = p->next; | 1154 | kboard_stack = p->next; |
| 1158 | xfree (p); | 1155 | xfree (p); |
| 1159 | #endif | 1156 | #endif |
| 1160 | } | 1157 | } |
| 1161 | 1158 | ||
| 1162 | /* Switch to single_kboard mode. If K is non-nil, set it as the | 1159 | /* Switch to single_kboard mode, making current_kboard the only KBOARD |
| 1163 | current keyboard. Use record_unwind_protect to return to the | 1160 | from which further input is accepted. If F is non-nil, set its |
| 1164 | previous state later. */ | 1161 | KBOARD as the current keyboard. |
| 1162 | |||
| 1163 | This function uses record_unwind_protect to return to the previous | ||
| 1164 | state later. | ||
| 1165 | |||
| 1166 | If Emacs is already in single_kboard mode, and F's keyboard is | ||
| 1167 | locked, then this function will throw an errow. */ | ||
| 1165 | 1168 | ||
| 1166 | void | 1169 | void |
| 1167 | temporarily_switch_to_single_kboard (k) | 1170 | temporarily_switch_to_single_kboard (f) |
| 1168 | struct kboard *k; | 1171 | struct frame *f; |
| 1169 | { | 1172 | { |
| 1170 | #ifdef MULTI_KBOARD | 1173 | #ifdef MULTI_KBOARD |
| 1171 | int was_locked = single_kboard; | 1174 | int was_locked = single_kboard; |
| 1172 | if (was_locked) | 1175 | if (was_locked) |
| 1173 | { | 1176 | { |
| 1174 | if (k != NULL) | 1177 | if (f != NULL && FRAME_KBOARD (f) != current_kboard) |
| 1175 | push_kboard (k); | 1178 | /* We can not switch keyboards while in single_kboard mode. |
| 1179 | This can legally happen when Lisp code calls | ||
| 1180 | `recursive-edit' (or `read-minibuffer' or `y-or-n-p') after | ||
| 1181 | it switched to a locked frame. This kind of situation is | ||
| 1182 | likely to happen when server.el connects to a new | ||
| 1183 | terminal. */ | ||
| 1184 | error ("Terminal %d is locked, cannot read from it", | ||
| 1185 | FRAME_TERMINAL (f)->id); | ||
| 1176 | else | 1186 | else |
| 1187 | /* This call is unnecessary, but helps | ||
| 1188 | `restore_kboard_configuration' discover if somebody changed | ||
| 1189 | `current_kboard' behind our back. */ | ||
| 1177 | push_kboard (current_kboard); | 1190 | push_kboard (current_kboard); |
| 1178 | } | 1191 | } |
| 1179 | else if (k != NULL) | 1192 | else if (f != NULL) |
| 1180 | current_kboard = k; | 1193 | current_kboard = FRAME_KBOARD (f); |
| 1181 | single_kboard_state (); | 1194 | single_kboard = 1; |
| 1182 | record_unwind_protect (restore_kboard_configuration, | 1195 | record_unwind_protect (restore_kboard_configuration, |
| 1183 | (was_locked ? Qt : Qnil)); | 1196 | (was_locked ? Qt : Qnil)); |
| 1184 | #endif | 1197 | #endif |
| 1185 | } | 1198 | } |
| 1186 | 1199 | ||
| 1200 | #if 0 /* This function is not needed anymore. */ | ||
| 1187 | void | 1201 | void |
| 1188 | record_single_kboard_state () | 1202 | record_single_kboard_state () |
| 1189 | { | 1203 | { |
| @@ -1192,17 +1206,22 @@ record_single_kboard_state () | |||
| 1192 | record_unwind_protect (restore_kboard_configuration, | 1206 | record_unwind_protect (restore_kboard_configuration, |
| 1193 | (single_kboard ? Qt : Qnil)); | 1207 | (single_kboard ? Qt : Qnil)); |
| 1194 | } | 1208 | } |
| 1209 | #endif | ||
| 1195 | 1210 | ||
| 1196 | static Lisp_Object | 1211 | static Lisp_Object |
| 1197 | restore_kboard_configuration (was_locked) | 1212 | restore_kboard_configuration (was_locked) |
| 1198 | Lisp_Object was_locked; | 1213 | Lisp_Object was_locked; |
| 1199 | { | 1214 | { |
| 1200 | if (NILP (was_locked)) | 1215 | if (NILP (was_locked)) |
| 1201 | any_kboard_state (); | 1216 | single_kboard = 0; |
| 1202 | else | 1217 | else |
| 1203 | { | 1218 | { |
| 1204 | single_kboard_state (); | 1219 | struct kboard *prev = current_kboard; |
| 1220 | single_kboard = 1; | ||
| 1205 | pop_kboard (); | 1221 | pop_kboard (); |
| 1222 | /* The pop should not change the kboard. */ | ||
| 1223 | if (single_kboard && current_kboard != prev) | ||
| 1224 | abort (); | ||
| 1206 | } | 1225 | } |
| 1207 | return Qnil; | 1226 | return Qnil; |
| 1208 | } | 1227 | } |
| @@ -1253,10 +1272,12 @@ cmd_error (data) | |||
| 1253 | Vquit_flag = Qnil; | 1272 | Vquit_flag = Qnil; |
| 1254 | 1273 | ||
| 1255 | Vinhibit_quit = Qnil; | 1274 | Vinhibit_quit = Qnil; |
| 1275 | #if 0 /* This shouldn't be necessary anymore. --lorentey */ | ||
| 1256 | #ifdef MULTI_KBOARD | 1276 | #ifdef MULTI_KBOARD |
| 1257 | if (command_loop_level == 0 && minibuf_level == 0) | 1277 | if (command_loop_level == 0 && minibuf_level == 0) |
| 1258 | any_kboard_state (); | 1278 | any_kboard_state (); |
| 1259 | #endif | 1279 | #endif |
| 1280 | #endif | ||
| 1260 | 1281 | ||
| 1261 | return make_number (0); | 1282 | return make_number (0); |
| 1262 | } | 1283 | } |
| @@ -1340,10 +1361,12 @@ command_loop () | |||
| 1340 | while (1) | 1361 | while (1) |
| 1341 | { | 1362 | { |
| 1342 | internal_catch (Qtop_level, top_level_1, Qnil); | 1363 | internal_catch (Qtop_level, top_level_1, Qnil); |
| 1364 | #if 0 /* This shouldn't be necessary anymore. --lorentey */ | ||
| 1343 | /* Reset single_kboard in case top-level set it while | 1365 | /* Reset single_kboard in case top-level set it while |
| 1344 | evaluating an -f option, or we are stuck there for some | 1366 | evaluating an -f option, or we are stuck there for some |
| 1345 | other reason. */ | 1367 | other reason. */ |
| 1346 | any_kboard_state (); | 1368 | any_kboard_state (); |
| 1369 | #endif | ||
| 1347 | internal_catch (Qtop_level, command_loop_2, Qnil); | 1370 | internal_catch (Qtop_level, command_loop_2, Qnil); |
| 1348 | executing_kbd_macro = Qnil; | 1371 | executing_kbd_macro = Qnil; |
| 1349 | 1372 | ||
| @@ -1460,9 +1483,11 @@ command_loop_1 () | |||
| 1460 | int no_direct; | 1483 | int no_direct; |
| 1461 | int prev_modiff = 0; | 1484 | int prev_modiff = 0; |
| 1462 | struct buffer *prev_buffer = NULL; | 1485 | struct buffer *prev_buffer = NULL; |
| 1486 | #if 0 /* This shouldn't be necessary anymore. --lorentey */ | ||
| 1463 | #ifdef MULTI_KBOARD | 1487 | #ifdef MULTI_KBOARD |
| 1464 | int was_locked = single_kboard; | 1488 | int was_locked = single_kboard; |
| 1465 | #endif | 1489 | #endif |
| 1490 | #endif | ||
| 1466 | int already_adjusted = 0; | 1491 | int already_adjusted = 0; |
| 1467 | 1492 | ||
| 1468 | current_kboard->Vprefix_arg = Qnil; | 1493 | current_kboard->Vprefix_arg = Qnil; |
| @@ -1919,10 +1944,11 @@ command_loop_1 () | |||
| 1919 | if (!NILP (current_kboard->defining_kbd_macro) | 1944 | if (!NILP (current_kboard->defining_kbd_macro) |
| 1920 | && NILP (current_kboard->Vprefix_arg)) | 1945 | && NILP (current_kboard->Vprefix_arg)) |
| 1921 | finalize_kbd_macro_chars (); | 1946 | finalize_kbd_macro_chars (); |
| 1922 | 1947 | #if 0 /* This shouldn't be necessary anymore. --lorentey */ | |
| 1923 | #ifdef MULTI_KBOARD | 1948 | #ifdef MULTI_KBOARD |
| 1924 | if (!was_locked) | 1949 | if (!was_locked) |
| 1925 | any_kboard_state (); | 1950 | any_kboard_state (); |
| 1951 | #endif | ||
| 1926 | #endif | 1952 | #endif |
| 1927 | } | 1953 | } |
| 1928 | } | 1954 | } |
| @@ -2405,10 +2431,6 @@ Lisp_Object print_help (); | |||
| 2405 | static Lisp_Object kbd_buffer_get_event (); | 2431 | static Lisp_Object kbd_buffer_get_event (); |
| 2406 | static void record_char (); | 2432 | static void record_char (); |
| 2407 | 2433 | ||
| 2408 | #ifdef MULTI_KBOARD | ||
| 2409 | static jmp_buf wrong_kboard_jmpbuf; | ||
| 2410 | #endif | ||
| 2411 | |||
| 2412 | #define STOP_POLLING \ | 2434 | #define STOP_POLLING \ |
| 2413 | do { if (! polling_stopped_here) stop_polling (); \ | 2435 | do { if (! polling_stopped_here) stop_polling (); \ |
| 2414 | polling_stopped_here = 1; } while (0) | 2436 | polling_stopped_here = 1; } while (0) |
| @@ -2435,15 +2457,19 @@ do { if (polling_stopped_here) start_polling (); \ | |||
| 2435 | if we used a mouse menu to read the input, or zero otherwise. If | 2457 | if we used a mouse menu to read the input, or zero otherwise. If |
| 2436 | USED_MOUSE_MENU is null, we don't dereference it. | 2458 | USED_MOUSE_MENU is null, we don't dereference it. |
| 2437 | 2459 | ||
| 2460 | WRONG_KBOARD_JMPBUF should be a stack context to longjmp to in case | ||
| 2461 | we find input on another keyboard. | ||
| 2462 | |||
| 2438 | Value is t if we showed a menu and the user rejected it. */ | 2463 | Value is t if we showed a menu and the user rejected it. */ |
| 2439 | 2464 | ||
| 2440 | Lisp_Object | 2465 | Lisp_Object |
| 2441 | read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | 2466 | read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, wrong_kboard_jmpbuf) |
| 2442 | int commandflag; | 2467 | int commandflag; |
| 2443 | int nmaps; | 2468 | int nmaps; |
| 2444 | Lisp_Object *maps; | 2469 | Lisp_Object *maps; |
| 2445 | Lisp_Object prev_event; | 2470 | Lisp_Object prev_event; |
| 2446 | int *used_mouse_menu; | 2471 | int *used_mouse_menu; |
| 2472 | jmp_buf *wrong_kboard_jmpbuf; | ||
| 2447 | { | 2473 | { |
| 2448 | volatile Lisp_Object c; | 2474 | volatile Lisp_Object c; |
| 2449 | int count; | 2475 | int count; |
| @@ -2456,6 +2482,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2456 | volatile int reread; | 2482 | volatile int reread; |
| 2457 | struct gcpro gcpro1, gcpro2; | 2483 | struct gcpro gcpro1, gcpro2; |
| 2458 | int polling_stopped_here = 0; | 2484 | int polling_stopped_here = 0; |
| 2485 | struct kboard *orig_kboard = current_kboard; | ||
| 2459 | 2486 | ||
| 2460 | also_record = Qnil; | 2487 | also_record = Qnil; |
| 2461 | 2488 | ||
| @@ -2711,7 +2738,9 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2711 | /* This is going to exit from read_char | 2738 | /* This is going to exit from read_char |
| 2712 | so we had better get rid of this frame's stuff. */ | 2739 | so we had better get rid of this frame's stuff. */ |
| 2713 | UNGCPRO; | 2740 | UNGCPRO; |
| 2714 | longjmp (wrong_kboard_jmpbuf, 1); | 2741 | if (wrong_kboard_jmpbuf == NULL) |
| 2742 | abort (); | ||
| 2743 | longjmp (*wrong_kboard_jmpbuf, 1); | ||
| 2715 | } | 2744 | } |
| 2716 | } | 2745 | } |
| 2717 | #endif | 2746 | #endif |
| @@ -2845,6 +2874,20 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2845 | } | 2874 | } |
| 2846 | } | 2875 | } |
| 2847 | 2876 | ||
| 2877 | /* Notify the caller if a timer or sentinel or filter in the sit_for | ||
| 2878 | calls above have changed the current kboard. This could happen | ||
| 2879 | if they start a recursive edit, like the fancy splash screen in | ||
| 2880 | server.el's filter. If this longjmp wasn't here, | ||
| 2881 | read_key_sequence would interpret the next key sequence using the | ||
| 2882 | wrong translation tables and function keymaps. */ | ||
| 2883 | if (NILP (c) && current_kboard != orig_kboard) | ||
| 2884 | { | ||
| 2885 | UNGCPRO; | ||
| 2886 | if (wrong_kboard_jmpbuf == NULL) | ||
| 2887 | abort (); | ||
| 2888 | longjmp (*wrong_kboard_jmpbuf, 1); | ||
| 2889 | } | ||
| 2890 | |||
| 2848 | /* If this has become non-nil here, it has been set by a timer | 2891 | /* If this has become non-nil here, it has been set by a timer |
| 2849 | or sentinel or filter. */ | 2892 | or sentinel or filter. */ |
| 2850 | if (CONSP (Vunread_command_events)) | 2893 | if (CONSP (Vunread_command_events)) |
| @@ -2893,7 +2936,9 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2893 | /* This is going to exit from read_char | 2936 | /* This is going to exit from read_char |
| 2894 | so we had better get rid of this frame's stuff. */ | 2937 | so we had better get rid of this frame's stuff. */ |
| 2895 | UNGCPRO; | 2938 | UNGCPRO; |
| 2896 | longjmp (wrong_kboard_jmpbuf, 1); | 2939 | if (wrong_kboard_jmpbuf == NULL) |
| 2940 | abort (); | ||
| 2941 | longjmp (*wrong_kboard_jmpbuf, 1); | ||
| 2897 | } | 2942 | } |
| 2898 | } | 2943 | } |
| 2899 | #endif | 2944 | #endif |
| @@ -2940,7 +2985,9 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2940 | /* This is going to exit from read_char | 2985 | /* This is going to exit from read_char |
| 2941 | so we had better get rid of this frame's stuff. */ | 2986 | so we had better get rid of this frame's stuff. */ |
| 2942 | UNGCPRO; | 2987 | UNGCPRO; |
| 2943 | longjmp (wrong_kboard_jmpbuf, 1); | 2988 | if (wrong_kboard_jmpbuf == NULL) |
| 2989 | abort (); | ||
| 2990 | longjmp (*wrong_kboard_jmpbuf, 1); | ||
| 2944 | } | 2991 | } |
| 2945 | #endif | 2992 | #endif |
| 2946 | } | 2993 | } |
| @@ -2994,8 +3041,12 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2994 | 3041 | ||
| 2995 | if (!NILP (tem)) | 3042 | if (!NILP (tem)) |
| 2996 | { | 3043 | { |
| 3044 | #if 0 /* This shouldn't be necessary anymore. --lorentey */ | ||
| 2997 | int was_locked = single_kboard; | 3045 | int was_locked = single_kboard; |
| 2998 | 3046 | int count = SPECPDL_INDEX (); | |
| 3047 | record_single_kboard_state (); | ||
| 3048 | #endif | ||
| 3049 | |||
| 2999 | last_input_char = c; | 3050 | last_input_char = c; |
| 3000 | Fcommand_execute (tem, Qnil, Fvector (1, &last_input_char), Qt); | 3051 | Fcommand_execute (tem, Qnil, Fvector (1, &last_input_char), Qt); |
| 3001 | 3052 | ||
| @@ -3006,9 +3057,12 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 3006 | example banishing the mouse under mouse-avoidance-mode. */ | 3057 | example banishing the mouse under mouse-avoidance-mode. */ |
| 3007 | timer_resume_idle (); | 3058 | timer_resume_idle (); |
| 3008 | 3059 | ||
| 3060 | #if 0 /* This shouldn't be necessary anymore. --lorentey */ | ||
| 3009 | /* Resume allowing input from any kboard, if that was true before. */ | 3061 | /* Resume allowing input from any kboard, if that was true before. */ |
| 3010 | if (!was_locked) | 3062 | if (!was_locked) |
| 3011 | any_kboard_state (); | 3063 | any_kboard_state (); |
| 3064 | unbind_to (count, Qnil); | ||
| 3065 | #endif | ||
| 3012 | 3066 | ||
| 3013 | goto retry; | 3067 | goto retry; |
| 3014 | } | 3068 | } |
| @@ -3251,7 +3305,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 3251 | 3305 | ||
| 3252 | cancel_echoing (); | 3306 | cancel_echoing (); |
| 3253 | do | 3307 | do |
| 3254 | c = read_char (0, 0, 0, Qnil, 0); | 3308 | c = read_char (0, 0, 0, Qnil, 0, &wrong_kboard_jmpbuf); |
| 3255 | while (BUFFERP (c)); | 3309 | while (BUFFERP (c)); |
| 3256 | /* Remove the help from the frame */ | 3310 | /* Remove the help from the frame */ |
| 3257 | unbind_to (count, Qnil); | 3311 | unbind_to (count, Qnil); |
| @@ -3261,7 +3315,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 3261 | { | 3315 | { |
| 3262 | cancel_echoing (); | 3316 | cancel_echoing (); |
| 3263 | do | 3317 | do |
| 3264 | c = read_char (0, 0, 0, Qnil, 0); | 3318 | c = read_char (0, 0, 0, Qnil, 0, &wrong_kboard_jmpbuf); |
| 3265 | while (BUFFERP (c)); | 3319 | while (BUFFERP (c)); |
| 3266 | } | 3320 | } |
| 3267 | } | 3321 | } |
| @@ -4522,10 +4576,11 @@ timer_check (do_it_now) | |||
| 4522 | int count = SPECPDL_INDEX (); | 4576 | int count = SPECPDL_INDEX (); |
| 4523 | Lisp_Object old_deactivate_mark = Vdeactivate_mark; | 4577 | Lisp_Object old_deactivate_mark = Vdeactivate_mark; |
| 4524 | 4578 | ||
| 4579 | #if 0 /* This shouldn't be necessary anymore. --lorentey */ | ||
| 4525 | /* On unbind_to, resume allowing input from any kboard, if that | 4580 | /* On unbind_to, resume allowing input from any kboard, if that |
| 4526 | was true before. */ | 4581 | was true before. */ |
| 4527 | record_single_kboard_state (); | 4582 | record_single_kboard_state (); |
| 4528 | 4583 | #endif | |
| 4529 | /* Mark the timer as triggered to prevent problems if the lisp | 4584 | /* Mark the timer as triggered to prevent problems if the lisp |
| 4530 | code fails to reschedule it right. */ | 4585 | code fails to reschedule it right. */ |
| 4531 | vector[0] = Qt; | 4586 | vector[0] = Qt; |
| @@ -8739,6 +8794,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 8739 | int junk; | 8794 | int junk; |
| 8740 | #endif | 8795 | #endif |
| 8741 | 8796 | ||
| 8797 | jmp_buf *volatile wrong_kboard_jmpbuf = alloca (sizeof (jmp_buf)); | ||
| 8798 | |||
| 8742 | struct gcpro gcpro1; | 8799 | struct gcpro gcpro1; |
| 8743 | 8800 | ||
| 8744 | GCPRO1 (fake_prefixed_keys); | 8801 | GCPRO1 (fake_prefixed_keys); |
| @@ -8775,7 +8832,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 8775 | /* Read the first char of the sequence specially, before setting | 8832 | /* Read the first char of the sequence specially, before setting |
| 8776 | up any keymaps, in case a filter runs and switches buffers on us. */ | 8833 | up any keymaps, in case a filter runs and switches buffers on us. */ |
| 8777 | first_event = read_char (NILP (prompt), 0, submaps, last_nonmenu_event, | 8834 | first_event = read_char (NILP (prompt), 0, submaps, last_nonmenu_event, |
| 8778 | &junk); | 8835 | &junk, NULL); |
| 8779 | #endif /* GOBBLE_FIRST_EVENT */ | 8836 | #endif /* GOBBLE_FIRST_EVENT */ |
| 8780 | 8837 | ||
| 8781 | orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); | 8838 | orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); |
| @@ -8951,8 +9008,17 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 8951 | #ifdef MULTI_KBOARD | 9008 | #ifdef MULTI_KBOARD |
| 8952 | KBOARD *interrupted_kboard = current_kboard; | 9009 | KBOARD *interrupted_kboard = current_kboard; |
| 8953 | struct frame *interrupted_frame = SELECTED_FRAME (); | 9010 | struct frame *interrupted_frame = SELECTED_FRAME (); |
| 8954 | if (setjmp (wrong_kboard_jmpbuf)) | 9011 | if (setjmp (*wrong_kboard_jmpbuf)) |
| 8955 | { | 9012 | { |
| 9013 | int found = 0; | ||
| 9014 | struct kboard *k; | ||
| 9015 | |||
| 9016 | for (k = all_kboards; k; k = k->next_kboard) | ||
| 9017 | if (k == interrupted_kboard) | ||
| 9018 | found = 1; | ||
| 9019 | if (!found) | ||
| 9020 | abort (); | ||
| 9021 | |||
| 8956 | if (!NILP (delayed_switch_frame)) | 9022 | if (!NILP (delayed_switch_frame)) |
| 8957 | { | 9023 | { |
| 8958 | interrupted_kboard->kbd_queue | 9024 | interrupted_kboard->kbd_queue |
| @@ -8986,7 +9052,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 8986 | #endif | 9052 | #endif |
| 8987 | key = read_char (NILP (prompt), nmaps, | 9053 | key = read_char (NILP (prompt), nmaps, |
| 8988 | (Lisp_Object *) submaps, last_nonmenu_event, | 9054 | (Lisp_Object *) submaps, last_nonmenu_event, |
| 8989 | &used_mouse_menu); | 9055 | &used_mouse_menu, wrong_kboard_jmpbuf); |
| 8990 | } | 9056 | } |
| 8991 | 9057 | ||
| 8992 | /* read_char returns t when it shows a menu and the user rejects it. | 9058 | /* read_char returns t when it shows a menu and the user rejects it. |
| @@ -10466,7 +10532,7 @@ interrupt_signal (signalnum) /* If we don't have an argument, */ | |||
| 10466 | { | 10532 | { |
| 10467 | /* If there are no frames there, let's pretend that we are a | 10533 | /* If there are no frames there, let's pretend that we are a |
| 10468 | well-behaving UN*X program and quit. */ | 10534 | well-behaving UN*X program and quit. */ |
| 10469 | fatal_error_signal (SIGTERM); | 10535 | Fkill_emacs (Qnil); |
| 10470 | } | 10536 | } |
| 10471 | else | 10537 | else |
| 10472 | { | 10538 | { |
| @@ -11034,7 +11100,8 @@ delete_kboard (kb) | |||
| 11034 | && FRAMEP (selected_frame) | 11100 | && FRAMEP (selected_frame) |
| 11035 | && FRAME_LIVE_P (XFRAME (selected_frame))) | 11101 | && FRAME_LIVE_P (XFRAME (selected_frame))) |
| 11036 | { | 11102 | { |
| 11037 | current_kboard = XFRAME (selected_frame)->terminal->kboard; | 11103 | current_kboard = FRAME_KBOARD (XFRAME (selected_frame)); |
| 11104 | single_kboard = 0; | ||
| 11038 | if (current_kboard == kb) | 11105 | if (current_kboard == kb) |
| 11039 | abort (); | 11106 | abort (); |
| 11040 | } | 11107 | } |
diff --git a/src/keyboard.h b/src/keyboard.h index 6c320a4fad8..19a38ed7446 100644 --- a/src/keyboard.h +++ b/src/keyboard.h | |||
| @@ -305,7 +305,6 @@ struct input_event; | |||
| 305 | 305 | ||
| 306 | extern Lisp_Object parse_modifiers P_ ((Lisp_Object)); | 306 | extern Lisp_Object parse_modifiers P_ ((Lisp_Object)); |
| 307 | extern Lisp_Object reorder_modifiers P_ ((Lisp_Object)); | 307 | extern Lisp_Object reorder_modifiers P_ ((Lisp_Object)); |
| 308 | extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *)); | ||
| 309 | 308 | ||
| 310 | /* Parent keymap of terminal-local function-key-map instances. */ | 309 | /* Parent keymap of terminal-local function-key-map instances. */ |
| 311 | extern Lisp_Object Vfunction_key_map; | 310 | extern Lisp_Object Vfunction_key_map; |
| @@ -318,13 +317,11 @@ extern int parse_menu_item P_ ((Lisp_Object, int, int)); | |||
| 318 | extern void echo_now P_ ((void)); | 317 | extern void echo_now P_ ((void)); |
| 319 | extern void init_kboard P_ ((KBOARD *)); | 318 | extern void init_kboard P_ ((KBOARD *)); |
| 320 | extern void delete_kboard P_ ((KBOARD *)); | 319 | extern void delete_kboard P_ ((KBOARD *)); |
| 321 | extern void single_kboard_state P_ ((void)); | ||
| 322 | extern void not_single_kboard_state P_ ((KBOARD *)); | 320 | extern void not_single_kboard_state P_ ((KBOARD *)); |
| 323 | extern void push_kboard P_ ((struct kboard *)); | 321 | extern void push_kboard P_ ((struct kboard *)); |
| 324 | extern void push_frame_kboard P_ ((struct frame *)); | 322 | extern void push_frame_kboard P_ ((struct frame *)); |
| 325 | extern void pop_kboard P_ ((void)); | 323 | extern void pop_kboard P_ ((void)); |
| 326 | extern void temporarily_switch_to_single_kboard P_ ((struct kboard *)); | 324 | extern void temporarily_switch_to_single_kboard P_ ((struct frame *)); |
| 327 | extern void record_single_kboard_state P_ ((void)); | ||
| 328 | extern void record_asynch_buffer_change P_ ((void)); | 325 | extern void record_asynch_buffer_change P_ ((void)); |
| 329 | extern SIGTYPE input_poll_signal P_ ((int)); | 326 | extern SIGTYPE input_poll_signal P_ ((int)); |
| 330 | extern void start_polling P_ ((void)); | 327 | extern void start_polling P_ ((void)); |
diff --git a/src/lread.c b/src/lread.c index 6555737fa55..236ebebda13 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -27,6 +27,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 27 | #include <sys/stat.h> | 27 | #include <sys/stat.h> |
| 28 | #include <sys/file.h> | 28 | #include <sys/file.h> |
| 29 | #include <errno.h> | 29 | #include <errno.h> |
| 30 | #include <setjmp.h> | ||
| 30 | #include "lisp.h" | 31 | #include "lisp.h" |
| 31 | #include "intervals.h" | 32 | #include "intervals.h" |
| 32 | #include "buffer.h" | 33 | #include "buffer.h" |
| @@ -434,7 +435,7 @@ static void substitute_in_interval P_ ((INTERVAL, Lisp_Object)); | |||
| 434 | 435 | ||
| 435 | /* Get a character from the tty. */ | 436 | /* Get a character from the tty. */ |
| 436 | 437 | ||
| 437 | extern Lisp_Object read_char (); | 438 | extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *, jmp_buf *)); |
| 438 | 439 | ||
| 439 | /* Read input events until we get one that's acceptable for our purposes. | 440 | /* Read input events until we get one that's acceptable for our purposes. |
| 440 | 441 | ||
| @@ -459,7 +460,8 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii, | |||
| 459 | input_method) | 460 | input_method) |
| 460 | int no_switch_frame, ascii_required, error_nonascii, input_method; | 461 | int no_switch_frame, ascii_required, error_nonascii, input_method; |
| 461 | { | 462 | { |
| 462 | register Lisp_Object val, delayed_switch_frame; | 463 | volatile register Lisp_Object val, delayed_switch_frame; |
| 464 | jmp_buf *volatile wrong_kboard_jmpbuf = alloca (sizeof (jmp_buf)); | ||
| 463 | 465 | ||
| 464 | #ifdef HAVE_WINDOW_SYSTEM | 466 | #ifdef HAVE_WINDOW_SYSTEM |
| 465 | if (display_hourglass_p) | 467 | if (display_hourglass_p) |
| @@ -470,10 +472,12 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii, | |||
| 470 | 472 | ||
| 471 | /* Read until we get an acceptable event. */ | 473 | /* Read until we get an acceptable event. */ |
| 472 | retry: | 474 | retry: |
| 475 | setjmp (*wrong_kboard_jmpbuf); | ||
| 476 | |||
| 473 | val = read_char (0, 0, 0, | 477 | val = read_char (0, 0, 0, |
| 474 | (input_method ? Qnil : Qt), | 478 | (input_method ? Qnil : Qt), |
| 475 | 0); | 479 | 0, wrong_kboard_jmpbuf); |
| 476 | 480 | ||
| 477 | if (BUFFERP (val)) | 481 | if (BUFFERP (val)) |
| 478 | goto retry; | 482 | goto retry; |
| 479 | 483 | ||
diff --git a/src/minibuf.c b/src/minibuf.c index 795acb1988c..7f3f7fe87ea 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -552,7 +552,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 552 | if (minibuffer_auto_raise) | 552 | if (minibuffer_auto_raise) |
| 553 | Fraise_frame (mini_frame); | 553 | Fraise_frame (mini_frame); |
| 554 | 554 | ||
| 555 | temporarily_switch_to_single_kboard (XFRAME (mini_frame)->terminal->kboard); | 555 | temporarily_switch_to_single_kboard (XFRAME (mini_frame)); |
| 556 | 556 | ||
| 557 | /* We have to do this after saving the window configuration | 557 | /* We have to do this after saving the window configuration |
| 558 | since that is what restores the current buffer. */ | 558 | since that is what restores the current buffer. */ |
diff --git a/src/termchar.h b/src/termchar.h index f4b58f105b0..9e9819b97ce 100644 --- a/src/termchar.h +++ b/src/termchar.h | |||
| @@ -68,8 +68,8 @@ struct tty_display_info | |||
| 68 | 68 | ||
| 69 | Lisp_Object top_frame; /* The topmost frame on this tty. */ | 69 | Lisp_Object top_frame; /* The topmost frame on this tty. */ |
| 70 | 70 | ||
| 71 | /* The previous terminal frame we displayed on this tty. */ | 71 | /* The previous frame we displayed on this tty. */ |
| 72 | struct frame *previous_terminal_frame; | 72 | struct frame *previous_frame; |
| 73 | 73 | ||
| 74 | /* Strings, numbers and flags taken from the termcap entry. */ | 74 | /* Strings, numbers and flags taken from the termcap entry. */ |
| 75 | 75 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index 6dd0a1f3e69..ca6c8f793a2 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -10549,14 +10549,14 @@ redisplay_internal (preserve_echo_area) | |||
| 10549 | ++windows_or_buffers_changed; | 10549 | ++windows_or_buffers_changed; |
| 10550 | 10550 | ||
| 10551 | if (FRAME_TERMCAP_P (sf) | 10551 | if (FRAME_TERMCAP_P (sf) |
| 10552 | && FRAME_TTY (sf)->previous_terminal_frame != sf) | 10552 | && FRAME_TTY (sf)->previous_frame != sf) |
| 10553 | { | 10553 | { |
| 10554 | /* Since frames on a single ASCII terminal share the same | 10554 | /* Since frames on a single ASCII terminal share the same |
| 10555 | display area, displaying a different frame means redisplay | 10555 | display area, displaying a different frame means redisplay |
| 10556 | the whole thing. */ | 10556 | the whole thing. */ |
| 10557 | windows_or_buffers_changed++; | 10557 | windows_or_buffers_changed++; |
| 10558 | SET_FRAME_GARBAGED (sf); | 10558 | SET_FRAME_GARBAGED (sf); |
| 10559 | FRAME_TTY (sf)->previous_terminal_frame = sf; | 10559 | FRAME_TTY (sf)->previous_frame = sf; |
| 10560 | } | 10560 | } |
| 10561 | 10561 | ||
| 10562 | /* Set the visible flags for all frames. Do this before checking | 10562 | /* Set the visible flags for all frames. Do this before checking |
| @@ -16194,7 +16194,7 @@ display_mode_line (w, face_id, format) | |||
| 16194 | /* Temporarily make frame's keyboard the current kboard so that | 16194 | /* Temporarily make frame's keyboard the current kboard so that |
| 16195 | kboard-local variables in the mode_line_format will get the right | 16195 | kboard-local variables in the mode_line_format will get the right |
| 16196 | values. */ | 16196 | values. */ |
| 16197 | push_frame_kboard (it.f); | 16197 | push_kboard (FRAME_KBOARD (it.f)); |
| 16198 | display_mode_element (&it, 0, 0, 0, format, Qnil, 0); | 16198 | display_mode_element (&it, 0, 0, 0, format, Qnil, 0); |
| 16199 | pop_kboard (); | 16199 | pop_kboard (); |
| 16200 | 16200 | ||
| @@ -16908,7 +16908,7 @@ are the selected window and the window's buffer). */) | |||
| 16908 | = (NILP (face) ? Qnil : Fcons (Qface, Fcons (face, Qnil))); | 16908 | = (NILP (face) ? Qnil : Fcons (Qface, Fcons (face, Qnil))); |
| 16909 | } | 16909 | } |
| 16910 | 16910 | ||
| 16911 | push_frame_kboard (it.f); | 16911 | push_kboard (FRAME_KBOARD (it.f)); |
| 16912 | display_mode_element (&it, 0, 0, 0, format, Qnil, 0); | 16912 | display_mode_element (&it, 0, 0, 0, format, Qnil, 0); |
| 16913 | pop_kboard (); | 16913 | pop_kboard (); |
| 16914 | 16914 | ||