From 1fb8c4adcbf2d3c833b3e6bbb86211109085fa86 Mon Sep 17 00:00:00 2001 From: Karoly Lorentey Date: Sun, 26 Jun 2005 04:35:44 +0000 Subject: [PATCH] Work around mysterious breakage of arrow key recognition under screen (see first TODO in README). * src/keyboard.c (Fset_input_mode): Call reset_sys_modes and init_sys_modes on the selected device only; do not use the bulk functions reset_all_sys_modes and init_all_sys_modes. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-358 --- README.multi-tty | 41 ++++++++++++++++++++++++++++++++--------- src/keyboard.c | 8 +++++--- src/sysdep.c | 1 + 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/README.multi-tty b/README.multi-tty index 4ad9f990a82..f06500f4a73 100644 --- a/README.multi-tty +++ b/README.multi-tty @@ -377,6 +377,30 @@ is probably not very interesting for anyone else.) THINGS TO DO ------------ +** Having {reset,init}_all_sys_modes in set-input-mode breaks arrow + keys on non-selected terminals under screen, and sometimes on other + terminal types as well. The other function keys continue to work + fine. Sometimes faces on these screens become garbled. + + This only seems to affect displays that are of the same terminfo + type as the selected one. Interestingly, in screen Emacs normally + reports the up arrow key as `M-o A', but after the above SNAFU, it + complains about `M-[ a'. UNIX ttys are a complete mystery to me, + but it seems the reset-reinitialize cycle somehow leaves the + non-selected terminals in a different state than usual. I have no + idea how this could happen. + + Currently set-input-mode resets only the currently selected + terminal, which seems to somehow work around the problem. + +** Fix set-input-mode for multi-tty. It's a truly horrible interface; + what if we'd blow it up into several separate functions (with a + compatibility definition)? + +** BULK RENAME: The `display-' prefix of new Lisp-level functions + conflicts with stuff like `display-time-mode'. Use `device-' + instead. + ** The single-keyboard mode of MULTI_KBOARD is extremely confusing sometimes; Emacs does not respond to stimuli from other keyboards. At least a beep or a message would be important, if the single-mode @@ -415,10 +439,6 @@ THINGS TO DO ** standard-display-table should be display-local. standard-display-european should be display-local. -** Fix set-input-mode for multi-tty. It's a truly horrible interface; - what if we'd blow it up into several separate functions (with a - compatibility definition)? - ** Have a look at Vlocale_coding_system. Seems like it would be a tedious job to localize it, although most references use it for interfacing with libc and are therefore OK with the global @@ -445,11 +465,6 @@ THINGS TO DO (This is likely an error in the CVS trunk.) -** The terminal customization files in term/*.el tend to change global - parameters, which may confuse Emacs with multiple displays. Change - them to tweak only frame-local settings, if possible. (They tend - to call define-key to set function key sequences a lot.) - ** Dan Nicolaescu suggests that -nw should be added as an alias for -t in emacsclient. Good idea. (Alas, implementing this is not trivial, getopt_long does not seem to support two-letter ``short'' @@ -1050,4 +1065,12 @@ DIARY OF CHANGES (Done, by an ugly hack.) +-- The terminal customization files in term/*.el tend to change global + parameters, which may confuse Emacs with multiple displays. Change + them to tweak only frame-local settings, if possible. (They tend + to call define-key to set function key sequences a lot.) + + (Done, by making `function-key-map' terminal-local (i.e., part of + struct kboard). This has probably covered all the remaining problems.) + ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d diff --git a/src/keyboard.c b/src/keyboard.c index 13bf7131e0e..016582d8d20 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -10584,8 +10584,9 @@ See also `current-input-mode'. */) #endif #ifndef DOS_NT - /* this causes startup screen to be restored and messes with the mouse */ - reset_all_sys_modes (); + if (FRAME_TERMCAP_P (XFRAME (selected_frame))) + /* this causes startup screen to be restored and messes with the mouse */ + reset_sys_modes (CURTTY ()); #endif #ifdef SIGIO @@ -10628,7 +10629,8 @@ See also `current-input-mode'. */) quit_char = XINT (quit) & (NILP (meta) ? 0177 : 0377); #ifndef DOS_NT - init_all_sys_modes (); + if (FRAME_TERMCAP_P (XFRAME (selected_frame))) + init_sys_modes (CURTTY ()); #endif #ifdef POLL_FOR_INPUT diff --git a/src/sysdep.c b/src/sysdep.c index 4127517b98f..56dae99dc9f 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1725,6 +1725,7 @@ nil means don't delete them until `list-processes' is run. */); if (tty_out->term_initted && no_redraw_on_reenter) { + /* XXX This seems wrong on multi-tty. */ if (display_completed) direct_output_forward_char (0); } -- 2.39.2