changeset 83363:3d2bc61f2da0

Fix function-key-map massaging vs `C-x 5 2' in lisp/term/*.el. (Submitted by Dan Nicolaescu.) * term/lk201.el (terminal-init-lk201): * term/iris-ansi.el (terminal-init-iris-ansi): * term/rxvt.el (terminal-init-rxvt): Protect function-key-map against multiple invocations from the same terminal. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-403
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 09 Sep 2005 19:04:34 +0000
parents c3dd82172ed1
children 46dfd959d88a
files README.multi-tty lisp/term/iris-ansi.el lisp/term/lk201.el lisp/term/rxvt.el
diffstat 4 files changed, 68 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/README.multi-tty	Wed Sep 07 23:28:54 2005 +0000
+++ b/README.multi-tty	Fri Sep 09 19:04:34 2005 +0000
@@ -386,19 +386,6 @@
 THINGS TO DO
 ------------
 
-** Go through lisp/term/*.el once more and protect terminal-local
-   initializations with '(when (eq 1 (length (frames-on-display-list)))'
-   as in xterm.el.  This is to prevent resource allocation explosions
-   when C-x 5 2 is used repeatedly.
-
-** Dan Nicolaescu writes:
-   > The terminal initialization code still has some issues. 
-   > This can be seen when using emacsclient -t on a 256 color xterm. The
-   > terminal frame is only created with 8 color. 
-   > The reason is that terminal-init-xterm calls
-   > xterm-register-default-colors which calls (display-color-cells (selected-frame))
-   > and probably `selected-frame' is not completely setup at that time. 
-
 ** emacsclient --no-wait and --eval is currently broken.
 
 ** xt-mouse.el needs to be adapted for multi-tty.  It currently
--- a/lisp/term/iris-ansi.el	Wed Sep 07 23:28:54 2005 +0000
+++ b/lisp/term/iris-ansi.el	Fri Sep 09 19:04:34 2005 +0000
@@ -331,12 +331,15 @@
 
 (defun terminal-init-iris-ansi ()
   "Terminal initialization function for iris-ansi."
-  ;; Use inheritance to let the main keymap override these defaults.
-  ;; This way we don't override terminfo-derived settings or settings
-  ;; made in the .emacs file.
-  (let ((m (copy-keymap iris-function-map)))
-    (set-keymap-parent m (keymap-parent (terminal-local-value 'local-function-key-map nil)))
-    (set-keymap-parent (terminal-local-value 'local-function-key-map nil) m)))
+  ;; The terminal-local stuff only need to be set up on the first
+  ;; frame on that device.
+  (when (eq 1 (length (frames-on-display-list)))
+    ;; Use inheritance to let the main keymap override these defaults.
+    ;; This way we don't override terminfo-derived settings or settings
+    ;; made in the .emacs file.
+    (let ((m (copy-keymap iris-function-map)))
+      (set-keymap-parent m (keymap-parent (terminal-local-value 'local-function-key-map nil)))
+      (set-keymap-parent (terminal-local-value 'local-function-key-map nil) m))))
 
 ;;; arch-tag: b1d0e73a-bb7d-47be-9fb2-6fb126469a1b
 ;;; iris-ansi.el ends here
--- a/lisp/term/lk201.el	Wed Sep 07 23:28:54 2005 +0000
+++ b/lisp/term/lk201.el	Fri Sep 09 19:04:34 2005 +0000
@@ -76,12 +76,16 @@
   (define-key lk201-function-map "\eOy" [kp-9]))
 
 (defun terminal-init-lk201 ()
-  ;; Use inheritance to let the main keymap override these defaults.
-  ;; This way we don't override terminfo-derived settings or settings
-  ;; made in the .emacs file.
-  (let ((m (copy-keymap lk201-function-map)))
-    (set-keymap-parent m (keymap-parent (terminal-local-value 'local-function-key-map nil)))
-    (set-keymap-parent (terminal-local-value 'local-function-key-map nil) m)))
+  ;; The terminal-local stuff only need to be set up on the first
+  ;; frame on that device.
+  (when (eq 1 (length (frames-on-display-list)))
+
+    ;; Use inheritance to let the main keymap override these defaults.
+    ;; This way we don't override terminfo-derived settings or settings
+    ;; made in the .emacs file.
+    (let ((m (copy-keymap lk201-function-map)))
+      (set-keymap-parent m (keymap-parent (terminal-local-value 'local-function-key-map nil)))
+      (set-keymap-parent (terminal-local-value 'local-function-key-map nil) m))))
 
 ;;; arch-tag: 7ffb4444-6a23-43e1-b457-43cf4f673c0d
 ;;; lk201.el ends here
--- a/lisp/term/rxvt.el	Wed Sep 07 23:28:54 2005 +0000
+++ b/lisp/term/rxvt.el	Fri Sep 09 19:04:34 2005 +0000
@@ -119,53 +119,58 @@
 
 (defun terminal-init-rxvt ()
   "Terminal initialization function for rxvt."
-  ;; The terminal intialization C code file might have initialized
-  ;; function keys F11->F42 from the termcap/terminfo information.  On
-  ;; a PC-style keyboard these keys correspond to
-  ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C-, C-S-.  The
-  ;; code here subsitutes the corresponding defintions in
-  ;; function-key-map. This substitution is needed because if a key
-  ;; definition if found in function-key-map, there are no further
-  ;; lookups in other keymaps.
-  (substitute-key-definition [f11] [S-f1] function-key-map)
-  (substitute-key-definition [f12] [S-f2] function-key-map)
-  (substitute-key-definition [f13] [S-f3] function-key-map)
-  (substitute-key-definition [f14] [S-f4] function-key-map)
-  (substitute-key-definition [f15] [S-f5] function-key-map)
-  (substitute-key-definition [f16] [S-f6] function-key-map)
-  (substitute-key-definition [f17] [S-f7] function-key-map)
-  (substitute-key-definition [f18] [S-f8] function-key-map)
-  (substitute-key-definition [f19] [S-f9] function-key-map)
-  (substitute-key-definition [f20] [S-f10] function-key-map)
 
-  (substitute-key-definition [f23] [C-f1] function-key-map)
-  (substitute-key-definition [f24] [C-f2] function-key-map)
-  (substitute-key-definition [f25] [C-f3] function-key-map)
-  (substitute-key-definition [f26] [C-f4] function-key-map)
-  (substitute-key-definition [f27] [C-f5] function-key-map)
-  (substitute-key-definition [f28] [C-f6] function-key-map)
-  (substitute-key-definition [f29] [C-f7] function-key-map)
-  (substitute-key-definition [f30] [C-f8] function-key-map)
-  (substitute-key-definition [f31] [C-f9] function-key-map)
-  (substitute-key-definition [f32] [C-f10] function-key-map)
+  ;; The terminal-local stuff only need to be set up on the first
+  ;; frame on that device.
+  (when (eq 1 (length (frames-on-display-list)))
+    ;; The terminal intialization C code file might have initialized
+    ;; function keys F11->F42 from the termcap/terminfo information.  On
+    ;; a PC-style keyboard these keys correspond to
+    ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C-, C-S-.  The
+    ;; code here subsitutes the corresponding defintions in
+    ;; function-key-map. This substitution is needed because if a key
+    ;; definition if found in function-key-map, there are no further
+    ;; lookups in other keymaps.
+    (let ((m (terminal-local-value 'local-function-key-map nil)))
+      (substitute-key-definition [f11] [S-f1] m)
+      (substitute-key-definition [f12] [S-f2] m)
+      (substitute-key-definition [f13] [S-f3] m)
+      (substitute-key-definition [f14] [S-f4] m)
+      (substitute-key-definition [f15] [S-f5] m)
+      (substitute-key-definition [f16] [S-f6] m)
+      (substitute-key-definition [f17] [S-f7] m)
+      (substitute-key-definition [f18] [S-f8] m)
+      (substitute-key-definition [f19] [S-f9] m)
+      (substitute-key-definition [f20] [S-f10] m)
+      
+      (substitute-key-definition [f23] [C-f1] m)
+      (substitute-key-definition [f24] [C-f2] m)
+      (substitute-key-definition [f25] [C-f3] m)
+      (substitute-key-definition [f26] [C-f4] m)
+      (substitute-key-definition [f27] [C-f5] m)
+      (substitute-key-definition [f28] [C-f6] m)
+      (substitute-key-definition [f29] [C-f7] m)
+      (substitute-key-definition [f30] [C-f8] m)
+      (substitute-key-definition [f31] [C-f9] m)
+      (substitute-key-definition [f32] [C-f10] m)
 
-  (substitute-key-definition [f33] [C-S-f1] function-key-map)
-  (substitute-key-definition [f34] [C-S-f2] function-key-map)
-  (substitute-key-definition [f35] [C-S-f3] function-key-map)
-  (substitute-key-definition [f36] [C-S-f4] function-key-map)
-  (substitute-key-definition [f37] [C-S-f5] function-key-map)
-  (substitute-key-definition [f38] [C-S-f6] function-key-map)
-  (substitute-key-definition [f39] [C-S-f7] function-key-map)
-  (substitute-key-definition [f40] [C-S-f8] function-key-map)
-  (substitute-key-definition [f41] [C-S-f9] function-key-map)
-  (substitute-key-definition [f42] [C-S-f10] function-key-map)
+      (substitute-key-definition [f33] [C-S-f1] m)
+      (substitute-key-definition [f34] [C-S-f2] m)
+      (substitute-key-definition [f35] [C-S-f3] m)
+      (substitute-key-definition [f36] [C-S-f4] m)
+      (substitute-key-definition [f37] [C-S-f5] m)
+      (substitute-key-definition [f38] [C-S-f6] m)
+      (substitute-key-definition [f39] [C-S-f7] m)
+      (substitute-key-definition [f40] [C-S-f8] m)
+      (substitute-key-definition [f41] [C-S-f9] m)
+      (substitute-key-definition [f42] [C-S-f10] m))
 
-  ;; Use inheritance to let the main keymap override those defaults.
-  ;; This way we don't override terminfo-derived settings or settings
-  ;; made in the .emacs file.
-  (let ((m (copy-keymap rxvt-function-map)))
-    (set-keymap-parent m (keymap-parent (terminal-local-value 'local-function-key-map nil)))
-    (set-keymap-parent (terminal-local-value 'local-function-key-map nil) m))
+    ;; Use inheritance to let the main keymap override those defaults.
+    ;; This way we don't override terminfo-derived settings or settings
+    ;; made in the .emacs file.
+    (let ((m (copy-keymap rxvt-function-map)))
+      (set-keymap-parent m (keymap-parent (terminal-local-value 'local-function-key-map nil)))
+      (set-keymap-parent (terminal-local-value 'local-function-key-map nil) m)))
 
   ;; Initialize colors and background mode.
   (rxvt-register-default-colors)