changeset 83409:be1f74bffc1d

Fix "first non-ASCII character on new tty frames" problem. * src/keyboard.c (kbd_buffer_store_event_hold): Simplify condition. (read_key_sequence): Reinitialize fkey and keytran at each replay. * src/coding.c (Fkeyboard_coding_system): Update doc. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-449
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 12 Dec 2005 02:37:01 +0000
parents 39bb10ce301a
children fea405284011
files README.multi-tty src/coding.c src/keyboard.c
diffstat 3 files changed, 33 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/README.multi-tty	Sun Dec 11 22:42:40 2005 +0000
+++ b/README.multi-tty	Mon Dec 12 02:37:01 2005 +0000
@@ -31,9 +31,11 @@
 contributed to the project by testing, submitting patches, bug
 reports, and suggestions.  Thanks!
 
+Bernard Adrian <bernadrian@free.fr>
 ARISAWA Akihiro <ari@mbf.ocn.ne.jp>
 Vincent Bernat <bernat@luffy.cx>
 Han Boetes <han@mijncomputer.nl>
+Damien Cassou <damien.cassou@laposte.net>
 Robert J. Chassell <bob@rattlesnake.com>
 Romain Francoise <romain@orebokech.com>
 Ami Fischman <ami@fischman.org>
@@ -191,8 +193,8 @@
 to use our binary packages; put these lines in your /etc/apt/sources.list:
 
 	# Multi-tty Emacs
-	deb http://aszt.inf.elte.hu/~lorentey/mirror/apt ./
-	deb-src http://aszt.inf.elte.hu/~lorentey/mirror/apt ./
+	deb http://aszt.inf.elte.hu/~lorentey/mirror/apt unstable multi-tty
+	deb-src http://aszt.inf.elte.hu/~lorentey/mirror/apt unstable multi-tty
 
 Note that these packages are intended solely to provide an easy way to
 test the new multi-tty features.  They are not to be taken as Emacs
@@ -208,7 +210,7 @@
 
 	make maintainer-clean  # (If you have compiled Emacs before)
 
-	./configure <your favourite options>
+	./configure --without-gtk <your favourite options>
 	make bootstrap
 	make install
 
@@ -391,6 +393,8 @@
 ** Report GTK multi-display problems to GTK maintainers.  For extra
    credit, fix them.
 
+** Disable connecting to a new X display when we use the GTK toolkit.
+
 ** Possibly turn off the double C-g feature when there is an X frame.
    C.f. (emacs)Emergency Escape.
 
@@ -564,7 +568,7 @@
 ** 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''
-   options.  Patches are welcome.) :-)
+   options.  Patches are welcome.)
 
 ** Mark Plaksin suggests that emacsclient should accept the same
    X-related command-line arguments as Emacs.  Most of the X-related
@@ -608,6 +612,8 @@
    useful.  (Update: Look again. X unconditionally enables this, maybe
    that's why raw terminal support is broken again.  I really do need
    to understand input.)
+   (Update: I am starting to understand the read_key_sequence->read-char
+   ->kbd_buffer_get_event->read_avail_input->read_socket_hook path.  Yay!)
 
 ** flow-ctrl.el must be updated.
 
@@ -914,7 +920,7 @@
    frame that is dumped with Emacs.  Checking for this frame (e.g. in
    cmd_error_internal) is ugly.
 
-   (Done, broking interactive temacs.)
+   (Done, breaking interactive temacs.)
 
 -- The command `emacsclient -t -e '(delete-frame)'' fails to exit.
 
@@ -1264,7 +1270,13 @@
    it is not recognized correctly.  May be related to the bug below.
 
    (Seems to have been fixed as a side effect of patch-434.  "The bug
-   below" was the set-input-mode madness.)
+   below" was the set-input-mode madness.)  
+
+   (Update: this bug was fixed for good in patch-449.  It was tracked
+   down to a bug in `read_key_sequence': it failed to reinitialize its
+   local function-key-map/key-translation-map references when it
+   switched keyboards.  I don't understand why did this bug only
+   appear on brand new frames, though!)
 
 ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d
 
--- a/src/coding.c	Sun Dec 11 22:42:40 2005 +0000
+++ b/src/coding.c	Mon Dec 12 02:37:01 2005 +0000
@@ -7411,7 +7411,9 @@
 
 DEFUN ("keyboard-coding-system", Fkeyboard_coding_system,
        Skeyboard_coding_system, 0, 1, 0,
-       doc: /* Return coding system specified for decoding keyboard input.  */)
+       doc: /* Return coding system for decoding keyboard input on DEVICE.
+DEVICE may be a display device id, a frame, or nil for the selected
+frame's display device.  */)
      (device)
      Lisp_Object device;
 {
--- a/src/keyboard.c	Sun Dec 11 22:42:40 2005 +0000
+++ b/src/keyboard.c	Mon Dec 12 02:37:01 2005 +0000
@@ -2662,6 +2662,7 @@
 
   if (_setjmp (local_getcjmp))
     {
+      /* Handle quits while reading the keyboard.  */
       /* We must have saved the outer value of getcjmp here,
 	 so restore it now.  */
       restore_getcjmp (save_jump);
@@ -3690,12 +3691,10 @@
       if (c == quit_char)
 	{
 #ifdef MULTI_KBOARD
-	  KBOARD *kb;
+	  KBOARD *kb = FRAME_KBOARD (XFRAME (event->frame_or_window));
 	  struct input_event *sp;
 
-	  if (single_kboard
-	      && (kb = FRAME_KBOARD (XFRAME (event->frame_or_window)),
-		  kb != current_kboard))
+	  if (single_kboard && kb != current_kboard)
 	    {
 	      kb->kbd_queue
 		= Fcons (make_lispy_switch_frame (event->frame_or_window),
@@ -8742,12 +8741,7 @@
   last_nonmenu_event = Qnil;
 
   delayed_switch_frame = Qnil;
-  fkey.map = fkey.parent = current_kboard->Vlocal_function_key_map;
-  keytran.map = keytran.parent = current_kboard->Vlocal_key_translation_map;
-  /* If there is no translation-map, turn off scanning.  */
-  fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1;
-  keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1;
-
+  
   if (INTERACTIVE)
     {
       if (!NILP (prompt))
@@ -8787,6 +8781,14 @@
      keybuf[0..mock_input] holds the sequence we should reread.  */
  replay_sequence:
 
+  /* We may switch keyboards between rescans, so we need to
+     reinitialize fkey and keytran before each replay.  */
+  fkey.map = fkey.parent = current_kboard->Vlocal_function_key_map;
+  keytran.map = keytran.parent = current_kboard->Vlocal_key_translation_map;
+  /* If there is no translation map, turn off scanning.  */
+  fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1;
+  keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1;
+
   starting_buffer = current_buffer;
   first_unbound = bufsize + 1;