From: Karoly Lorentey Date: Mon, 27 Jun 2005 03:19:27 +0000 (+0000) Subject: Use terminal-local-value to access function-key-map in terminal packages. X-Git-Tag: emacs-pretest-23.0.90~11236^2~141^2~234 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ff2fc632a5f3a53ab1ad59388d18182656399c40;p=emacs.git Use terminal-local-value to access function-key-map in terminal packages. * lisp/term/AT386.el: Wrap function-key-map accesses in (set-)terminal-local-value. * lisp/term/internal.el: Ditto. * lisp/term/iris-ansi.el: Ditto. * lisp/term/lk201.el: Ditto. * lisp/term/mac-win.el: Ditto. * lisp/term/news.el: Ditto. * lisp/term/rxvt.el: Ditto. * lisp/term/sun.el: Ditto. * lisp/term/tvi970.el: Ditto. * lisp/term/wyse50.el: Ditto. * lisp/term/x-win.el: Ditto. * lisp/term/xterm.el: Ditto. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-366 --- diff --git a/lisp/term/AT386.el b/lisp/term/AT386.el index 31248018c42..747a63336ec 100644 --- a/lisp/term/AT386.el +++ b/lisp/term/AT386.el @@ -31,7 +31,7 @@ (if (boundp 'AT386-keypad-map) nil ;; The terminal initialization should already have set up some keys - (setq AT386-keypad-map (lookup-key function-key-map "\e[")) + (setq AT386-keypad-map (lookup-key (terminal-local-value 'function-key-map nil) "\e[")) (if (not (keymapp AT386-keypad-map)) (error "What? Your AT386 termcap/terminfo has no keycaps in it")) @@ -54,7 +54,7 @@ (define-key AT386-keypad-map "T" [kp-add]) ;; Arrange for the ALT key to be equivalent to ESC - (define-key function-key-map "\eN" [27]) ; ALT map + (define-key (terminal-local-value 'function-key-map nil) "\eN" [27]) ; ALT map ) ;;; arch-tag: abec1b03-582f-49f8-b8cb-e2fd52ea4bd7 diff --git a/lisp/term/internal.el b/lisp/term/internal.el index 87a78d2e9a2..c5a515f14cd 100644 --- a/lisp/term/internal.el +++ b/lisp/term/internal.el @@ -28,20 +28,21 @@ ;; --------------------------------------------------------------------------- ;; keyboard setup -- that's simple! (set-input-mode nil nil 0) -(define-key function-key-map [backspace] "\177") ; Normal behaviour for BS -(define-key function-key-map [delete] "\C-d") ; ... and Delete -(define-key function-key-map [tab] [?\t]) -(define-key function-key-map [linefeed] [?\n]) -(define-key function-key-map [clear] [11]) -(define-key function-key-map [return] [13]) -(define-key function-key-map [escape] [?\e]) -(define-key function-key-map [M-backspace] [?\M-\d]) -(define-key function-key-map [M-delete] [?\M-d]) -(define-key function-key-map [M-tab] [?\M-\t]) -(define-key function-key-map [M-linefeed] [?\M-\n]) -(define-key function-key-map [M-clear] [?\M-\013]) -(define-key function-key-map [M-return] [?\M-\015]) -(define-key function-key-map [M-escape] [?\M-\e]) +(let (m (terminal-local-value '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])) (put 'backspace 'ascii-character 127) (put 'delete 'ascii-character 127) (put 'tab 'ascii-character ?\t) diff --git a/lisp/term/iris-ansi.el b/lisp/term/iris-ansi.el index 9cdddaae4e4..573afb232d8 100644 --- a/lisp/term/iris-ansi.el +++ b/lisp/term/iris-ansi.el @@ -333,8 +333,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 function-key-map)) - (set-keymap-parent function-key-map m)) + (set-keymap-parent m (keymap-parent (terminal-local-value 'function-key-map nil))) + (set-keymap-parent (terminal-local-value 'function-key-map nil) m)) ;;; arch-tag: b1d0e73a-bb7d-47be-9fb2-6fb126469a1b ;;; iris-ansi.el ends here diff --git a/lisp/term/lk201.el b/lisp/term/lk201.el index 735db12ba82..8e40a25070c 100644 --- a/lisp/term/lk201.el +++ b/lisp/term/lk201.el @@ -79,8 +79,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 function-key-map)) - (set-keymap-parent function-key-map m)) + (set-keymap-parent m (keymap-parent (terminal-local-value 'function-key-map nil))) + (set-keymap-parent (terminal-local-value 'function-key-map nil) m)) ;;; arch-tag: 7ffb4444-6a23-43e1-b457-43cf4f673c0d ;;; lk201.el ends here diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el index b7cdace8eec..6dc09690e31 100644 --- a/lisp/term/mac-win.el +++ b/lisp/term/mac-win.el @@ -1059,20 +1059,21 @@ 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. -(define-key function-key-map [backspace] [?\d]) -(define-key function-key-map [delete] [?\d]) -(define-key function-key-map [tab] [?\t]) -(define-key function-key-map [linefeed] [?\n]) -(define-key function-key-map [clear] [?\C-l]) -(define-key function-key-map [return] [?\C-m]) -(define-key function-key-map [escape] [?\e]) -(define-key function-key-map [M-backspace] [?\M-\d]) -(define-key function-key-map [M-delete] [?\M-\d]) -(define-key function-key-map [M-tab] [?\M-\t]) -(define-key function-key-map [M-linefeed] [?\M-\n]) -(define-key function-key-map [M-clear] [?\M-\C-l]) -(define-key function-key-map [M-return] [?\M-\C-m]) -(define-key function-key-map [M-escape] [?\M-\e]) +(let ((m (terminal-local-value '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])) ;; These tell read-char how to convert ;; these special chars to ASCII. diff --git a/lisp/term/news.el b/lisp/term/news.el index a6f7481c422..fc5dd86710f 100644 --- a/lisp/term/news.el +++ b/lisp/term/news.el @@ -31,7 +31,7 @@ (if (boundp 'news-fkey-prefix) nil ;; The terminal initialization should already have set up some keys - (setq news-fkey-prefix (lookup-key function-key-map "\eO")) + (setq news-fkey-prefix (lookup-key (terminal-local-value 'function-key-map nil) "\eO")) (if (not (keymapp news-fkey-prefix)) (error "What? Your news termcap/terminfo has no keycaps in it")) diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el index 6b824ecd0b9..f5937701d1d 100644 --- a/lisp/term/rxvt.el +++ b/lisp/term/rxvt.el @@ -100,8 +100,8 @@ ;; 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 function-key-map)) - (set-keymap-parent function-key-map m)) + (set-keymap-parent m (keymap-parent (terminal-local-value 'function-key-map nil))) + (set-keymap-parent (terminal-local-value 'function-key-map nil) m)) ;; Set up colors, for those versions of rxvt that support it. diff --git a/lisp/term/sun.el b/lisp/term/sun.el index 238bb2f7212..a08d7072da0 100644 --- a/lisp/term/sun.el +++ b/lisp/term/sun.el @@ -93,7 +93,7 @@ ;; (defvar sun-raw-prefix (make-sparse-keymap)) -(define-key function-key-map "\e[" sun-raw-prefix) +(define-key (terminal-local-value 'function-key-map nil) "\e[" sun-raw-prefix) (define-key sun-raw-prefix "210z" [r3]) (define-key sun-raw-prefix "213z" [r6]) diff --git a/lisp/term/tvi970.el b/lisp/term/tvi970.el index 425ac200927..d09cafec178 100644 --- a/lisp/term/tvi970.el +++ b/lisp/term/tvi970.el @@ -28,14 +28,14 @@ ;;; Code: -(or (lookup-key function-key-map "\e[") - (define-key function-key-map "\e[" (make-keymap))) -;; (or (lookup-key function-key-map "\eO") -;; (define-key function-key-map "\eO" (make-keymap))) +(or (lookup-key (terminal-local-value 'function-key-map nil) "\e[") + (define-key (terminal-local-value 'function-key-map nil) "\e[" (make-keymap))) +;; (or (lookup-key (terminal-local-value 'function-key-map nil) "\eO") +;; (define-key (terminal-local-value 'function-key-map nil) "\eO" (make-keymap))) ;; Miscellaneous keys (mapcar (function (lambda (key-binding) - (define-key function-key-map + (define-key (terminal-local-value 'function-key-map nil) (car key-binding) (nth 1 key-binding)))) '( ;; These are set up by termcap or terminfo @@ -84,17 +84,17 @@ ;; The numeric keypad keys. (let ((i 0)) (while (< i 10) - (define-key function-key-map + (define-key (terminal-local-value 'function-key-map nil) (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 function-key-map + (define-key (terminal-local-value 'function-key-map nil) (format "\e?%c" (+ i ?a)) (vector (intern (format "f%d" (1+ i))))) - (define-key function-key-map + (define-key (terminal-local-value 'function-key-map nil) (format "\e?%c" (+ i ?A)) (vector (intern (format "S-f%d" (1+ i))))) (setq i (1+ i)))) diff --git a/lisp/term/wyse50.el b/lisp/term/wyse50.el index edcbe1259fb..ca45c5755eb 100644 --- a/lisp/term/wyse50.el +++ b/lisp/term/wyse50.el @@ -37,9 +37,9 @@ ;;; Code: -(define-key function-key-map "\C-a" (make-keymap)) +(define-key (terminal-local-value 'function-key-map nil) "\C-a" (make-keymap)) (mapcar (function (lambda (key-definition) - (define-key function-key-map + (define-key (terminal-local-value 'function-key-map nil) (car key-definition) (nth 1 key-definition)))) '( ;; These might be set up by termcap and terminfo diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 56ee16de2ba..49b047f9a15 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -1170,23 +1170,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. - (with-selected-frame (or frame (selected-frame)) - (define-key function-key-map [backspace] [127]) - (define-key function-key-map [delete] [127]) - (define-key function-key-map [tab] [?\t]) - (define-key function-key-map [linefeed] [?\n]) - (define-key function-key-map [clear] [?\C-l]) - (define-key function-key-map [return] [?\C-m]) - (define-key function-key-map [escape] [?\e]) - (define-key function-key-map [M-backspace] [?\M-\d]) - (define-key function-key-map [M-delete] [?\M-\d]) - (define-key function-key-map [M-tab] [?\M-\t]) - (define-key function-key-map [M-linefeed] [?\M-\n]) - (define-key function-key-map [M-clear] [?\M-\C-l]) - (define-key function-key-map [M-return] [?\M-\C-m]) - (define-key function-key-map [M-escape] [?\M-\e]) - (define-key function-key-map [iso-lefttab] [backtab]) - (define-key function-key-map [S-iso-lefttab] [backtab]))) + (let ((m (terminal-local-value '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]))) ;; These tell read-char how to convert ;; these special chars to ASCII. diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index dd3f2dadece..a00271f2ce3 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -189,8 +189,8 @@ ;; 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 function-key-map)) - (set-keymap-parent function-key-map m)) + (set-keymap-parent m (keymap-parent (terminal-local-value 'function-key-map nil))) + (set-keymap-parent (terminal-local-value 'function-key-map nil) m)) ;; The terminal intialization C code file might have initialized ;; function keys F13->F60 from the termcap/terminfo information. On @@ -200,57 +200,58 @@ ;; 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 [f13] [S-f1] function-key-map) -(substitute-key-definition [f14] [S-f2] function-key-map) -(substitute-key-definition [f15] [S-f3] function-key-map) -(substitute-key-definition [f16] [S-f4] function-key-map) -(substitute-key-definition [f17] [S-f5] function-key-map) -(substitute-key-definition [f18] [S-f6] function-key-map) -(substitute-key-definition [f19] [S-f7] function-key-map) -(substitute-key-definition [f20] [S-f8] function-key-map) -(substitute-key-definition [f21] [S-f9] function-key-map) -(substitute-key-definition [f22] [S-f10] function-key-map) -(substitute-key-definition [f23] [S-f11] function-key-map) -(substitute-key-definition [f24] [S-f12] function-key-map) - -(substitute-key-definition [f25] [C-f1] function-key-map) -(substitute-key-definition [f26] [C-f2] function-key-map) -(substitute-key-definition [f27] [C-f3] function-key-map) -(substitute-key-definition [f28] [C-f4] function-key-map) -(substitute-key-definition [f29] [C-f5] function-key-map) -(substitute-key-definition [f30] [C-f6] function-key-map) -(substitute-key-definition [f31] [C-f7] function-key-map) -(substitute-key-definition [f32] [C-f8] function-key-map) -(substitute-key-definition [f33] [C-f9] function-key-map) -(substitute-key-definition [f34] [C-f10] function-key-map) -(substitute-key-definition [f35] [C-f11] function-key-map) -(substitute-key-definition [f36] [C-f12] function-key-map) - -(substitute-key-definition [f37] [C-S-f1] function-key-map) -(substitute-key-definition [f38] [C-S-f2] function-key-map) -(substitute-key-definition [f39] [C-S-f3] function-key-map) -(substitute-key-definition [f40] [C-S-f4] function-key-map) -(substitute-key-definition [f41] [C-S-f5] function-key-map) -(substitute-key-definition [f42] [C-S-f6] function-key-map) -(substitute-key-definition [f43] [C-S-f7] function-key-map) -(substitute-key-definition [f44] [C-S-f8] function-key-map) -(substitute-key-definition [f45] [C-S-f9] function-key-map) -(substitute-key-definition [f46] [C-S-f10] function-key-map) -(substitute-key-definition [f47] [C-S-f11] function-key-map) -(substitute-key-definition [f48] [C-S-f12] function-key-map) - -(substitute-key-definition [f49] [A-f1] function-key-map) -(substitute-key-definition [f50] [A-f2] function-key-map) -(substitute-key-definition [f51] [A-f3] function-key-map) -(substitute-key-definition [f52] [A-f4] function-key-map) -(substitute-key-definition [f53] [A-f5] function-key-map) -(substitute-key-definition [f54] [A-f6] function-key-map) -(substitute-key-definition [f55] [A-f7] function-key-map) -(substitute-key-definition [f56] [A-f8] function-key-map) -(substitute-key-definition [f57] [A-f9] function-key-map) -(substitute-key-definition [f58] [A-f10] function-key-map) -(substitute-key-definition [f59] [A-f11] function-key-map) -(substitute-key-definition [f60] [A-f12] function-key-map) +(let ((m (terminal-local-value '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)) ;; Set up colors, for those versions of xterm that support it.