diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/callint.c | 3 | ||||
| -rw-r--r-- | src/callproc.c | 6 | ||||
| -rw-r--r-- | src/emacs.c | 4 | ||||
| -rw-r--r-- | src/keyboard.c | 123 | ||||
| -rw-r--r-- | src/lisp.h | 4 | ||||
| -rw-r--r-- | src/minibuf.c | 3 | ||||
| -rw-r--r-- | src/sysdep.c | 17 | ||||
| -rw-r--r-- | src/xdisp.c | 100 |
8 files changed, 184 insertions, 76 deletions
diff --git a/src/callint.c b/src/callint.c index ed86bc90048..398bfde468b 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -244,7 +244,8 @@ usage: (funcall-interactively FUNCTION &rest ARGUMENTS) */) | |||
| 244 | (ptrdiff_t nargs, Lisp_Object *args) | 244 | (ptrdiff_t nargs, Lisp_Object *args) |
| 245 | { | 245 | { |
| 246 | specpdl_ref speccount = SPECPDL_INDEX (); | 246 | specpdl_ref speccount = SPECPDL_INDEX (); |
| 247 | temporarily_switch_to_single_kboard (NULL); | 247 | if (!multiple_terminals_merge_keyboards) |
| 248 | temporarily_switch_to_single_kboard (NULL); | ||
| 248 | 249 | ||
| 249 | /* Nothing special to do here, all the work is inside | 250 | /* Nothing special to do here, all the work is inside |
| 250 | `called-interactively-p'. Which will look for us as a marker in the | 251 | `called-interactively-p'. Which will look for us as a marker in the |
diff --git a/src/callproc.c b/src/callproc.c index abb944c3aad..52977b29f30 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -2237,7 +2237,7 @@ the system. */); | |||
| 2237 | Vrcs2log_program_name = build_string ("librcs2log.so"); | 2237 | Vrcs2log_program_name = build_string ("librcs2log.so"); |
| 2238 | #endif /* !HAVE_ANDROID || ANDROID_STUBIFY */ | 2238 | #endif /* !HAVE_ANDROID || ANDROID_STUBIFY */ |
| 2239 | 2239 | ||
| 2240 | DEFVAR_LISP ("command-line-max-length", Vcommand_line_max_length, | 2240 | DEFVAR_INT ("command-line-max-length", command_line_max_length, |
| 2241 | doc: /* Maximum length of a command and its arguments on this system. | 2241 | doc: /* Maximum length of a command and its arguments on this system. |
| 2242 | This is measured in characters. | 2242 | This is measured in characters. |
| 2243 | Used by `multiple-command-partition-arguments'. Other code calls that | 2243 | Used by `multiple-command-partition-arguments'. Other code calls that |
| @@ -2246,9 +2246,9 @@ multiple times on subsequent partitions of the list of arguments. | |||
| 2246 | (In a shell script, you might use the `xargs' utility.) */); | 2246 | (In a shell script, you might use the `xargs' utility.) */); |
| 2247 | #if defined _SC_ARG_MAX | 2247 | #if defined _SC_ARG_MAX |
| 2248 | /* Divide it by 4 as a crude way to go bytes->characters. */ | 2248 | /* Divide it by 4 as a crude way to go bytes->characters. */ |
| 2249 | Vcommand_line_max_length = make_fixnum (sysconf (_SC_ARG_MAX) / 4); | 2249 | command_line_max_length = sysconf (_SC_ARG_MAX) / 4; |
| 2250 | #else /* defined _SC_ARG_MAX */ | 2250 | #else /* defined _SC_ARG_MAX */ |
| 2251 | Vcommand_line_max_length = make_fixnum (4096); | 2251 | command_line_max_length = 4096; |
| 2252 | #endif /* defined _SC_ARG_MAX */ | 2252 | #endif /* defined _SC_ARG_MAX */ |
| 2253 | 2253 | ||
| 2254 | defsubr (&Scall_process); | 2254 | defsubr (&Scall_process); |
diff --git a/src/emacs.c b/src/emacs.c index 17c56986083..6929886424f 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -2947,7 +2947,9 @@ sort_args (int argc, char **argv) | |||
| 2947 | DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 2, "P", | 2947 | DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 2, "P", |
| 2948 | doc: /* Exit the Emacs job and kill it. | 2948 | doc: /* Exit the Emacs job and kill it. |
| 2949 | If ARG is an integer, return ARG as the exit program code. | 2949 | If ARG is an integer, return ARG as the exit program code. |
| 2950 | If ARG is a string, stuff it as keyboard input. | 2950 | If ARG is a string, stuff it and then a newline as keyboard input, |
| 2951 | if Emacs is running interactively on a terminal and the platform | ||
| 2952 | supports and allows stuffing; this may need special privileges. | ||
| 2951 | Any other value of ARG, or ARG omitted, means return an | 2953 | Any other value of ARG, or ARG omitted, means return an |
| 2952 | exit code that indicates successful program termination. | 2954 | exit code that indicates successful program termination. |
| 2953 | 2955 | ||
diff --git a/src/keyboard.c b/src/keyboard.c index ffe47460528..994356b0919 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -826,7 +826,7 @@ This function is called by the editor initialization to begin editing. */) | |||
| 826 | like it is done in the splash screen display, we have to | 826 | like it is done in the splash screen display, we have to |
| 827 | make sure that we restore single_kboard as command_loop_1 | 827 | make sure that we restore single_kboard as command_loop_1 |
| 828 | would have done if it were left normally. */ | 828 | would have done if it were left normally. */ |
| 829 | if (command_loop_level > 0) | 829 | if (command_loop_level > 0 && !multiple_terminals_merge_keyboards) |
| 830 | temporarily_switch_to_single_kboard (SELECTED_FRAME ()); | 830 | temporarily_switch_to_single_kboard (SELECTED_FRAME ()); |
| 831 | 831 | ||
| 832 | recursive_edit_1 (); | 832 | recursive_edit_1 (); |
| @@ -2297,6 +2297,7 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object, | |||
| 2297 | /* Input of single characters from keyboard. */ | 2297 | /* Input of single characters from keyboard. */ |
| 2298 | 2298 | ||
| 2299 | static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, bool *used_mouse_menu, | 2299 | static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, bool *used_mouse_menu, |
| 2300 | struct frame **event_frame, | ||
| 2300 | struct timespec *end_time); | 2301 | struct timespec *end_time); |
| 2301 | static void record_char (Lisp_Object c); | 2302 | static void record_char (Lisp_Object c); |
| 2302 | 2303 | ||
| @@ -2342,7 +2343,8 @@ read_event_from_main_queue (struct timespec *end_time, | |||
| 2342 | restore_getcjmp (local_getcjmp); | 2343 | restore_getcjmp (local_getcjmp); |
| 2343 | if (!end_time) | 2344 | if (!end_time) |
| 2344 | timer_start_idle (); | 2345 | timer_start_idle (); |
| 2345 | c = kbd_buffer_get_event (&kb, used_mouse_menu, end_time); | 2346 | struct frame *frame; |
| 2347 | c = kbd_buffer_get_event (&kb, used_mouse_menu, &frame, end_time); | ||
| 2346 | unbind_to (count, Qnil); | 2348 | unbind_to (count, Qnil); |
| 2347 | 2349 | ||
| 2348 | if (! NILP (c) && (kb != current_kboard)) | 2350 | if (! NILP (c) && (kb != current_kboard)) |
| @@ -2360,9 +2362,26 @@ read_event_from_main_queue (struct timespec *end_time, | |||
| 2360 | else | 2362 | else |
| 2361 | XSETCDR (last, list1 (c)); | 2363 | XSETCDR (last, list1 (c)); |
| 2362 | kb->kbd_queue_has_data = true; | 2364 | kb->kbd_queue_has_data = true; |
| 2363 | c = Qnil; | ||
| 2364 | if (single_kboard) | 2365 | if (single_kboard) |
| 2365 | goto start; | 2366 | { |
| 2367 | /* Typing and clicking in a locked frame is confusing because | ||
| 2368 | it seems like Emacs has completely locked up (bug#79892). | ||
| 2369 | Show a message about what's happening. */ | ||
| 2370 | /* FIXME: We also display the message in the unlocked frame. | ||
| 2371 | Can we avoid that? */ | ||
| 2372 | if (frame | ||
| 2373 | && (FIXNUMP (c) || (EVENT_HAS_PARAMETERS (c) | ||
| 2374 | && EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), | ||
| 2375 | Qmouse_click)))) | ||
| 2376 | { | ||
| 2377 | AUTO_STRING (locked, "Frame is locked; see" | ||
| 2378 | " `multiple-terminals-merge-keyboards'" | ||
| 2379 | " variable"); | ||
| 2380 | message3_frame (Fformat_message (1, &locked), frame); | ||
| 2381 | } | ||
| 2382 | c = Qnil; | ||
| 2383 | goto start; | ||
| 2384 | } | ||
| 2366 | current_kboard = kb; | 2385 | current_kboard = kb; |
| 2367 | return make_fixnum (-2); | 2386 | return make_fixnum (-2); |
| 2368 | } | 2387 | } |
| @@ -4005,6 +4024,7 @@ kbd_buffer_get_event_2 (Lisp_Object val) | |||
| 4005 | static Lisp_Object | 4024 | static Lisp_Object |
| 4006 | kbd_buffer_get_event (KBOARD **kbp, | 4025 | kbd_buffer_get_event (KBOARD **kbp, |
| 4007 | bool *used_mouse_menu, | 4026 | bool *used_mouse_menu, |
| 4027 | struct frame **event_frame, | ||
| 4008 | struct timespec *end_time) | 4028 | struct timespec *end_time) |
| 4009 | { | 4029 | { |
| 4010 | Lisp_Object obj, str; | 4030 | Lisp_Object obj, str; |
| @@ -4019,6 +4039,8 @@ kbd_buffer_get_event (KBOARD **kbp, | |||
| 4019 | had_pending_conversion_events = false; | 4039 | had_pending_conversion_events = false; |
| 4020 | #endif | 4040 | #endif |
| 4021 | 4041 | ||
| 4042 | *event_frame = NULL; | ||
| 4043 | |||
| 4022 | #ifdef subprocesses | 4044 | #ifdef subprocesses |
| 4023 | if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE / 4) | 4045 | if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE / 4) |
| 4024 | { | 4046 | { |
| @@ -4179,6 +4201,9 @@ kbd_buffer_get_event (KBOARD **kbp, | |||
| 4179 | if (*kbp == 0) | 4201 | if (*kbp == 0) |
| 4180 | *kbp = current_kboard; /* Better than returning null ptr? */ | 4202 | *kbp = current_kboard; /* Better than returning null ptr? */ |
| 4181 | 4203 | ||
| 4204 | if (FRAMEP (event->ie.frame_or_window)) | ||
| 4205 | *event_frame = XFRAME (event->ie.frame_or_window); | ||
| 4206 | |||
| 4182 | obj = Qnil; | 4207 | obj = Qnil; |
| 4183 | 4208 | ||
| 4184 | /* These two kinds of events get special handling | 4209 | /* These two kinds of events get special handling |
| @@ -4492,13 +4517,14 @@ kbd_buffer_get_event (KBOARD **kbp, | |||
| 4492 | /* Try generating a mouse motion event. */ | 4517 | /* Try generating a mouse motion event. */ |
| 4493 | else if (some_mouse_moved ()) | 4518 | else if (some_mouse_moved ()) |
| 4494 | { | 4519 | { |
| 4495 | struct frame *f, *movement_frame = some_mouse_moved (); | 4520 | struct frame *f; |
| 4496 | Lisp_Object bar_window; | 4521 | Lisp_Object bar_window; |
| 4497 | enum scroll_bar_part part; | 4522 | enum scroll_bar_part part; |
| 4498 | Lisp_Object x, y; | 4523 | Lisp_Object x, y; |
| 4499 | Time t; | 4524 | Time t; |
| 4500 | 4525 | ||
| 4501 | f = movement_frame; | 4526 | *event_frame = some_mouse_moved (); |
| 4527 | f = *event_frame; | ||
| 4502 | *kbp = current_kboard; | 4528 | *kbp = current_kboard; |
| 4503 | /* Note that this uses F to determine which terminal to look at. | 4529 | /* Note that this uses F to determine which terminal to look at. |
| 4504 | If there is no valid info, it does not store anything | 4530 | If there is no valid info, it does not store anything |
| @@ -4535,8 +4561,8 @@ kbd_buffer_get_event (KBOARD **kbp, | |||
| 4535 | obj = make_lispy_movement (f, bar_window, part, x, y, t); | 4561 | obj = make_lispy_movement (f, bar_window, part, x, y, t); |
| 4536 | 4562 | ||
| 4537 | if (!NILP (obj)) | 4563 | if (!NILP (obj)) |
| 4538 | Vlast_event_device = (STRINGP (movement_frame->last_mouse_device) | 4564 | Vlast_event_device = (STRINGP ((*event_frame)->last_mouse_device) |
| 4539 | ? movement_frame->last_mouse_device | 4565 | ? (*event_frame)->last_mouse_device |
| 4540 | : virtual_core_pointer_name); | 4566 | : virtual_core_pointer_name); |
| 4541 | } | 4567 | } |
| 4542 | #ifdef HAVE_X_WINDOWS | 4568 | #ifdef HAVE_X_WINDOWS |
| @@ -12395,19 +12421,15 @@ DEFUN ("suspend-emacs", Fsuspend_emacs, Ssuspend_emacs, 0, 1, "", | |||
| 12395 | If `cannot-suspend' is non-nil, or if the system doesn't support job | 12421 | If `cannot-suspend' is non-nil, or if the system doesn't support job |
| 12396 | control, run a subshell instead. | 12422 | control, run a subshell instead. |
| 12397 | 12423 | ||
| 12398 | If optional arg STUFFSTRING is non-nil, its characters are stuffed | 12424 | If optional arg STUFFSTRING is non-nil, stuff it and then a newline as |
| 12399 | to be read as terminal input by Emacs's parent, after suspension. | 12425 | keyboard input, if Emacs is running interactively on a terminal and the |
| 12426 | platform supports and allows stuffing; this may need special privileges. | ||
| 12400 | 12427 | ||
| 12401 | Before suspending, run the normal hook `suspend-hook'. | 12428 | Before suspending, run the normal hook `suspend-hook'. |
| 12402 | After resumption run the normal hook `suspend-resume-hook'. | 12429 | After resumption run the normal hook `suspend-resume-hook'. |
| 12403 | 12430 | ||
| 12404 | Some operating systems cannot stop the Emacs process and resume it later. | 12431 | Some operating systems cannot stop the Emacs process and resume it later. |
| 12405 | On such systems, Emacs starts a subshell instead of suspending. | 12432 | On such systems, Emacs starts a subshell instead of suspending. */) |
| 12406 | |||
| 12407 | On some operating systems, stuffing characters into terminal input | ||
| 12408 | buffer requires special privileges or is not supported at all. | ||
| 12409 | On such systems, calling this function with non-nil STUFFSTRING might | ||
| 12410 | either signal an error or silently fail to stuff the characters. */) | ||
| 12411 | (Lisp_Object stuffstring) | 12433 | (Lisp_Object stuffstring) |
| 12412 | { | 12434 | { |
| 12413 | specpdl_ref count = SPECPDL_INDEX (); | 12435 | specpdl_ref count = SPECPDL_INDEX (); |
| @@ -12446,38 +12468,34 @@ either signal an error or silently fail to stuff the characters. */) | |||
| 12446 | return Qnil; | 12468 | return Qnil; |
| 12447 | } | 12469 | } |
| 12448 | 12470 | ||
| 12449 | /* If STUFFSTRING is a string, stuff its contents as pending terminal input. | 12471 | /* If STUFFSTRING is a string, stuff its contents and then a newline as |
| 12450 | Then in any case stuff anything Emacs has read ahead and not used. */ | 12472 | pending terminal input. Then stuff anything Emacs has read ahead and |
| 12473 | not used. However, do nothing if stuffing does not work. */ | ||
| 12451 | 12474 | ||
| 12452 | void | 12475 | void |
| 12453 | stuff_buffered_input (Lisp_Object stuffstring) | 12476 | stuff_buffered_input (Lisp_Object stuffstring) |
| 12454 | { | 12477 | { |
| 12455 | #ifdef SIGTSTP /* stuff_char is defined if SIGTSTP. */ | 12478 | #ifdef SIGTSTP /* stuff_char is defined if SIGTSTP. */ |
| 12456 | register unsigned char *p; | 12479 | int bad_stuff = 0; |
| 12457 | 12480 | ||
| 12458 | if (STRINGP (stuffstring)) | 12481 | if (STRINGP (stuffstring)) |
| 12459 | { | 12482 | { |
| 12460 | register ptrdiff_t count; | 12483 | char *p = SSDATA (stuffstring); |
| 12461 | 12484 | for (ptrdiff_t i = SBYTES (stuffstring); !bad_stuff && 0 < i; i--) | |
| 12462 | p = SDATA (stuffstring); | 12485 | bad_stuff = stuff_char (*p++); |
| 12463 | count = SBYTES (stuffstring); | 12486 | if (!bad_stuff) |
| 12464 | while (count-- > 0) | 12487 | bad_stuff = stuff_char ('\n'); |
| 12465 | stuff_char (*p++); | ||
| 12466 | stuff_char ('\n'); | ||
| 12467 | } | 12488 | } |
| 12468 | 12489 | ||
| 12469 | /* Anything we have read ahead, put back for the shell to read. */ | 12490 | /* Anything we have read ahead, put back for the shell to read. |
| 12470 | /* ?? What should this do when we have multiple keyboards?? | 12491 | When we have multiple keyboards, we should stuff everything back |
| 12471 | Should we ignore anything that was typed in at the "wrong" kboard? | 12492 | into the keyboard it came from, but fixing this is low priority as |
| 12472 | 12493 | many systems prohibit stuffing for security reasons. */ | |
| 12473 | rms: we should stuff everything back into the kboard | ||
| 12474 | it came from. */ | ||
| 12475 | for (; kbd_fetch_ptr != kbd_store_ptr; | 12494 | for (; kbd_fetch_ptr != kbd_store_ptr; |
| 12476 | kbd_fetch_ptr = next_kbd_event (kbd_fetch_ptr)) | 12495 | kbd_fetch_ptr = next_kbd_event (kbd_fetch_ptr)) |
| 12477 | { | 12496 | { |
| 12478 | 12497 | if (kbd_fetch_ptr->kind == ASCII_KEYSTROKE_EVENT && !bad_stuff) | |
| 12479 | if (kbd_fetch_ptr->kind == ASCII_KEYSTROKE_EVENT) | 12498 | bad_stuff = stuff_char (kbd_fetch_ptr->ie.code); |
| 12480 | stuff_char (kbd_fetch_ptr->ie.code); | ||
| 12481 | 12499 | ||
| 12482 | clear_event (&kbd_fetch_ptr->ie); | 12500 | clear_event (&kbd_fetch_ptr->ie); |
| 12483 | } | 12501 | } |
| @@ -14430,6 +14448,41 @@ function is called to remap that sequence. */); | |||
| 14430 | Vcurrent_key_remap_sequence = Qnil; | 14448 | Vcurrent_key_remap_sequence = Qnil; |
| 14431 | DEFSYM (Qcurrent_key_remap_sequence, "current-key-remap-sequence"); | 14449 | DEFSYM (Qcurrent_key_remap_sequence, "current-key-remap-sequence"); |
| 14432 | 14450 | ||
| 14451 | DEFVAR_BOOL ("multiple-terminals-merge-keyboards", | ||
| 14452 | multiple_terminals_merge_keyboards, | ||
| 14453 | doc: /* If non-nil, treat different terminals' keyboards as less isolated. | ||
| 14454 | |||
| 14455 | Each terminal displaying Emacs frames has an associated keyboard. | ||
| 14456 | Normally, Emacs assumes that these keyboards are physically | ||
| 14457 | distinct, so that someone could be typing on one keyboard and | ||
| 14458 | someone else typing on another, into different frames on different | ||
| 14459 | terminals. In certain situations, however, Emacs enters | ||
| 14460 | single-keyboard mode, in which input from all but one keyboard is | ||
| 14461 | blocked. This prevents keys typed on one keyboard from interfering | ||
| 14462 | with an operation started on another keyboard. The main operation | ||
| 14463 | to which this applies is entering a recursive edit, which includes | ||
| 14464 | all minibuffer prompting. | ||
| 14465 | |||
| 14466 | Single-keyboard mode can be inconvenient when there are distinct | ||
| 14467 | terminals and so distinct keyboards, but only one user and one | ||
| 14468 | physical keyboard in control of Emacs. This can happen with X | ||
| 14469 | forwarding: with a remote Emacs daemon and multiple frames created | ||
| 14470 | with a command like `ssh -X daemon-host emacsclient -c', then from | ||
| 14471 | the remote Emacs daemon's point of view there is one terminal and | ||
| 14472 | one keyboard per `ssh -X daemon-host' command invoked, but in fact a | ||
| 14473 | single local X server displays all frames, and there is just one | ||
| 14474 | physical keyboard. In this situation, you may prefer to have the | ||
| 14475 | different frames behave as though they had been created with | ||
| 14476 | \\[make-frame-command]. In that case, starting a recursive edit in \ | ||
| 14477 | one frame does | ||
| 14478 | not mean that keyboard input into other frames is blocked. | ||
| 14479 | |||
| 14480 | If this option is non-nil, Emacs will not enter single-keyboard | ||
| 14481 | mode when entering a recursive edit. It will still enter | ||
| 14482 | single-keyboard mode in certain other cases where doing so is | ||
| 14483 | necessary for the operation to work at all. */); | ||
| 14484 | multiple_terminals_merge_keyboards = false; | ||
| 14485 | |||
| 14433 | pdumper_do_now_and_after_load (syms_of_keyboard_for_pdumper); | 14486 | pdumper_do_now_and_after_load (syms_of_keyboard_for_pdumper); |
| 14434 | 14487 | ||
| 14435 | DEFSYM (Qactivate_mark_hook, "activate-mark-hook"); | 14488 | DEFSYM (Qactivate_mark_hook, "activate-mark-hook"); |
diff --git a/src/lisp.h b/src/lisp.h index c7afb07576b..37c34dfbe84 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -4390,6 +4390,8 @@ extern void message1 (const char *); | |||
| 4390 | extern void message1_nolog (const char *); | 4390 | extern void message1_nolog (const char *); |
| 4391 | extern void message3 (Lisp_Object); | 4391 | extern void message3 (Lisp_Object); |
| 4392 | extern void message3_nolog (Lisp_Object); | 4392 | extern void message3_nolog (Lisp_Object); |
| 4393 | extern void message3_frame (Lisp_Object, struct frame *); | ||
| 4394 | extern void message3_frame_nolog (Lisp_Object, struct frame *); | ||
| 4393 | extern void message_dolog (const char *, ptrdiff_t, bool, bool); | 4395 | extern void message_dolog (const char *, ptrdiff_t, bool, bool); |
| 4394 | extern void message_with_string (const char *, Lisp_Object, bool); | 4396 | extern void message_with_string (const char *, Lisp_Object, bool); |
| 4395 | extern void message_log_maybe_newline (void); | 4397 | extern void message_log_maybe_newline (void); |
| @@ -5278,7 +5280,7 @@ maybe_disable_address_randomization (int argc, char **argv) | |||
| 5278 | extern int emacs_exec_file (char const *, char *const *, char *const *); | 5280 | extern int emacs_exec_file (char const *, char *const *, char *const *); |
| 5279 | extern void init_standard_fds (void); | 5281 | extern void init_standard_fds (void); |
| 5280 | extern char *emacs_get_current_dir_name (void); | 5282 | extern char *emacs_get_current_dir_name (void); |
| 5281 | extern void stuff_char (char c); | 5283 | extern int stuff_char (char c); |
| 5282 | extern void init_foreground_group (void); | 5284 | extern void init_foreground_group (void); |
| 5283 | extern void sys_subshell (void); | 5285 | extern void sys_subshell (void); |
| 5284 | extern void sys_suspend (void); | 5286 | extern void sys_suspend (void); |
diff --git a/src/minibuf.c b/src/minibuf.c index e49663e2f86..c716ac0d811 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -712,7 +712,8 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | |||
| 712 | if (minibuffer_auto_raise) | 712 | if (minibuffer_auto_raise) |
| 713 | Fraise_frame (mini_frame); | 713 | Fraise_frame (mini_frame); |
| 714 | 714 | ||
| 715 | temporarily_switch_to_single_kboard (XFRAME (mini_frame)); | 715 | if (!multiple_terminals_merge_keyboards) |
| 716 | temporarily_switch_to_single_kboard (XFRAME (mini_frame)); | ||
| 716 | 717 | ||
| 717 | /* We have to do this after saving the window configuration | 718 | /* We have to do this after saving the window configuration |
| 718 | since that is what restores the current buffer. */ | 719 | since that is what restores the current buffer. */ |
diff --git a/src/sysdep.c b/src/sysdep.c index 2f5572009fb..8895655566e 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -390,23 +390,22 @@ discard_tty_input (void) | |||
| 390 | 390 | ||
| 391 | /* Arrange for character C to be read as the next input from | 391 | /* Arrange for character C to be read as the next input from |
| 392 | the terminal. | 392 | the terminal. |
| 393 | Return 0 on success, -1 otherwise. | ||
| 393 | XXX What if we have multiple ttys? | 394 | XXX What if we have multiple ttys? |
| 394 | */ | 395 | */ |
| 395 | 396 | ||
| 396 | void | 397 | int |
| 397 | stuff_char (char c) | 398 | stuff_char (char c) |
| 398 | { | 399 | { |
| 399 | if (! (FRAMEP (selected_frame) | ||
| 400 | && FRAME_LIVE_P (XFRAME (selected_frame)) | ||
| 401 | && FRAME_TERMCAP_P (XFRAME (selected_frame)))) | ||
| 402 | return; | ||
| 403 | |||
| 404 | /* Should perhaps error if in batch mode */ | 400 | /* Should perhaps error if in batch mode */ |
| 405 | #ifdef TIOCSTI | 401 | #ifdef TIOCSTI |
| 406 | ioctl (fileno (CURTTY()->input), TIOCSTI, &c); | 402 | if (FRAMEP (selected_frame) |
| 407 | #else /* no TIOCSTI */ | 403 | && FRAME_LIVE_P (XFRAME (selected_frame)) |
| 408 | error ("Cannot stuff terminal input characters in this version of Unix"); | 404 | && FRAME_TERMCAP_P (XFRAME (selected_frame))) |
| 405 | return ioctl (fileno (CURTTY()->input), TIOCSTI, &c); | ||
| 409 | #endif /* no TIOCSTI */ | 406 | #endif /* no TIOCSTI */ |
| 407 | |||
| 408 | return -1; | ||
| 410 | } | 409 | } |
| 411 | 410 | ||
| 412 | #endif /* SIGTSTP */ | 411 | #endif /* SIGTSTP */ |
diff --git a/src/xdisp.c b/src/xdisp.c index f5e2b6e2d24..c8e4bf0cf10 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -510,6 +510,10 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 510 | /* Holds the list (error). */ | 510 | /* Holds the list (error). */ |
| 511 | static Lisp_Object list_of_error; | 511 | static Lisp_Object list_of_error; |
| 512 | 512 | ||
| 513 | /* Forward declarations. */ | ||
| 514 | static void restore_selected_window (Lisp_Object); | ||
| 515 | static void restore_frame_selected_window (Lisp_Object); | ||
| 516 | |||
| 513 | #ifdef HAVE_WINDOW_SYSTEM | 517 | #ifdef HAVE_WINDOW_SYSTEM |
| 514 | 518 | ||
| 515 | /* Test if overflow newline into fringe. Called with iterator IT | 519 | /* Test if overflow newline into fringe. Called with iterator IT |
| @@ -12481,15 +12485,8 @@ message_log_check_duplicate (ptrdiff_t prev_bol_byte, ptrdiff_t this_bol_byte) | |||
| 12481 | } | 12485 | } |
| 12482 | 12486 | ||
| 12483 | 12487 | ||
| 12484 | /* Display an echo area message M with a specified length of NBYTES | 12488 | static void |
| 12485 | bytes. The string may include null characters. If M is not a | 12489 | log_message (Lisp_Object m) |
| 12486 | string, clear out any existing message, and let the mini-buffer | ||
| 12487 | text show through. | ||
| 12488 | |||
| 12489 | This function cancels echoing. */ | ||
| 12490 | |||
| 12491 | void | ||
| 12492 | message3 (Lisp_Object m) | ||
| 12493 | { | 12490 | { |
| 12494 | clear_message (true, true); | 12491 | clear_message (true, true); |
| 12495 | cancel_echoing (); | 12492 | cancel_echoing (); |
| @@ -12506,10 +12503,34 @@ message3 (Lisp_Object m) | |||
| 12506 | message_dolog (buffer, nbytes, true, multibyte); | 12503 | message_dolog (buffer, nbytes, true, multibyte); |
| 12507 | SAFE_FREE (); | 12504 | SAFE_FREE (); |
| 12508 | } | 12505 | } |
| 12506 | } | ||
| 12507 | |||
| 12508 | /* Display an echo area message M with a specified length of NBYTES | ||
| 12509 | bytes. The string may include null characters. If M is not a | ||
| 12510 | string, clear out any existing message, and let the mini-buffer | ||
| 12511 | text show through. | ||
| 12512 | |||
| 12513 | This function cancels echoing. */ | ||
| 12514 | |||
| 12515 | void | ||
| 12516 | message3 (Lisp_Object m) | ||
| 12517 | { | ||
| 12518 | log_message (m); | ||
| 12509 | if (! inhibit_message) | 12519 | if (! inhibit_message) |
| 12510 | message3_nolog (m); | 12520 | message3_nolog (m); |
| 12511 | } | 12521 | } |
| 12512 | 12522 | ||
| 12523 | /* Display an echo area message M on frame F, which may not be the | ||
| 12524 | selected frame. */ | ||
| 12525 | |||
| 12526 | void | ||
| 12527 | message3_frame (Lisp_Object m, struct frame *f) | ||
| 12528 | { | ||
| 12529 | log_message (m); | ||
| 12530 | if (! inhibit_message) | ||
| 12531 | message3_frame_nolog (m, f); | ||
| 12532 | } | ||
| 12533 | |||
| 12513 | /* Log the message M to stderr. Log an empty line if M is not a string. */ | 12534 | /* Log the message M to stderr. Log an empty line if M is not a string. */ |
| 12514 | 12535 | ||
| 12515 | static void | 12536 | static void |
| @@ -12538,7 +12559,7 @@ message_to_stderr (Lisp_Object m) | |||
| 12538 | errputc ('\n'); | 12559 | errputc ('\n'); |
| 12539 | } | 12560 | } |
| 12540 | 12561 | ||
| 12541 | /* The non-logging version of message3. | 12562 | /* The non-logging versions of message3 & message3_frame. |
| 12542 | This does not cancel echoing, because it is used for echoing. | 12563 | This does not cancel echoing, because it is used for echoing. |
| 12543 | Perhaps we need to make a separate function for echoing | 12564 | Perhaps we need to make a separate function for echoing |
| 12544 | and make this cancel echoing. */ | 12565 | and make this cancel echoing. */ |
| @@ -12546,28 +12567,55 @@ message_to_stderr (Lisp_Object m) | |||
| 12546 | void | 12567 | void |
| 12547 | message3_nolog (Lisp_Object m) | 12568 | message3_nolog (Lisp_Object m) |
| 12548 | { | 12569 | { |
| 12570 | message3_frame_nolog (m, NULL); | ||
| 12571 | } | ||
| 12572 | |||
| 12573 | void | ||
| 12574 | message3_frame_nolog (Lisp_Object m, struct frame *f) | ||
| 12575 | { | ||
| 12549 | struct frame *sf = SELECTED_FRAME (); | 12576 | struct frame *sf = SELECTED_FRAME (); |
| 12577 | if (!f) f = sf; | ||
| 12550 | 12578 | ||
| 12551 | if (FRAME_INITIAL_P (sf)) | 12579 | if (FRAME_INITIAL_P (f)) |
| 12552 | message_to_stderr (m); | 12580 | message_to_stderr (m); |
| 12553 | /* Error messages get reported properly by cmd_error, so this must be just an | 12581 | /* Error messages get reported properly by cmd_error, so this must be |
| 12554 | informative message; if the frame hasn't really been initialized yet, just | 12582 | just an informative message; therefore if the frame hasn't really |
| 12555 | toss it. */ | 12583 | been initialized yet, just toss it. */ |
| 12556 | else if (INTERACTIVE && sf->glyphs_initialized_p) | 12584 | else if (INTERACTIVE && f->glyphs_initialized_p) |
| 12557 | { | 12585 | { |
| 12558 | /* Get the frame containing the mini-buffer | 12586 | Lisp_Object frame = Qnil; |
| 12559 | that the selected frame is using. */ | 12587 | struct frame *mbf = NULL; |
| 12560 | Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf); | 12588 | specpdl_ref count = SPECPDL_INDEX (); |
| 12561 | Lisp_Object frame = XWINDOW (mini_window)->frame; | 12589 | |
| 12562 | struct frame *f = XFRAME (frame); | 12590 | if (f == sf) |
| 12591 | { | ||
| 12592 | /* Get the frame containing the mini-buffer that the selected | ||
| 12593 | frame is using. */ | ||
| 12594 | Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (f); | ||
| 12595 | frame = XWINDOW (mini_window)->frame; | ||
| 12596 | mbf = XFRAME (frame); | ||
| 12563 | 12597 | ||
| 12564 | if (FRAME_VISIBLE_P (sf) && !FRAME_VISIBLE_P (f)) | 12598 | if (FRAME_VISIBLE_P (f) && !FRAME_VISIBLE_P (mbf)) |
| 12565 | Fmake_frame_visible (frame); | 12599 | Fmake_frame_visible (frame); |
| 12600 | } | ||
| 12601 | else | ||
| 12602 | { | ||
| 12603 | /* We temporarily switch frame, show the message, and then | ||
| 12604 | when we unwind the message will normally still be visible | ||
| 12605 | in the other frame, at least for a few seconds. */ | ||
| 12606 | record_unwind_protect | ||
| 12607 | (restore_selected_window, selected_window); | ||
| 12608 | record_unwind_protect | ||
| 12609 | (restore_frame_selected_window, f->selected_window); | ||
| 12610 | XSETFRAME (frame, f); | ||
| 12611 | selected_frame = frame; | ||
| 12612 | selected_window = FRAME_SELECTED_WINDOW (f); | ||
| 12613 | } | ||
| 12566 | 12614 | ||
| 12567 | if (STRINGP (m) && SCHARS (m) > 0) | 12615 | if (STRINGP (m) && SCHARS (m) > 0) |
| 12568 | { | 12616 | { |
| 12569 | set_message (m); | 12617 | set_message (m); |
| 12570 | if (minibuffer_auto_raise) | 12618 | if (minibuffer_auto_raise && !NILP (frame)) |
| 12571 | Fraise_frame (frame); | 12619 | Fraise_frame (frame); |
| 12572 | /* Assume we are not echoing. | 12620 | /* Assume we are not echoing. |
| 12573 | (If we are, echo_now will override this.) */ | 12621 | (If we are, echo_now will override this.) */ |
| @@ -12579,8 +12627,10 @@ message3_nolog (Lisp_Object m) | |||
| 12579 | do_pending_window_change (false); | 12627 | do_pending_window_change (false); |
| 12580 | echo_area_display (true); | 12628 | echo_area_display (true); |
| 12581 | do_pending_window_change (false); | 12629 | do_pending_window_change (false); |
| 12582 | if (FRAME_TERMINAL (f)->frame_up_to_date_hook) | 12630 | if (mbf && FRAME_TERMINAL (mbf)->frame_up_to_date_hook) |
| 12583 | (*FRAME_TERMINAL (f)->frame_up_to_date_hook) (f); | 12631 | (*FRAME_TERMINAL (mbf)->frame_up_to_date_hook) (mbf); |
| 12632 | |||
| 12633 | unbind_to (count, Qnil); | ||
| 12584 | } | 12634 | } |
| 12585 | } | 12635 | } |
| 12586 | 12636 | ||