Commit c40bb1ba authored by Karoly Lorentey's avatar Karoly Lorentey
Browse files

Fix semantics of terminal-local variables. Remove `terminal-local-value' hack.

* 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
parent 1d33157f
......@@ -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)
......
......@@ -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)))
......
......@@ -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.
......
......@@ -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
......
......@@ -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
......@@ -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))
......
......@@ -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))
;;;; 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))
......
......@@ -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
......
......@@ -29,21 +29,20 @@
;; ---------------------------------------------------------------------------
;; 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)
......
......@@ -338,8 +338,8 @@
;; 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
......@@ -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
......@@ -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.
......
......@@ -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"))
......
......@@ -132,46 +132,45 @@
;; 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)
......
......@@ -150,7 +150,7 @@
(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])
......
......@@ -30,14 +30,14 @@
(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
......@@ -86,17 +86,17 @@
;; 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))))
......
......@@ -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
......@@ -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
......@@ -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
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment