Fix "first non-ASCII character on new tty frames" problem.
authorKaroly Lorentey <lorentey@elte.hu>
Mon, 12 Dec 2005 02:37:01 +0000 (02:37 +0000)
committerKaroly Lorentey <lorentey@elte.hu>
Mon, 12 Dec 2005 02:37:01 +0000 (02:37 +0000)
* 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

README.multi-tty
src/coding.c
src/keyboard.c

index ab43fc7..3f873fa 100644 (file)
@@ -31,9 +31,11 @@ The following is a (sadly incomplete) list of people who have
 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 @@ If you run Debian, or a distribution based on Debian, you are welcome
 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 @@ The multi-tty branch is compiled the same way as Emacs itself:
 
        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 @@ THINGS TO DO
 ** 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 @@ THINGS TO DO
 ** 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 @@ THINGS TO DO
    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 @@ DIARY OF CHANGES
    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 @@ DIARY OF CHANGES
    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
 
index 5658a8a..d032f8c 100644 (file)
@@ -7411,7 +7411,9 @@ DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_intern
 
 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;
 {
index 51b5943..4bc4262 100644 (file)
@@ -2662,6 +2662,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
 
   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 @@ kbd_buffer_store_event_hold (event, hold_quit)
       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 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
   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 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
      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;