changeset 83318:666b48e39a5a

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
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 26 Jun 2005 04:35:44 +0000
parents e235da12dd03
children 8f5787c83345
files README.multi-tty src/keyboard.c src/sysdep.c
diffstat 3 files changed, 38 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/README.multi-tty	Sun Jun 26 03:20:47 2005 +0000
+++ b/README.multi-tty	Sun Jun 26 04:35:44 2005 +0000
@@ -377,6 +377,30 @@
 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 @@
 ** 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 @@
 
    (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 @@
 
    (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
--- a/src/keyboard.c	Sun Jun 26 03:20:47 2005 +0000
+++ b/src/keyboard.c	Sun Jun 26 04:35:44 2005 +0000
@@ -10584,8 +10584,9 @@
 #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 @@
     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
--- a/src/sysdep.c	Sun Jun 26 03:20:47 2005 +0000
+++ b/src/sysdep.c	Sun Jun 26 04:35:44 2005 +0000
@@ -1725,6 +1725,7 @@
 
   if (tty_out->term_initted && no_redraw_on_reenter)
     {
+      /* XXX This seems wrong on multi-tty. */
       if (display_completed)
 	direct_output_forward_char (0);
     }