Fix semantics of terminal-local variables. Remove `terminal-local-value' hack.
authorKaroly Lorentey <lorentey@elte.hu>
Sat, 29 Oct 2005 11:50:12 +0000 (11:50 +0000)
committerKaroly Lorentey <lorentey@elte.hu>
Sat, 29 Oct 2005 11:50:12 +0000 (11:50 +0000)
* src/data.c (do_symval_forwarding, store_symval_forwarding)
  (find_symbol_value): Use the selected frame's keyboard, not
  current_kboard.

* src/data.c (Fterminal_local_value, Fset_terminal_local_value): Disable
  these functions.

* src/data.c (syms_of_data): Don't defsubr them.
* lisp/edmacro.el (edmacro-format-keys): Remove terminal-local-value calls.
* lisp/emulation/cua-base.el (cua--pre-command-handler-1): Ditto.
* lisp/international/encoded-kb.el (encoded-kbd-setup-display): Ditto.
* lisp/isearch.el (isearch-other-meta-char): Ditto.
* lisp/obsolete/keyswap.el (the-table): Ditto.
* lisp/simple.el (normal-erase-is-backspace-mode): Ditto.
* lisp/subr.el (keyboard-translate, read-quoted-char): Ditto.
* lisp/term/AT386.el (terminal-init-AT386): Ditto.
* lisp/term/internal.el: Ditto.
* lisp/term/iris-ansi.el (terminal-init-iris-ansi): Ditto.
* lisp/term/lk201.el (terminal-init-lk201): Ditto.
* lisp/term/mac-win.el: Ditto.
* lisp/term/news.el (terminal-init-news): Ditto.
* lisp/term/rxvt.el (terminal-init-rxvt): Ditto.
* lisp/term/sun.el (terminal-init-sun): Ditto.
* lisp/term/tvi970.el (terminal-init-tvi970): Ditto.
* lisp/term/vt200.el (terminal-init-vt200): Ditto.
* lisp/term/vt201.el (terminal-init-vt201): Ditto.
* lisp/term/vt220.el (terminal-init-vt220): Ditto.
* lisp/term/vt240.el (terminal-init-vt240): Ditto.
* lisp/term/vt300.el (terminal-init-vt300): Ditto.
* lisp/term/vt320.el (terminal-init-vt320): Ditto.
* lisp/term/vt400.el (terminal-init-vt400): Ditto.
* lisp/term/vt420.el (terminal-init-vt420): Ditto.
* lisp/term/wyse50.el (terminal-init-wyse50): Ditto.
* lisp/term/x-win.el (x-setup-function-keys): Ditto.
* lisp/term/xterm.el (terminal-init-xterm): Ditto.

git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-434

28 files changed:
lisp/edmacro.el
lisp/emulation/cua-base.el
lisp/international/encoded-kb.el
lisp/isearch.el
lisp/obsolete/keyswap.el
lisp/simple.el
lisp/subr.el
lisp/term/AT386.el
lisp/term/internal.el
lisp/term/iris-ansi.el
lisp/term/lk201.el
lisp/term/mac-win.el
lisp/term/news.el
lisp/term/rxvt.el
lisp/term/sun.el
lisp/term/tvi970.el
lisp/term/vt200.el
lisp/term/vt201.el
lisp/term/vt220.el
lisp/term/vt240.el
lisp/term/vt300.el
lisp/term/vt320.el
lisp/term/vt400.el
lisp/term/vt420.el
lisp/term/wyse50.el
lisp/term/x-win.el
lisp/term/xterm.el
src/data.c

index ff5e2f7..68de440 100644 (file)
@@ -444,8 +444,7 @@ doubt, use whitespace."
         (rest-mac (vconcat macro [end-macro]))
         (res "")
         (len 0)
-        (one-line (eq verbose 1))
-        (fkm (terminal-local-value 'local-function-key-map nil)))
+        (one-line (eq verbose 1)))
     (if one-line (setq verbose nil))
     (when (stringp macro)
       (loop for i below (length macro) do
@@ -490,9 +489,9 @@ doubt, use whitespace."
             (fkey nil) tlen tkey
             (bind (or (loop for map in maps for b = (lookup-key map key)
                             thereis (and (not (integerp b)) b))
-                      (and (setq fkey (lookup-key fkm rest-mac))
+                      (and (setq fkey (lookup-key local-function-key-map rest-mac))
                            (setq tlen fkey tkey (edmacro-subseq rest-mac 0 tlen)
-                                 fkey (lookup-key fkm tkey))
+                                 fkey (lookup-key local-function-key-map tkey))
                            (loop for map in maps
                                  for b = (lookup-key map fkey)
                                  when (and (not (integerp b)) b)
index a7f5b4d..bcfdeef 100644 (file)
@@ -1090,8 +1090,8 @@ If ARG is the atom `-', scroll upward by nearly full screen."
                           (aref (this-single-command-keys) 0)))
             ;; See if raw escape sequence maps to a shifted event, e.g. S-up or C-S-home.
             (and (boundp 'local-function-key-map)
-                 (terminal-local-value 'function-key-map nil)
-                 (let ((ev (lookup-key (terminal-local-value 'function-key-map nil)
+                 local-function-key-map
+                 (let ((ev (lookup-key local-function-key-map
                                        (this-single-command-raw-keys))))
                    (and (vector ev)
                         (symbolp (setq ev (aref ev 0)))
index 9220970..25e8f47 100644 (file)
@@ -260,9 +260,9 @@ DISPLAY may be a display id, a frame, or nil for the selected frame's display."
     (when frame
       (with-selected-frame frame
        ;; Remove any previous encoded-kb keymap from key-translation-map.
-       (let ((m (terminal-local-value 'local-key-translation-map frame)))
+       (let ((m local-key-translation-map))
          (if (equal (keymap-prompt m) "encoded-kb")
-             (set-terminal-local-value 'local-key-translation-map frame (keymap-parent m))
+             (setq local-key-translation-map (keymap-parent m))
            (while (keymap-parent m)
              (if (equal (keymap-prompt (keymap-parent m)) "encoded-kb")
                  (set-keymap-parent m (keymap-parent (keymap-parent m))))
@@ -274,8 +274,8 @@ DISPLAY may be a display id, a frame, or nil for the selected frame's display."
                  (keymap (make-sparse-keymap "encoded-kb"))
                  (cim (current-input-mode))
                  result)
-             (set-keymap-parent keymap (terminal-local-value 'local-key-translation-map frame))
-             (set-terminal-local-value 'local-key-translation-map frame keymap)
+             (set-keymap-parent keymap local-key-translation-map)
+             (setq local-key-translation-map keymap)
              (unless (terminal-parameter nil 'encoded-kbd-saved-input-mode)
                (set-terminal-parameter nil 'encoded-kbd-saved-input-mode cim))
              (setq result (and coding (encoded-kbd-setup-keymap keymap coding)))
@@ -287,7 +287,7 @@ DISPLAY may be a display id, a frame, or nil for the selected frame's display."
                     (nth 1 cim)
                     'use-8th-bit
                     (nth 3 cim)))
-               (set-terminal-local-value nil 'encoded-kbd-saved-input-mode nil)
+               (set-terminal-parameter nil 'encoded-kbd-saved-input-mode nil)
                (error "Unsupported coding system in Encoded-kbd mode: %S"
                       coding)))
          ;; We are turning off Encoded-kbd mode.
index 2cdd810..9d52ea1 100644 (file)
@@ -1649,10 +1649,9 @@ Isearch mode."
                 (this-command-keys)))
         (main-event (aref key 0))
         (keylist (listify-key-sequence key))
-        (fkm (terminal-local-value 'local-function-key-map nil))
          scroll-command isearch-point)
     (cond ((and (= (length key) 1)
-               (let ((lookup (lookup-key fkm key)))
+               (let ((lookup (lookup-key local-function-key-map key)))
                  (not (or (null lookup) (integerp lookup)
                           (keymapp lookup)))))
           ;; Handle a function key that translates into something else.
@@ -1666,7 +1665,7 @@ Isearch mode."
                 (isearch-done)
                 (apply 'isearch-unread keylist))
             (setq keylist
-                  (listify-key-sequence (lookup-key fkm key)))
+                  (listify-key-sequence (lookup-key local-function-key-map key)))
             (while keylist
               (setq key (car keylist))
               ;; If KEY is a printing char, we handle it here
index 9651e4d..0ed70d6 100644 (file)
@@ -36,7 +36,7 @@
   ;; Swap ^H and DEL
   (aset the-table ?\177 ?\^h)
   (aset the-table ?\^h ?\177)
-  (setq (terminal-local-value 'keyboard-translate-table) the-table))
+  (setq keyboard-translate-table the-table))
 
 ;;; arch-tag: 67cf7009-e23e-421c-9648-078e7277297c
 ;;; keyswap.el ends here
index 3a8a737..8e481fb 100644 (file)
@@ -5337,26 +5337,25 @@ See also `normal-erase-is-backspace'."
 
   (cond ((or (memq window-system '(x w32 mac pc))
             (memq system-type '(ms-dos windows-nt)))
-        (let* ((lfkm (terminal-local-value 'local-function-key-map nil))
-               (bindings
+        (let* ((bindings
                 `(([C-delete] [C-backspace])
                   ([M-delete] [M-backspace])
                   ([C-M-delete] [C-M-backspace])
                   (,esc-map
                    [C-delete] [C-backspace])))
-               (old-state (lookup-key lfkm [delete])))
+               (old-state (lookup-key local-function-key-map [delete])))
 
           (if (terminal-parameter nil 'normal-erase-is-backspace)
               (progn
-                (define-key lfkm [delete] [?\C-d])
-                (define-key lfkm [kp-delete] [?\C-d])
-                (define-key lfkm [backspace] [?\C-?]))
-            (define-key lfkm [delete] [?\C-?])
-            (define-key lfkm [kp-delete] [?\C-?])
-            (define-key lfkm [backspace] [?\C-?]))
+                (define-key local-function-key-map [delete] [?\C-d])
+                (define-key local-function-key-map [kp-delete] [?\C-d])
+                (define-key local-function-key-map [backspace] [?\C-?]))
+            (define-key local-function-key-map [delete] [?\C-?])
+            (define-key local-function-key-map [kp-delete] [?\C-?])
+            (define-key local-function-key-map [backspace] [?\C-?]))
 
           ;; Maybe swap bindings of C-delete and C-backspace, etc.
-          (unless (equal old-state (lookup-key lfkm [delete]))
+          (unless (equal old-state (lookup-key local-function-key-map [delete]))
             (dolist (binding bindings)
               (let ((map global-map))
                 (when (keymapp (car binding))
index a141794..5bc2c3d 100644 (file)
@@ -495,10 +495,9 @@ saving keyboard macros (see `edmacro-mode')."
   "Translate character FROM to TO at a low level.
 This function creates a `keyboard-translate-table' if necessary
 and then modifies one entry in it."
-  (let (tbl (terminal-local-value 'keyboard-translate-table))
-    (or (char-table-p tbl)
-       (setq tbl (make-char-table 'keyboard-translate-table nil)))
-    (aset tbl from to)))
+  (or (char-table-p keyboard-translate-table)
+      (setq keyboard-translate-table (make-char-table 'keyboard-translate-table nil)))
+    (aset keyboard-translate-table from to))
 
 \f
 ;;;; The global keymap tree.
@@ -1170,8 +1169,7 @@ any other non-digit terminates the character code and is then used as input."))
       ;; or C-q C-x might not return immediately since ESC or C-x might be
       ;; bound to some prefix in function-key-map or key-translation-map.
       (setq translated char)
-      (let ((translation (lookup-key (terminal-local-value 'local-function-key-map nil)
-                                    (vector char))))
+      (let ((translation (lookup-key local-function-key-map (vector char))))
        (if (arrayp translation)
            (setq translated (aref translation 0))))
       (cond ((null translated))
index 7e3ed15..fda2da4 100644 (file)
@@ -33,7 +33,7 @@
   (if (boundp 'AT386-keypad-map)
       nil
     ;; The terminal initialization should already have set up some keys
-    (setq AT386-keypad-map (lookup-key (terminal-local-value 'local-function-key-map nil) "\e["))
+    (setq AT386-keypad-map (lookup-key local-function-key-map "\e["))
     (if (not (keymapp AT386-keypad-map))
        (error "What?  Your AT386 termcap/terminfo has no keycaps in it"))
 
@@ -56,7 +56,7 @@
     (define-key AT386-keypad-map "T" [kp-add])
 
     ;; Arrange for the ALT key to be equivalent to ESC
-    (define-key (terminal-local-value 'local-function-key-map nil) "\eN" [27]) ; ALT map
+    (define-key local-function-key-map "\eN" [27]) ; ALT map
     ))
 
 ;;; arch-tag: abec1b03-582f-49f8-b8cb-e2fd52ea4bd7
index bbc19bb..e9de649 100644 (file)
 ;; ---------------------------------------------------------------------------
 ;; keyboard setup -- that's simple!
 (set-input-mode nil nil 0)
-(let (m (terminal-local-value 'local-function-key-map nil))
-  (define-key m [backspace] "\177") ; Normal behaviour for BS
-  (define-key m [delete] "\C-d")    ; ... and Delete
-  (define-key m [tab] [?\t])
-  (define-key m [linefeed] [?\n])
-  (define-key m [clear] [11])
-  (define-key m [return] [13])
-  (define-key m [escape] [?\e])
-  (define-key m [M-backspace] [?\M-\d])
-  (define-key m [M-delete] [?\M-d])
-  (define-key m [M-tab] [?\M-\t])
-  (define-key m [M-linefeed] [?\M-\n])
-  (define-key m [M-clear] [?\M-\013])
-  (define-key m [M-return] [?\M-\015])
-  (define-key m [M-escape] [?\M-\e]))
+(define-key local-function-key-map [backspace] "\177") ; Normal behaviour for BS
+(define-key local-function-key-map [delete] "\C-d") ; ... and Delete
+(define-key local-function-key-map [tab] [?\t])
+(define-key local-function-key-map [linefeed] [?\n])
+(define-key local-function-key-map [clear] [11])
+(define-key local-function-key-map [return] [13])
+(define-key local-function-key-map [escape] [?\e])
+(define-key local-function-key-map [M-backspace] [?\M-\d])
+(define-key local-function-key-map [M-delete] [?\M-d])
+(define-key local-function-key-map [M-tab] [?\M-\t])
+(define-key local-function-key-map [M-linefeed] [?\M-\n])
+(define-key local-function-key-map [M-clear] [?\M-\013])
+(define-key local-function-key-map [M-return] [?\M-\015])
+(define-key local-function-key-map [M-escape] [?\M-\e]))
 (put 'backspace 'ascii-character 127)
 (put 'delete 'ascii-character 127)
 (put 'tab 'ascii-character ?\t)
index d751ca6..1a3a65f 100644 (file)
     ;; 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))))
+      (set-keymap-parent m (keymap-parent local-function-key-map))
+      (set-keymap-parent local-function-key-map m))))
 
 ;;; arch-tag: b1d0e73a-bb7d-47be-9fb2-6fb126469a1b
 ;;; iris-ansi.el ends here
index 4eb84b6..45271bc 100644 (file)
@@ -84,8 +84,8 @@
     ;; 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))))
+      (set-keymap-parent m (keymap-parent local-function-key-map))
+      (set-keymap-parent local-function-key-map m))))
 
 ;;; arch-tag: 7ffb4444-6a23-43e1-b457-43cf4f673c0d
 ;;; lk201.el ends here
index f778243..7912bb1 100644 (file)
@@ -1060,21 +1060,20 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
 
 ;; Map certain keypad keys into ASCII characters
 ;; that people usually expect.
-(let ((m (terminal-local-value 'local-function-key-map nil)))
-  (define-key m [backspace] [?\d])
-  (define-key m [delete] [?\d])
-  (define-key m [tab] [?\t])
-  (define-key m [linefeed] [?\n])
-  (define-key m [clear] [?\C-l])
-  (define-key m [return] [?\C-m])
-  (define-key m [escape] [?\e])
-  (define-key m [M-backspace] [?\M-\d])
-  (define-key m [M-delete] [?\M-\d])
-  (define-key m [M-tab] [?\M-\t])
-  (define-key m [M-linefeed] [?\M-\n])
-  (define-key m [M-clear] [?\M-\C-l])
-  (define-key m [M-return] [?\M-\C-m])
-  (define-key m [M-escape] [?\M-\e]))
+(define-key local-function-key-map [backspace] [?\d])
+(define-key local-function-key-map [delete] [?\d])
+(define-key local-function-key-map [tab] [?\t])
+(define-key local-function-key-map [linefeed] [?\n])
+(define-key local-function-key-map [clear] [?\C-l])
+(define-key local-function-key-map [return] [?\C-m])
+(define-key local-function-key-map [escape] [?\e])
+(define-key local-function-key-map [M-backspace] [?\M-\d])
+(define-key local-function-key-map [M-delete] [?\M-\d])
+(define-key local-function-key-map [M-tab] [?\M-\t])
+(define-key local-function-key-map [M-linefeed] [?\M-\n])
+(define-key local-function-key-map [M-clear] [?\M-\C-l])
+(define-key local-function-key-map [M-return] [?\M-\C-m])
+(define-key local-function-key-map [M-escape] [?\M-\e])
 
 ;; These tell read-char how to convert
 ;; these special chars to ASCII.
index 2a62a85..ab2d101 100644 (file)
@@ -34,7 +34,7 @@
   (if (boundp 'news-fkey-prefix)
       nil
     ;; The terminal initialization should already have set up some keys
-    (setq news-fkey-prefix (lookup-key (terminal-local-value 'local-function-key-map nil) "\eO"))
+    (setq news-fkey-prefix (lookup-key local-function-key-map "\eO"))
     (if (not (keymapp news-fkey-prefix))
        (error "What?  Your news termcap/terminfo has no keycaps in it"))
 
index 2c629fb..cb3d019 100644 (file)
     ;; 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 [f11] [S-f1] local-function-key-map)
+    (substitute-key-definition [f12] [S-f2] local-function-key-map)
+    (substitute-key-definition [f13] [S-f3] local-function-key-map)
+    (substitute-key-definition [f14] [S-f4] local-function-key-map)
+    (substitute-key-definition [f15] [S-f5] local-function-key-map)
+    (substitute-key-definition [f16] [S-f6] local-function-key-map)
+    (substitute-key-definition [f17] [S-f7] local-function-key-map)
+    (substitute-key-definition [f18] [S-f8] local-function-key-map)
+    (substitute-key-definition [f19] [S-f9] local-function-key-map)
+    (substitute-key-definition [f20] [S-f10] local-function-key-map)
 
-      (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 [f23] [C-f1] local-function-key-map)
+    (substitute-key-definition [f24] [C-f2] local-function-key-map)
+    (substitute-key-definition [f25] [C-f3] local-function-key-map)
+    (substitute-key-definition [f26] [C-f4] local-function-key-map)
+    (substitute-key-definition [f27] [C-f5] local-function-key-map)
+    (substitute-key-definition [f28] [C-f6] local-function-key-map)
+    (substitute-key-definition [f29] [C-f7] local-function-key-map)
+    (substitute-key-definition [f30] [C-f8] local-function-key-map)
+    (substitute-key-definition [f31] [C-f9] local-function-key-map)
+    (substitute-key-definition [f32] [C-f10] local-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))
+    (substitute-key-definition [f33] [C-S-f1] local-function-key-map)
+    (substitute-key-definition [f34] [C-S-f2] local-function-key-map)
+    (substitute-key-definition [f35] [C-S-f3] local-function-key-map)
+    (substitute-key-definition [f36] [C-S-f4] local-function-key-map)
+    (substitute-key-definition [f37] [C-S-f5] local-function-key-map)
+    (substitute-key-definition [f38] [C-S-f6] local-function-key-map)
+    (substitute-key-definition [f39] [C-S-f7] local-function-key-map)
+    (substitute-key-definition [f40] [C-S-f8] local-function-key-map)
+    (substitute-key-definition [f41] [C-S-f9] local-function-key-map)
+    (substitute-key-definition [f42] [C-S-f10] local-function-key-map)
 
     ;; 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)))
+      (set-keymap-parent m (keymap-parent local-function-key-map))
+      (set-keymap-parent local-function-key-map m)))
 
   ;; Initialize colors and background mode.
   (rxvt-register-default-colors)
index 38134d2..99e3ec2 100644 (file)
 
 (defun terminal-init-sun ()
   "Terminal initialization function for sun."
-  (define-key (terminal-local-value 'local-function-key-map nil) "\e[" sun-raw-prefix)
+  (define-key local-function-key-map "\e[" sun-raw-prefix)
 
   (define-key sun-raw-prefix "210z" [r3])
   (define-key sun-raw-prefix "213z" [r6])
index 8d8ef51..647e4cc 100644 (file)
 
 (defun terminal-init-tvi970 ()
   "Terminal initialization function for tvi970."
-  (or (lookup-key (terminal-local-value 'local-function-key-map nil) "\e[")
-      (define-key (terminal-local-value 'local-function-key-map nil) "\e[" (make-keymap)))
-  ;; (or (lookup-key (terminal-local-value 'local-function-key-map nil) "\eO")
-  ;;    (define-key (terminal-local-value 'local-function-key-map nil) "\eO" (make-keymap)))
+  (or (lookup-key local-function-key-map "\e[")
+      (define-key local-function-key-map "\e[" (make-keymap)))
+  ;; (or (lookup-key local-function-key-map "\eO")
+  ;;    (define-key local-function-key-map "\eO" (make-keymap)))
 
   ;; Miscellaneous keys
   (mapcar (function (lambda (key-binding)
-                     (define-key (terminal-local-value 'local-function-key-map nil)
+                     (define-key local-function-key-map
                        (car key-binding) (nth 1 key-binding))))
          '(
            ;; These are set up by termcap or terminfo
   ;; The numeric keypad keys.
   (let ((i 0))
     (while (< i 10)
-      (define-key (terminal-local-value 'local-function-key-map nil)
+      (define-key local-function-key-map
        (format "\eO%c" (+ i ?p))
        (vector (intern (format "kp-%d" i))))
       (setq i (1+ i))))
   ;; The numbered function keys.
   (let ((i 0))
     (while (< i 16)
-      (define-key (terminal-local-value 'local-function-key-map nil)
+      (define-key local-function-key-map
        (format "\e?%c" (+ i ?a))
        (vector (intern (format "f%d" (1+ i)))))
-      (define-key (terminal-local-value 'local-function-key-map nil)
+      (define-key local-function-key-map
        (format "\e?%c" (+ i ?A))
        (vector (intern (format "S-f%d" (1+ i)))))
       (setq i (1+ i))))
index 1d62e34..fd31fd1 100644 (file)
@@ -5,7 +5,7 @@
   "Terminal initialization function for vt200."
   (terminal-init-vt100)
   ;; Make F11 an escape key.
-  (define-key (terminal-local-value 'local-function-key-map nil) "\e[23~" [?\e]))
+  (define-key local-function-key-map "\e[23~" [?\e]))
 
 ;;; arch-tag: 0f78f583-9f32-4237-b106-28bcfff21d89
 ;;; vt200.el ends here
index c98b98b..9524332 100644 (file)
@@ -5,7 +5,7 @@
   "Terminal initialization function for vt201."
   (terminal-init-vt100)
   ;; Make F11 an escape key.
-  (define-key (terminal-local-value 'local-function-key-map nil) "\e[23~" [?\e]))
+  (define-key local-function-key-map "\e[23~" [?\e]))
 
 ;;; arch-tag: a6abb38f-60ea-449e-a9e9-3fb8572c52ae
 ;;; vt201.el ends here
index a2a3746..7264b7d 100644 (file)
@@ -5,7 +5,7 @@
   "Terminal initialization function for vt220."
   (terminal-init-vt100)
   ;; Make F11 an escape key.
-  (define-key (terminal-local-value 'local-function-key-map nil) "\e[23~" [?\e]))
+  (define-key local-function-key-map "\e[23~" [?\e]))
 
 ;;; arch-tag: 98fc4867-a20d-46a1-a276-d7be31e49871
 ;;; vt220.el ends here
index 808cc07..725e323 100644 (file)
@@ -5,7 +5,7 @@
   "Terminal initialization function for vt240."
   (terminal-init-vt100)
   ;; Make F11 an escape key.
-  (define-key (terminal-local-value 'local-function-key-map nil) "\e[23~" [?\e]))
+  (define-key local-function-key-map "\e[23~" [?\e]))
 
 ;;; arch-tag: d9f88e9c-02dc-49ff-871c-a415f08e4eb7
 ;;; vt240.el ends here
index 593daf5..fb74927 100644 (file)
@@ -3,7 +3,7 @@
   "Terminal initialization function for vt300."
   (terminal-init-vt100)
   ;; Make F11 an escape key.
-  (define-key (terminal-local-value 'local-function-key-map nil) "\e[23~" [?\e]))
+  (define-key local-function-key-map "\e[23~" [?\e]))
 
 ;;; arch-tag: 876831c9-a6f2-444a-b033-706e6fbc149f
 ;;; vt300.el ends here
index a4d2186..3e52d27 100644 (file)
@@ -3,7 +3,7 @@
   "Terminal initialization function for vt320."
   (terminal-init-vt100)
   ;; Make F11 an escape key.
-  (define-key (terminal-local-value 'local-function-key-map nil) "\e[23~" [?\e]))
+  (define-key local-function-key-map "\e[23~" [?\e]))
 
 ;;; arch-tag: f9f4c954-0b9e-45f9-b450-a320d32abd9c
 ;;; vt320.el ends here
index bb0afee..f1c7e37 100644 (file)
@@ -3,7 +3,7 @@
   "Terminal initialization function for vt400."
   (terminal-init-vt100)
   ;; Make F11 an escape key.
-  (define-key (terminal-local-value 'local-function-key-map nil) "\e[23~" [?\e]))
+  (define-key local-function-key-map "\e[23~" [?\e]))
 
 ;;; arch-tag: a70809c5-6b21-42cc-ba20-536683e5e7d5
 ;;; vt400.el ends here
index b67b25b..4d3206c 100644 (file)
@@ -3,7 +3,7 @@
   "Terminal initialization function for vt420."
   (terminal-init-vt100)
   ;; Make F11 an escape key.
-  (define-key (terminal-local-value 'local-function-key-map nil) "\e[23~" [?\e]))
+  (define-key local-function-key-map "\e[23~" [?\e]))
 
 ;;; arch-tag: df2f897c-3a12-4b3c-9259-df089f96c160
 ;;; vt420.el ends here
index 9ab9cb0..d561329 100644 (file)
@@ -40,9 +40,9 @@
 
 (defun terminal-init-wyse50 ()
   "Terminal initialization function for wyse50."
-  (define-key (terminal-local-value 'local-function-key-map nil) "\C-a" (make-keymap))
+  (define-key local-function-key-map "\C-a" (make-keymap))
   (mapcar (function (lambda (key-definition)
-                     (define-key (terminal-local-value 'local-function-key-map nil)
+                     (define-key local-function-key-map
                        (car key-definition) (nth 1 key-definition))))
          '(
            ;; These might be set up by termcap and terminfo
index d1ddc97..fef67ea 100644 (file)
@@ -1173,23 +1173,23 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
 (defun x-setup-function-keys (frame)
   "Set up `function-key-map' on FRAME for the X window system."
   ;; Map certain keypad keys into ASCII characters that people usually expect.
-  (let ((m (terminal-local-value 'local-function-key-map frame)))
-    (define-key m [backspace] [127])
-    (define-key m [delete] [127])
-    (define-key m [tab] [?\t])
-    (define-key m [linefeed] [?\n])
-    (define-key m [clear] [?\C-l])
-    (define-key m [return] [?\C-m])
-    (define-key m [escape] [?\e])
-    (define-key m [M-backspace] [?\M-\d])
-    (define-key m [M-delete] [?\M-\d])
-    (define-key m [M-tab] [?\M-\t])
-    (define-key m [M-linefeed] [?\M-\n])
-    (define-key m [M-clear] [?\M-\C-l])
-    (define-key m [M-return] [?\M-\C-m])
-    (define-key m [M-escape] [?\M-\e])
-    (define-key m [iso-lefttab] [backtab])
-    (define-key m [S-iso-lefttab] [backtab])))
+  (with-selected-frame frame
+    (define-key local-function-key-map [backspace] [127])
+    (define-key local-function-key-map [delete] [127])
+    (define-key local-function-key-map [tab] [?\t])
+    (define-key local-function-key-map [linefeed] [?\n])
+    (define-key local-function-key-map [clear] [?\C-l])
+    (define-key local-function-key-map [return] [?\C-m])
+    (define-key local-function-key-map [escape] [?\e])
+    (define-key local-function-key-map [M-backspace] [?\M-\d])
+    (define-key local-function-key-map [M-delete] [?\M-\d])
+    (define-key local-function-key-map [M-tab] [?\M-\t])
+    (define-key local-function-key-map [M-linefeed] [?\M-\n])
+    (define-key local-function-key-map [M-clear] [?\M-\C-l])
+    (define-key local-function-key-map [M-return] [?\M-\C-m])
+    (define-key local-function-key-map [M-escape] [?\M-\e])
+    (define-key local-function-key-map [iso-lefttab] [backtab])
+    (define-key local-function-key-map [S-iso-lefttab] [backtab])))
 
 ;; These tell read-char how to convert
 ;; these special chars to ASCII.
index 1c1e4ed..aeaaeeb 100644 (file)
       ;; 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 [f13] [S-f1] m)
-       (substitute-key-definition [f14] [S-f2] m)
-       (substitute-key-definition [f15] [S-f3] m)
-       (substitute-key-definition [f16] [S-f4] m)
-       (substitute-key-definition [f17] [S-f5] m)
-       (substitute-key-definition [f18] [S-f6] m)
-       (substitute-key-definition [f19] [S-f7] m)
-       (substitute-key-definition [f20] [S-f8] m)
-       (substitute-key-definition [f21] [S-f9] m)
-       (substitute-key-definition [f22] [S-f10] m)
-       (substitute-key-definition [f23] [S-f11] m)
-       (substitute-key-definition [f24] [S-f12] m)
-
-       (substitute-key-definition [f25] [C-f1] m)
-       (substitute-key-definition [f26] [C-f2] m)
-       (substitute-key-definition [f27] [C-f3] m)
-       (substitute-key-definition [f28] [C-f4] m)
-       (substitute-key-definition [f29] [C-f5] m)
-       (substitute-key-definition [f30] [C-f6] m)
-       (substitute-key-definition [f31] [C-f7] m)
-       (substitute-key-definition [f32] [C-f8] m)
-       (substitute-key-definition [f33] [C-f9] m)
-       (substitute-key-definition [f34] [C-f10] m)
-       (substitute-key-definition [f35] [C-f11] m)
-       (substitute-key-definition [f36] [C-f12] m)
-
-       (substitute-key-definition [f37] [C-S-f1] m)
-       (substitute-key-definition [f38] [C-S-f2] m)
-       (substitute-key-definition [f39] [C-S-f3] m)
-       (substitute-key-definition [f40] [C-S-f4] m)
-       (substitute-key-definition [f41] [C-S-f5] m)
-       (substitute-key-definition [f42] [C-S-f6] m)
-       (substitute-key-definition [f43] [C-S-f7] m)
-       (substitute-key-definition [f44] [C-S-f8] m)
-       (substitute-key-definition [f45] [C-S-f9] m)
-       (substitute-key-definition [f46] [C-S-f10] m)
-       (substitute-key-definition [f47] [C-S-f11] m)
-       (substitute-key-definition [f48] [C-S-f12] m)
-
-       (substitute-key-definition [f49] [A-f1] m)
-       (substitute-key-definition [f50] [A-f2] m)
-       (substitute-key-definition [f51] [A-f3] m)
-       (substitute-key-definition [f52] [A-f4] m)
-       (substitute-key-definition [f53] [A-f5] m)
-       (substitute-key-definition [f54] [A-f6] m)
-       (substitute-key-definition [f55] [A-f7] m)
-       (substitute-key-definition [f56] [A-f8] m)
-       (substitute-key-definition [f57] [A-f9] m)
-       (substitute-key-definition [f58] [A-f10] m)
-       (substitute-key-definition [f59] [A-f11] m)
-       (substitute-key-definition [f60] [A-f12] m))
+      (substitute-key-definition [f13] [S-f1] local-function-key-map)
+      (substitute-key-definition [f14] [S-f2] local-function-key-map)
+      (substitute-key-definition [f15] [S-f3] local-function-key-map)
+      (substitute-key-definition [f16] [S-f4] local-function-key-map)
+      (substitute-key-definition [f17] [S-f5] local-function-key-map)
+      (substitute-key-definition [f18] [S-f6] local-function-key-map)
+      (substitute-key-definition [f19] [S-f7] local-function-key-map)
+      (substitute-key-definition [f20] [S-f8] local-function-key-map)
+      (substitute-key-definition [f21] [S-f9] local-function-key-map)
+      (substitute-key-definition [f22] [S-f10] local-function-key-map)
+      (substitute-key-definition [f23] [S-f11] local-function-key-map)
+      (substitute-key-definition [f24] [S-f12] local-function-key-map)
+
+      (substitute-key-definition [f25] [C-f1] local-function-key-map)
+      (substitute-key-definition [f26] [C-f2] local-function-key-map)
+      (substitute-key-definition [f27] [C-f3] local-function-key-map)
+      (substitute-key-definition [f28] [C-f4] local-function-key-map)
+      (substitute-key-definition [f29] [C-f5] local-function-key-map)
+      (substitute-key-definition [f30] [C-f6] local-function-key-map)
+      (substitute-key-definition [f31] [C-f7] local-function-key-map)
+      (substitute-key-definition [f32] [C-f8] local-function-key-map)
+      (substitute-key-definition [f33] [C-f9] local-function-key-map)
+      (substitute-key-definition [f34] [C-f10] local-function-key-map)
+      (substitute-key-definition [f35] [C-f11] local-function-key-map)
+      (substitute-key-definition [f36] [C-f12] local-function-key-map)
+
+      (substitute-key-definition [f37] [C-S-f1] local-function-key-map)
+      (substitute-key-definition [f38] [C-S-f2] local-function-key-map)
+      (substitute-key-definition [f39] [C-S-f3] local-function-key-map)
+      (substitute-key-definition [f40] [C-S-f4] local-function-key-map)
+      (substitute-key-definition [f41] [C-S-f5] local-function-key-map)
+      (substitute-key-definition [f42] [C-S-f6] local-function-key-map)
+      (substitute-key-definition [f43] [C-S-f7] local-function-key-map)
+      (substitute-key-definition [f44] [C-S-f8] local-function-key-map)
+      (substitute-key-definition [f45] [C-S-f9] local-function-key-map)
+      (substitute-key-definition [f46] [C-S-f10] local-function-key-map)
+      (substitute-key-definition [f47] [C-S-f11] local-function-key-map)
+      (substitute-key-definition [f48] [C-S-f12] local-function-key-map)
+
+      (substitute-key-definition [f49] [A-f1] local-function-key-map)
+      (substitute-key-definition [f50] [A-f2] local-function-key-map)
+      (substitute-key-definition [f51] [A-f3] local-function-key-map)
+      (substitute-key-definition [f52] [A-f4] local-function-key-map)
+      (substitute-key-definition [f53] [A-f5] local-function-key-map)
+      (substitute-key-definition [f54] [A-f6] local-function-key-map)
+      (substitute-key-definition [f55] [A-f7] local-function-key-map)
+      (substitute-key-definition [f56] [A-f8] local-function-key-map)
+      (substitute-key-definition [f57] [A-f9] local-function-key-map)
+      (substitute-key-definition [f58] [A-f10] local-function-key-map)
+      (substitute-key-definition [f59] [A-f11] local-function-key-map)
+      (substitute-key-definition [f60] [A-f12] local-function-key-map))
 
       ;; 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 xterm-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)))
+       (set-keymap-parent m (keymap-parent local-function-key-map))
+       (set-keymap-parent local-function-key-map m)))
 
     ;; Do it!
     (xterm-register-default-colors)
     ;; This recomputes all the default faces given the colors we've just set up.
-    (tty-set-up-initial-frame-faces)))
+    (tty-set-up-initial-frame-faces))
 
 ;; Set up colors, for those versions of xterm that support it.
 (defvar xterm-standard-colors
index e5e7788..cb6c7d2 100644 (file)
@@ -891,7 +891,18 @@ do_symval_forwarding (valcontents)
 
       case Lisp_Misc_Kboard_Objfwd:
        offset = XKBOARD_OBJFWD (valcontents)->offset;
-       return *(Lisp_Object *)(offset + (char *)current_kboard);
+        /* We used to simply use current_kboard here, but from Lisp
+           code, it's value is often unexpected.  It seems nicer to
+           allow constructions like this to work as intuitively expected:
+
+               (with-selected-frame frame
+                   (define-key local-function-map "\eOP" [f1]))
+
+           On the other hand, this affects the semantics of
+           last-command and real-last-command, and people may rely on
+           that.  I took a quick look at the Lisp codebase, and I
+           don't think anything will break.  --lorentey  */
+       return *(Lisp_Object *)(offset + (char *)FRAME_KBOARD (SELECTED_FRAME ()));
       }
   return valcontents;
 }
@@ -979,7 +990,7 @@ store_symval_forwarding (symbol, valcontents, newval, buf)
 
        case Lisp_Misc_Kboard_Objfwd:
          {
-           char *base = (char *) current_kboard;
+           char *base = (char *) FRAME_KBOARD (SELECTED_FRAME ());
            char *p = base + XKBOARD_OBJFWD (valcontents)->offset;
            *(Lisp_Object *) p = newval;
          }
@@ -1125,7 +1136,7 @@ find_symbol_value (symbol)
 
        case Lisp_Misc_Kboard_Objfwd:
          return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset
-                                 + (char *)current_kboard);
+                                 + (char *)FRAME_KBOARD (SELECTED_FRAME ()));
        }
     }
 
@@ -1878,6 +1889,9 @@ If the current binding is global (the default), the value is nil.  */)
   return Qnil;
 }
 
+/* This code is disabled now that we use the selected frame to return
+   keyboard-local-values. */
+#if 0
 extern struct device *get_device P_ ((Lisp_Object display, int));
 
 DEFUN ("terminal-local-value", Fterminal_local_value, Sterminal_local_value, 2, 2, 0,
@@ -1918,6 +1932,7 @@ selected frame's display device).  */)
   pop_kboard ();
   return result;
 }
+#endif
 \f
 /* Find the function at the end of a chain of symbol function indirections.  */
 
@@ -3369,8 +3384,10 @@ syms_of_data ()
   defsubr (&Slocal_variable_p);
   defsubr (&Slocal_variable_if_set_p);
   defsubr (&Svariable_binding_locus);
+#if 0                           /* XXX Remove this. --lorentey */
   defsubr (&Sterminal_local_value);
   defsubr (&Sset_terminal_local_value);
+#endif
   defsubr (&Saref);
   defsubr (&Saset);
   defsubr (&Snumber_to_string);