aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaroly Lorentey2006-05-20 17:02:47 +0000
committerKaroly Lorentey2006-05-20 17:02:47 +0000
commit8cbd7bed2db718a63ed37182c566f9e059925c71 (patch)
treeb8905d6abc17f84a33d1f80f35a0b87f69819da9
parentb34c34dae08d94ca9ab0cd50cb53f0ab0cd21491 (diff)
downloademacs-8cbd7bed2db718a63ed37182c566f9e059925c71.tar.gz
emacs-8cbd7bed2db718a63ed37182c566f9e059925c71.zip
Fix and/or simplify terminal initialization files.
* lisp/faces.el (tty-create-frame-with-faces): Set up faces and background mode only after the terminal has been initialized. (frame-set-background-mode): Handle the 'background-mode terminal parameter. (tty-run-terminal-initialization): Add type option. * lisp/term/README: Update. * lisp/term/rxvt.el: Simplify. * lisp/term/xterm.el: Simplify and fix. * lisp/term/*.el: Simplify and fix. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-564
-rw-r--r--README.multi-tty2
-rw-r--r--lisp/faces.el19
-rw-r--r--lisp/term/AT386.el4
-rw-r--r--lisp/term/README50
-rw-r--r--lisp/term/apollo.el2
-rw-r--r--lisp/term/bobcat.el2
-rw-r--r--lisp/term/cygwin.el2
-rw-r--r--lisp/term/iris-ansi.el381
-rw-r--r--lisp/term/lk201.el146
-rw-r--r--lisp/term/news.el6
-rw-r--r--lisp/term/rxvt.el258
-rw-r--r--lisp/term/vt100.el2
-rw-r--r--lisp/term/vt102.el4
-rw-r--r--lisp/term/vt125.el4
-rw-r--r--lisp/term/vt200.el2
-rw-r--r--lisp/term/vt201.el2
-rw-r--r--lisp/term/vt220.el2
-rw-r--r--lisp/term/vt240.el2
-rw-r--r--lisp/term/vt300.el2
-rw-r--r--lisp/term/vt320.el2
-rw-r--r--lisp/term/vt400.el2
-rw-r--r--lisp/term/vt420.el2
-rw-r--r--lisp/term/xterm.el475
23 files changed, 684 insertions, 689 deletions
diff --git a/README.multi-tty b/README.multi-tty
index ed9c4b561bb..9cce8f8dfa2 100644
--- a/README.multi-tty
+++ b/README.multi-tty
@@ -404,6 +404,8 @@ is probably not very interesting for anyone else.)
404THINGS TO DO 404THINGS TO DO
405------------ 405------------
406 406
407** See if `tty-defined-color-alist' needs to be terminal-local.
408
407** emacsclient -t on the console does not work after su. You have to 409** emacsclient -t on the console does not work after su. You have to
408 use non-root accounts or start as root to see this. 410 use non-root accounts or start as root to see this.
409 411
diff --git a/lisp/faces.el b/lisp/faces.el
index b428db0ebf0..69af786ee84 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1598,11 +1598,13 @@ according to the `background-mode' and `display-type' frame parameters."
1598 (and (window-system frame) 1598 (and (window-system frame)
1599 (x-get-resource "backgroundMode" "BackgroundMode"))) 1599 (x-get-resource "backgroundMode" "BackgroundMode")))
1600 (bg-color (frame-parameter frame 'background-color)) 1600 (bg-color (frame-parameter frame 'background-color))
1601 (tty-type (frame-parameter frame 'tty-type)) 1601 (terminal-bg-mode (terminal-parameter frame 'background-mode))
1602 (tty-type (tty-type frame))
1602 (bg-mode 1603 (bg-mode
1603 (cond (frame-background-mode) 1604 (cond (frame-background-mode)
1604 (bg-resource 1605 (bg-resource
1605 (intern (downcase bg-resource))) 1606 (intern (downcase bg-resource)))
1607 (terminal-bg-mode)
1606 ((and (null (window-system frame)) 1608 ((and (null (window-system frame))
1607 ;; Unspecified frame background color can only 1609 ;; Unspecified frame background color can only
1608 ;; happen on tty's. 1610 ;; happen on tty's.
@@ -1826,8 +1828,6 @@ created."
1826 (unwind-protect 1828 (unwind-protect
1827 (with-selected-frame frame 1829 (with-selected-frame frame
1828 (tty-handle-reverse-video frame (frame-parameters frame)) 1830 (tty-handle-reverse-video frame (frame-parameters frame))
1829 (frame-set-background-mode frame)
1830 (face-set-after-frame-default frame)
1831 1831
1832 ;; Make sure the kill and yank functions do not touch the X clipboard. 1832 ;; Make sure the kill and yank functions do not touch the X clipboard.
1833 (modify-frame-parameters frame '((interprogram-cut-function . nil))) 1833 (modify-frame-parameters frame '((interprogram-cut-function . nil)))
@@ -1835,6 +1835,8 @@ created."
1835 1835
1836 (set-locale-environment nil frame) 1836 (set-locale-environment nil frame)
1837 (tty-run-terminal-initialization frame) 1837 (tty-run-terminal-initialization frame)
1838 (frame-set-background-mode frame)
1839 (face-set-after-frame-default frame)
1838 (setq success t)) 1840 (setq success t))
1839 (unless success 1841 (unless success
1840 (delete-frame frame))) 1842 (delete-frame frame)))
@@ -1857,8 +1859,11 @@ the above example."
1857 nil)))) 1859 nil))))
1858 type) 1860 type)
1859 1861
1860(defun tty-run-terminal-initialization (frame) 1862(defun tty-run-terminal-initialization (frame &optional type)
1861 "Run the special initialization code for the terminal type of FRAME." 1863 "Run the special initialization code for the terminal type of FRAME.
1864The optional TYPE parameter may be used to override the autodetected
1865terminal type to a different value."
1866 (setq type (or type (tty-type frame)))
1862 ;; Load library for our terminal type. 1867 ;; Load library for our terminal type.
1863 ;; User init file can set term-file-prefix to nil to prevent this. 1868 ;; User init file can set term-file-prefix to nil to prevent this.
1864 (with-selected-frame frame 1869 (with-selected-frame frame
@@ -1874,12 +1879,12 @@ the above example."
1874 (and file 1879 (and file
1875 (or (assoc file load-history) 1880 (or (assoc file load-history)
1876 (load file t t))))) 1881 (load file t t)))))
1877 (tty-type frame)) 1882 type)
1878 ;; Next, try to find a matching initialization function, and call it. 1883 ;; Next, try to find a matching initialization function, and call it.
1879 (tty-find-type #'(lambda (type) 1884 (tty-find-type #'(lambda (type)
1880 (fboundp (setq term-init-func 1885 (fboundp (setq term-init-func
1881 (intern (concat "terminal-init-" type))))) 1886 (intern (concat "terminal-init-" type)))))
1882 (tty-type frame)) 1887 type)
1883 (when (fboundp term-init-func) 1888 (when (fboundp term-init-func)
1884 (funcall term-init-func)) 1889 (funcall term-init-func))
1885 (set-terminal-parameter frame 'terminal-initted term-init-func))))) 1890 (set-terminal-parameter frame 'terminal-initted term-init-func)))))
diff --git a/lisp/term/AT386.el b/lisp/term/AT386.el
index adec1f1505f..2f98e7bf6fa 100644
--- a/lisp/term/AT386.el
+++ b/lisp/term/AT386.el
@@ -31,10 +31,8 @@
31 31
32(defun terminal-init-AT386 () 32(defun terminal-init-AT386 ()
33 "Terminal initialization function for AT386." 33 "Terminal initialization function for AT386."
34 (if (boundp 'AT386-keypad-map) 34 (let ((AT386-keypad-map (lookup-key local-function-key-map "\e[")))
35 nil
36 ;; The terminal initialization should already have set up some keys 35 ;; The terminal initialization should already have set up some keys
37 (setq AT386-keypad-map (lookup-key local-function-key-map "\e["))
38 (if (not (keymapp AT386-keypad-map)) 36 (if (not (keymapp AT386-keypad-map))
39 (error "What? Your AT386 termcap/terminfo has no keycaps in it")) 37 (error "What? Your AT386 termcap/terminfo has no keycaps in it"))
40 38
diff --git a/lisp/term/README b/lisp/term/README
index 581f321d3ba..1912df47f4f 100644
--- a/lisp/term/README
+++ b/lisp/term/README
@@ -1,19 +1,43 @@
1 This directory contains files of elisp that customize Emacs for certain 1 This directory contains files of elisp that customize Emacs for certain
2terminal types. 2terminal types.
3 3
4 When Emacs starts, it checks the TERM environment variable to see what type 4 When Emacs opens a new terminal, it checks the TERM environment variable to
5of terminal the user is running on, checks for an elisp file named 5see what type of terminal the user is running on, searches for an elisp file
6"term/${TERM}.el", and if one exists, loads it. If that doesn't yield a file 6named "term/${TERM}.el", and if one exists, loads it. If Emacs finds no
7that exists, the last hyphen and what follows it is stripped. If that doesn't 7suitable file, then it strips the last hyphen and what follows it from TERM,
8yield a file that exists, the previous hyphen is stripped, and so on until all 8and tries again. If that still doesn't yield a file, then the previous hyphen
9hyphens are gone. For example, if the terminal type is `aaa-48-foo', Emacs 9is stripped, and so on until all hyphens are gone. For example, if the
10will try first `term/aaa-48-foo.el', then `term/aaa-48.el' and finally 10terminal type is `aaa-48-foo', Emacs will try first `term/aaa-48-foo.el', then
11`term/aaa.el'. Each terminal specific file should contain a function 11`term/aaa-48.el' and finally `term/aaa.el'. Emacs stops searching at the
12named terminal-init-TERMINALNAME (eg terminal-init-aaa-48 for 12first file found, and will not load more than one file for any terminal. Note
13term/aaa-48.el) that Emacs will call in order to initialize the 13that it is not an error if Emacs is unable to find a terminal initialization
14terminal. The terminal files should not contain any top level forms 14file; in that case, it will simply proceed with the next step without loading
15that are executed when the file is loaded, all the initialization 15any files.
16actions are performed by the terminal-init-TERMINALNAME functions. 16
17 Once the file has been loaded (or the search failed), Emacs tries to call a
18function named `terminal-init-TERMINALNAME' (eg `terminal-init-aaa-48' for the
19`aaa-48' terminal) in order to initialize the terminal. Once again, if the
20function is not found, Emacs strips the last component of the name and tries
21again using the shorter name. This search is independent of the previous file
22search, so that you can have terminal initialization functions for a family of
23terminals collected in a single file named after the family name, and users
24may put terminal initialization functions directly in their .emacs files.
25
26 Note that an individual terminal file is loaded only once in an Emacs
27session; if the same terminal type is opened again, Emacs will simply call the
28initialization function without reloading the file. Therefore, all the actual
29initialization actions should be collected in terminal-init-* functions; the
30file should not contain any top-level form that is not a function or variable
31declaration. Simply loading the file should not have any side effect.
32
33 Similarly, the terminal initialization function is called only once on any
34given terminal, when the first frame is created on it. The function is not
35called for subsequent frames on the same terminal. Therefore, terminal-init-*
36functions should only modify terminal-local variables (such as
37`local-function-key-map') and terminal parameters. For example, it is not
38correct to modify frame parameters, since the modifications will only be
39applied for the first frame opened on the terminal.
40
17 41
18 When writing terminal packages, there are some things it is good to keep in 42 When writing terminal packages, there are some things it is good to keep in
19mind. 43mind.
diff --git a/lisp/term/apollo.el b/lisp/term/apollo.el
index 1e0e6f0a1f1..c47de919b0c 100644
--- a/lisp/term/apollo.el
+++ b/lisp/term/apollo.el
@@ -1,7 +1,7 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2(defun terminal-init-apollo () 2(defun terminal-init-apollo ()
3 "Terminal initialization function for apollo." 3 "Terminal initialization function for apollo."
4 (terminal-init-vt100)) 4 (tty-run-terminal-initialization (selected-frame) "vt100"))
5 5
6;;; arch-tag: c72f446f-e6b7-4749-90a4-bd68632adacf 6;;; arch-tag: c72f446f-e6b7-4749-90a4-bd68632adacf
7;;; apollo.el ends here 7;;; apollo.el ends here
diff --git a/lisp/term/bobcat.el b/lisp/term/bobcat.el
index 82401f7bf71..974476f6798 100644
--- a/lisp/term/bobcat.el
+++ b/lisp/term/bobcat.el
@@ -1,7 +1,7 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2 2
3(defun terminal-init-bobcat () 3(defun terminal-init-bobcat ()
4 "Terminal initialization function for bobcat." 4 "Terminal initialization function for bobcat."
5 ;; HP terminals usually encourage using ^H as the rubout character 5 ;; HP terminals usually encourage using ^H as the rubout character
6 (keyboard-translate ?\177 ?\^h) 6 (keyboard-translate ?\177 ?\^h)
7 (keyboard-translate ?\^h ?\177)) 7 (keyboard-translate ?\^h ?\177))
diff --git a/lisp/term/cygwin.el b/lisp/term/cygwin.el
index 3bdd5d3aa05..df857ba6625 100644
--- a/lisp/term/cygwin.el
+++ b/lisp/term/cygwin.el
@@ -3,7 +3,7 @@
3;;; The Cygwin terminal can't really display underlines. 3;;; The Cygwin terminal can't really display underlines.
4 4
5(defun terminal-init-cygwin () 5(defun terminal-init-cygwin ()
6 "Terminal initialization function for cygwin." 6 "Terminal initialization function for cygwin."
7 (tty-no-underline)) 7 (tty-no-underline))
8 8
9;; arch-tag: ca81ce67-3c41-4883-a29b-4c3d64a21191 9;; arch-tag: ca81ce67-3c41-4883-a29b-4c3d64a21191
diff --git a/lisp/term/iris-ansi.el b/lisp/term/iris-ansi.el
index c68aa7f8984..a6d0724cad1 100644
--- a/lisp/term/iris-ansi.el
+++ b/lisp/term/iris-ansi.el
@@ -26,321 +26,314 @@
26 26
27;;; Code: 27;;; Code:
28 28
29(defvar iris-function-map nil 29(defvar iris-function-map (make-sparse-keymap)
30 "Function key definitions for SGI xwsh and winterm apps.") 30 "Function key definitions for SGI xwsh and winterm apps.")
31 31
32;; Make reloads faster. 32(define-key iris-function-map "\e[120q" [S-escape])
33(unless iris-function-map 33(define-key iris-function-map "\e[121q" [C-escape])
34 (setq iris-function-map (make-sparse-keymap))
35 34
36 (define-key iris-function-map "\e[120q" [S-escape]) 35(define-key iris-function-map "\e[001q" [f1])
37 (define-key iris-function-map "\e[121q" [C-escape]) 36(define-key iris-function-map "\e[013q" [S-f1])
37(define-key iris-function-map "\e[025q" [C-f1])
38 38
39 (define-key iris-function-map "\e[001q" [f1])
40 (define-key iris-function-map "\e[013q" [S-f1])
41 (define-key iris-function-map "\e[025q" [C-f1])
42 39
40(define-key iris-function-map "\e[002q" [f2])
41(define-key iris-function-map "\e[014q" [S-f2])
42(define-key iris-function-map "\e[026q" [C-f2])
43(define-key iris-function-map "\e[038q" [M-f2])
43 44
44 (define-key iris-function-map "\e[002q" [f2]) 45(define-key iris-function-map "\e[003q" [f3])
45 (define-key iris-function-map "\e[014q" [S-f2]) 46(define-key iris-function-map "\e[015q" [S-f3])
46 (define-key iris-function-map "\e[026q" [C-f2]) 47(define-key iris-function-map "\e[027q" [C-f3])
47 (define-key iris-function-map "\e[038q" [M-f2])
48 48
49 (define-key iris-function-map "\e[003q" [f3])
50 (define-key iris-function-map "\e[015q" [S-f3])
51 (define-key iris-function-map "\e[027q" [C-f3])
52 49
50(define-key iris-function-map "\e[004q" [f4])
51(define-key iris-function-map "\e[016q" [S-f4])
52(define-key iris-function-map "\e[028q" [C-f4])
53 53
54 (define-key iris-function-map "\e[004q" [f4])
55 (define-key iris-function-map "\e[016q" [S-f4])
56 (define-key iris-function-map "\e[028q" [C-f4])
57 54
55(define-key iris-function-map "\e[005q" [f5])
56(define-key iris-function-map "\e[017q" [S-f5])
57(define-key iris-function-map "\e[029q" [C-f5])
58 58
59 (define-key iris-function-map "\e[005q" [f5])
60 (define-key iris-function-map "\e[017q" [S-f5])
61 (define-key iris-function-map "\e[029q" [C-f5])
62 59
60(define-key iris-function-map "\e[006q" [f6])
61(define-key iris-function-map "\e[018q" [S-f6])
62(define-key iris-function-map "\e[030q" [C-f6])
63 63
64 (define-key iris-function-map "\e[006q" [f6])
65 (define-key iris-function-map "\e[018q" [S-f6])
66 (define-key iris-function-map "\e[030q" [C-f6])
67 64
65(define-key iris-function-map "\e[007q" [f7])
66(define-key iris-function-map "\e[019q" [S-f7])
67(define-key iris-function-map "\e[031q" [C-f7])
68 68
69 (define-key iris-function-map "\e[007q" [f7])
70 (define-key iris-function-map "\e[019q" [S-f7])
71 (define-key iris-function-map "\e[031q" [C-f7])
72 69
70(define-key iris-function-map "\e[008q" [f8])
71(define-key iris-function-map "\e[020q" [S-f8])
72(define-key iris-function-map "\e[032q" [C-f8])
73 73
74 (define-key iris-function-map "\e[008q" [f8])
75 (define-key iris-function-map "\e[020q" [S-f8])
76 (define-key iris-function-map "\e[032q" [C-f8])
77 74
75(define-key iris-function-map "\e[009q" [f9])
76(define-key iris-function-map "\e[021q" [S-f9])
77(define-key iris-function-map "\e[033q" [C-f9])
78 78
79 (define-key iris-function-map "\e[009q" [f9])
80 (define-key iris-function-map "\e[021q" [S-f9])
81 (define-key iris-function-map "\e[033q" [C-f9])
82 79
80(define-key iris-function-map "\e[010q" [f10])
81(define-key iris-function-map "\e[022q" [S-f10])
82(define-key iris-function-map "\e[034q" [C-f10])
83 83
84 (define-key iris-function-map "\e[010q" [f10])
85 (define-key iris-function-map "\e[022q" [S-f10])
86 (define-key iris-function-map "\e[034q" [C-f10])
87 84
85(define-key iris-function-map "\e[011q" [f11])
86(define-key iris-function-map "\e[023q" [S-f11])
87(define-key iris-function-map "\e[035q" [C-f11])
88(define-key iris-function-map "\e[047q" [M-f11])
88 89
89 (define-key iris-function-map "\e[011q" [f11]) 90(define-key iris-function-map "\e[012q" [f12])
90 (define-key iris-function-map "\e[023q" [S-f11]) 91(define-key iris-function-map "\e[024q" [S-f12])
91 (define-key iris-function-map "\e[035q" [C-f11]) 92(define-key iris-function-map "\e[036q" [C-f12])
92 (define-key iris-function-map "\e[047q" [M-f11]) 93(define-key iris-function-map "\e[048q" [M-f12])
93 94
94 (define-key iris-function-map "\e[012q" [f12])
95 (define-key iris-function-map "\e[024q" [S-f12])
96 (define-key iris-function-map "\e[036q" [C-f12])
97 (define-key iris-function-map "\e[048q" [M-f12])
98 95
96(define-key iris-function-map "\e[057q" [C-`])
97(define-key iris-function-map "\e[115q" [M-`])
99 98
100 (define-key iris-function-map "\e[057q" [C-`]) 99(define-key iris-function-map "\e[049q" [?\C-1])
101 (define-key iris-function-map "\e[115q" [M-`]) 100(define-key iris-function-map "\e[058q" [?\M-1])
102 101
103 (define-key iris-function-map "\e[049q" [?\C-1])
104 (define-key iris-function-map "\e[058q" [?\M-1])
105 102
103(define-key iris-function-map "\e[059q" [?\M-2])
106 104
107 (define-key iris-function-map "\e[059q" [?\M-2]) 105(define-key iris-function-map "\e[050q" [?\C-3])
106(define-key iris-function-map "\e[060q" [?\M-3])
108 107
109 (define-key iris-function-map "\e[050q" [?\C-3]) 108(define-key iris-function-map "\e[051q" [?\C-4])
110 (define-key iris-function-map "\e[060q" [?\M-3]) 109(define-key iris-function-map "\e[061q" [?\M-4])
111 110
112 (define-key iris-function-map "\e[051q" [?\C-4]) 111(define-key iris-function-map "\e[052q" [?\C-5])
113 (define-key iris-function-map "\e[061q" [?\M-4]) 112(define-key iris-function-map "\e[062q" [?\M-5])
114 113
115 (define-key iris-function-map "\e[052q" [?\C-5])
116 (define-key iris-function-map "\e[062q" [?\M-5])
117 114
115(define-key iris-function-map "\e[063q" [?\M-6])
118 116
119 (define-key iris-function-map "\e[063q" [?\M-6]) 117(define-key iris-function-map "\e[053q" [?\C-7])
118(define-key iris-function-map "\e[064q" [?\M-7])
120 119
121 (define-key iris-function-map "\e[053q" [?\C-7]) 120(define-key iris-function-map "\e[054q" [?\C-8])
122 (define-key iris-function-map "\e[064q" [?\M-7]) 121(define-key iris-function-map "\e[065q" [?\M-8])
123 122
124 (define-key iris-function-map "\e[054q" [?\C-8]) 123(define-key iris-function-map "\e[055q" [?\C-9])
125 (define-key iris-function-map "\e[065q" [?\M-8]) 124(define-key iris-function-map "\e[066q" [?\M-9])
126 125
127 (define-key iris-function-map "\e[055q" [?\C-9]) 126(define-key iris-function-map "\e[056q" [?\C-0])
128 (define-key iris-function-map "\e[066q" [?\M-9]) 127(define-key iris-function-map "\e[067q" [?\M-0])
129 128
130 (define-key iris-function-map "\e[056q" [?\C-0]) 129(define-key iris-function-map "\e[068q" [?\M--])
131 (define-key iris-function-map "\e[067q" [?\M-0])
132 130
133 (define-key iris-function-map "\e[068q" [?\M--]) 131(define-key iris-function-map "\e[069q" [?\C-=])
132(define-key iris-function-map "\e[070q" [?\M-=])
134 133
135 (define-key iris-function-map "\e[069q" [?\C-=]) 134;; I don't know what to do with those.
136 (define-key iris-function-map "\e[070q" [?\M-=]) 135;;(define-key iris-function-map "^H" [<del>])
136;;(define-key iris-function-map "^H" [S-<del>])
137;;(define-key iris-function-map "\177" [C-<del>])
138;;(define-key iris-function-map "\e[071q" [M-<del>])
137 139
138 ;; I don't know what to do with those. 140(define-key iris-function-map "\e[Z" [?\S-\t])
139 ;;(define-key iris-function-map "^H" [<del>]) 141(define-key iris-function-map "\e[072q" [?\C-\t])
140 ;;(define-key iris-function-map "^H" [S-<del>]) 142;; This only works if you remove the M-TAB keybing from the system.4Dwmrc
141 ;;(define-key iris-function-map "\177" [C-<del>]) 143;; our your ~/.4Dwmrc, if you use the 4Dwm window manager.
142 ;;(define-key iris-function-map "\e[071q" [M-<del>]) 144(define-key iris-function-map "\e[073q" [?\M-\t])
143 145
144 (define-key iris-function-map "\e[Z" [?\S-\t]) 146(define-key iris-function-map "\e[074q" [?\M-q])
145 (define-key iris-function-map "\e[072q" [?\C-\t])
146 ;; This only works if you remove the M-TAB keybing from the system.4Dwmrc
147 ;; our your ~/.4Dwmrc, if you use the 4Dwm window manager.
148 (define-key iris-function-map "\e[073q" [?\M-\t])
149 147
150 (define-key iris-function-map "\e[074q" [?\M-q]) 148(define-key iris-function-map "\e[075q" [?\M-w])
151 149
152 (define-key iris-function-map "\e[075q" [?\M-w]) 150(define-key iris-function-map "\e[076q" [?\M-e])
153 151
154 (define-key iris-function-map "\e[076q" [?\M-e]) 152(define-key iris-function-map "\e[077q" [?\M-r])
155 153
156 (define-key iris-function-map "\e[077q" [?\M-r]) 154(define-key iris-function-map "\e[078q" [?\M-t])
157 155
158 (define-key iris-function-map "\e[078q" [?\M-t]) 156(define-key iris-function-map "\e[079q" [?\M-y])
159 157
160 (define-key iris-function-map "\e[079q" [?\M-y]) 158(define-key iris-function-map "\e[080q" [?\M-u])
161 159
162 (define-key iris-function-map "\e[080q" [?\M-u]) 160(define-key iris-function-map "\e[081q" [?\M-i])
163 161
164 (define-key iris-function-map "\e[081q" [?\M-i]) 162(define-key iris-function-map "\e[082q" [?\M-o])
165 163
166 (define-key iris-function-map "\e[082q" [?\M-o]) 164(define-key iris-function-map "\e[083q" [?\M-p])
167 165
168 (define-key iris-function-map "\e[083q" [?\M-p]) 166(define-key iris-function-map "\e[084q" [?\M-\[])
169 167
170 (define-key iris-function-map "\e[084q" [?\M-\[]) 168(define-key iris-function-map "\e[085q" [?\M-\]])
171 169
172 (define-key iris-function-map "\e[085q" [?\M-\]]) 170(define-key iris-function-map "\e[086q" [?\M-\\])
173 171
174 (define-key iris-function-map "\e[086q" [?\M-\\]) 172(define-key iris-function-map "\e[087q" [?\M-a])
175 173
176 (define-key iris-function-map "\e[087q" [?\M-a]) 174(define-key iris-function-map "\e[088q" [?\M-s])
177 175
178 (define-key iris-function-map "\e[088q" [?\M-s]) 176(define-key iris-function-map "\e[089q" [?\M-d])
179 177
180 (define-key iris-function-map "\e[089q" [?\M-d]) 178(define-key iris-function-map "\e[090q" [?\M-f])
181 179
182 (define-key iris-function-map "\e[090q" [?\M-f]) 180(define-key iris-function-map "\e[091q" [?\M-g])
183 181
184 (define-key iris-function-map "\e[091q" [?\M-g]) 182(define-key iris-function-map "\e[092q" [?\M-h])
185 183
186 (define-key iris-function-map "\e[092q" [?\M-h]) 184(define-key iris-function-map "\e[093q" [?\M-j])
187 185
188 (define-key iris-function-map "\e[093q" [?\M-j]) 186(define-key iris-function-map "\e[094q" [?\M-k])
189 187
190 (define-key iris-function-map "\e[094q" [?\M-k]) 188(define-key iris-function-map "\e[095q" [?\M-l])
191 189
192 (define-key iris-function-map "\e[095q" [?\M-l]) 190(define-key iris-function-map "\e[096q" [?\C-\;])
193 191(define-key iris-function-map "\e[097q" [?\M-:]) ;; we are cheating
194 (define-key iris-function-map "\e[096q" [?\C-\;])
195 (define-key iris-function-map "\e[097q" [?\M-:]) ;; we are cheating
196 ;; here, this is realy 192 ;; here, this is realy
197 ;; M-;, but M-: 193 ;; M-;, but M-:
198 ;; generates the same 194 ;; generates the same
199 ;; string and is more 195 ;; string and is more
200 ;; usefull. 196 ;; usefull.
201 197
202 (define-key iris-function-map "\e[098q" [?\C-']) 198(define-key iris-function-map "\e[098q" [?\C-'])
203 (define-key iris-function-map "\e[099q" [?\M-']) 199(define-key iris-function-map "\e[099q" [?\M-'])
204 200
205 (define-key iris-function-map "\e[100q" [?\M-\n]) 201(define-key iris-function-map "\e[100q" [?\M-\n])
206 202
207 (define-key iris-function-map "\e[101q" [?\M-z]) 203(define-key iris-function-map "\e[101q" [?\M-z])
208 204
209 (define-key iris-function-map "\e[102q" [?\M-x]) 205(define-key iris-function-map "\e[102q" [?\M-x])
210 206
211 (define-key iris-function-map "\e[103q" [?\M-c]) 207(define-key iris-function-map "\e[103q" [?\M-c])
212 208
213 (define-key iris-function-map "\e[104q" [?\M-v]) 209(define-key iris-function-map "\e[104q" [?\M-v])
214 210
215 (define-key iris-function-map "\e[105q" [?\M-b]) 211(define-key iris-function-map "\e[105q" [?\M-b])
216 212
217 (define-key iris-function-map "\e[106q" [M-n]) 213(define-key iris-function-map "\e[106q" [M-n])
218 214
219 (define-key iris-function-map "\e[107q" [M-m]) 215(define-key iris-function-map "\e[107q" [M-m])
220 216
221 (define-key iris-function-map "\e[108q" [?\C-,]) 217(define-key iris-function-map "\e[108q" [?\C-,])
222 (define-key iris-function-map "\e[109q" [?\M-,]) 218(define-key iris-function-map "\e[109q" [?\M-,])
223 219
224 (define-key iris-function-map "\e[110q" [?\C-.]) 220(define-key iris-function-map "\e[110q" [?\C-.])
225 (define-key iris-function-map "\e[111q" [?\M-.]) 221(define-key iris-function-map "\e[111q" [?\M-.])
226 222
227 (define-key iris-function-map "\e[112q" [?\C-/]) 223(define-key iris-function-map "\e[112q" [?\C-/])
228 (define-key iris-function-map "\e[113q" [?\M-/]) 224(define-key iris-function-map "\e[113q" [?\M-/])
229 225
230 (define-key iris-function-map "\e[139q" [insert]) 226(define-key iris-function-map "\e[139q" [insert])
231 (define-key iris-function-map "\e[139q" [S-insert]) 227(define-key iris-function-map "\e[139q" [S-insert])
232 (define-key iris-function-map "\e[140q" [C-insert]) 228(define-key iris-function-map "\e[140q" [C-insert])
233 (define-key iris-function-map "\e[141q" [M-insert]) 229(define-key iris-function-map "\e[141q" [M-insert])
234 230
235 (define-key iris-function-map "\e[H" [home]) 231(define-key iris-function-map "\e[H" [home])
236 (define-key iris-function-map "\e[143q" [S-home]) 232(define-key iris-function-map "\e[143q" [S-home])
237 (define-key iris-function-map "\e[144q" [C-home]) 233(define-key iris-function-map "\e[144q" [C-home])
238 234
239 235
240 (define-key iris-function-map "\e[150q" [prior]) 236(define-key iris-function-map "\e[150q" [prior])
241 (define-key iris-function-map "\e[151q" [S-prior]) ;; those don't seem 237(define-key iris-function-map "\e[151q" [S-prior]) ;; those don't seem
242 ;; to generate 238 ;; to generate
243 ;; anything 239 ;; anything
244 (define-key iris-function-map "\e[152q" [C-prior]) 240(define-key iris-function-map "\e[152q" [C-prior])
245 241
246 242
247 ;; (define-key iris-function-map "^?" [delete]) ?? something else seems to take care of this. 243;; (define-key iris-function-map "^?" [delete]) ?? something else seems to take care of this.
248 (define-key iris-function-map "\e[P" [S-delete]) 244(define-key iris-function-map "\e[P" [S-delete])
249 (define-key iris-function-map "\e[142q" [C-delete]) 245(define-key iris-function-map "\e[142q" [C-delete])
250 (define-key iris-function-map "\e[M" [M-delete]) 246(define-key iris-function-map "\e[M" [M-delete])
251 247
252 (define-key iris-function-map "\e[146q" [end]) 248(define-key iris-function-map "\e[146q" [end])
253 (define-key iris-function-map "\e[147q" [S-end]) ;; those don't seem to 249(define-key iris-function-map "\e[147q" [S-end]) ;; those don't seem to
254 ;; generate anything 250 ;; generate anything
255 (define-key iris-function-map "\e[148q" [C-end]) 251(define-key iris-function-map "\e[148q" [C-end])
256 252
257 (define-key iris-function-map "\e[154q" [next]) 253(define-key iris-function-map "\e[154q" [next])
258 (define-key iris-function-map "\e[155q" [S-next]) 254(define-key iris-function-map "\e[155q" [S-next])
259 (define-key iris-function-map "\e[156q" [C-next]) 255(define-key iris-function-map "\e[156q" [C-next])
260 256
261 257
262 (define-key iris-function-map "\e[161q" [S-up]) 258(define-key iris-function-map "\e[161q" [S-up])
263 (define-key iris-function-map "\e[162q" [C-up]) 259(define-key iris-function-map "\e[162q" [C-up])
264 (define-key iris-function-map "\e[163q" [M-up]) 260(define-key iris-function-map "\e[163q" [M-up])
265 261
266 (define-key iris-function-map "\e[158q" [S-left]) 262(define-key iris-function-map "\e[158q" [S-left])
267 (define-key iris-function-map "\e[159q" [C-left]) 263(define-key iris-function-map "\e[159q" [C-left])
268 (define-key iris-function-map "\e[160q" [M-left]) 264(define-key iris-function-map "\e[160q" [M-left])
269 265
270 (define-key iris-function-map "\e[164q" [S-down]) 266(define-key iris-function-map "\e[164q" [S-down])
271 (define-key iris-function-map "\e[165q" [C-down]) 267(define-key iris-function-map "\e[165q" [C-down])
272 (define-key iris-function-map "\e[166q" [M-down]) 268(define-key iris-function-map "\e[166q" [M-down])
273 269
274 (define-key iris-function-map "\e[167q" [S-right]) 270(define-key iris-function-map "\e[167q" [S-right])
275 (define-key iris-function-map "\e[168q" [C-right]) 271(define-key iris-function-map "\e[168q" [C-right])
276 (define-key iris-function-map "\e[169q" [M-right]) 272(define-key iris-function-map "\e[169q" [M-right])
277 273
278 ;; Keypad functions, most of those are untested. 274;; Keypad functions, most of those are untested.
279 (define-key iris-function-map "\e[179q" [?\C-/]) 275(define-key iris-function-map "\e[179q" [?\C-/])
280 (define-key iris-function-map "\e[180q" [?\M-/]) 276(define-key iris-function-map "\e[180q" [?\M-/])
281 277
282 (define-key iris-function-map "\e[187q" [?\C-*]) 278(define-key iris-function-map "\e[187q" [?\C-*])
283 (define-key iris-function-map "\e[188q" [?\M-*]) 279(define-key iris-function-map "\e[188q" [?\M-*])
284 280
285 (define-key iris-function-map "\e[198q" [?\C--]) 281(define-key iris-function-map "\e[198q" [?\C--])
286 (define-key iris-function-map "\e[199q" [?\M--]) 282(define-key iris-function-map "\e[199q" [?\M--])
287 283
288 ;; Something else takes care of home, up, prior, down, left, right, next 284;; Something else takes care of home, up, prior, down, left, right, next
289 ;(define-key iris-function-map "\e[H" [home]) 285;(define-key iris-function-map "\e[H" [home])
290 (define-key iris-function-map "\e[172q" [C-home]) 286(define-key iris-function-map "\e[172q" [C-home])
291 287
292 ;(define-key iris-function-map "\e[A" [up]) 288;(define-key iris-function-map "\e[A" [up])
293 (define-key iris-function-map "\e[182q" [C-up]) 289(define-key iris-function-map "\e[182q" [C-up])
294 290
295 291
296 ;(define-key iris-function-map "\e[150q" [prior]) 292;(define-key iris-function-map "\e[150q" [prior])
297 (define-key iris-function-map "\e[190q" [C-prior]) 293(define-key iris-function-map "\e[190q" [C-prior])
298 294
299 295
300 (define-key iris-function-map "\e[200q" [?\C-+]) 296(define-key iris-function-map "\e[200q" [?\C-+])
301 (define-key iris-function-map "\e[201q" [?\M-+]) 297(define-key iris-function-map "\e[201q" [?\M-+])
302 298
303 ;(define-key iris-function-map "\e[D" [left]) 299;(define-key iris-function-map "\e[D" [left])
304 (define-key iris-function-map "\e[174q" [C-left]) 300(define-key iris-function-map "\e[174q" [C-left])
305 301
306 302
307 (define-key iris-function-map "\e[000q" [begin]) 303(define-key iris-function-map "\e[000q" [begin])
308 (define-key iris-function-map "\e[184q" [C-begin]) 304(define-key iris-function-map "\e[184q" [C-begin])
309 305
310 306
311 ;(define-key iris-function-map "\e[C" [right]) 307;(define-key iris-function-map "\e[C" [right])
312 (define-key iris-function-map "\e[192q" [C-right]) 308(define-key iris-function-map "\e[192q" [C-right])
313 309
314 ;(define-key iris-function-map "\e[146q" [end]) 310;(define-key iris-function-map "\e[146q" [end])
315 (define-key iris-function-map "\e[176q" [C-end]) 311(define-key iris-function-map "\e[176q" [C-end])
316 312
317 ;(define-key iris-function-map "\e[B" [down]) 313;(define-key iris-function-map "\e[B" [down])
318 (define-key iris-function-map "\e[186q" [C-down]) 314(define-key iris-function-map "\e[186q" [C-down])
319 315
320 ;(define-key iris-function-map "\e[154q" [next]) 316;(define-key iris-function-map "\e[154q" [next])
321 (define-key iris-function-map "\e[194q" [C-next]) 317(define-key iris-function-map "\e[194q" [C-next])
322 318
323 319
324 (define-key iris-function-map "\e[100q" [M-enter]) 320(define-key iris-function-map "\e[100q" [M-enter])
325 321
326 (define-key iris-function-map "\e[139q" [insert]) 322(define-key iris-function-map "\e[139q" [insert])
327 (define-key iris-function-map "\e[178q" [C-inset]) 323(define-key iris-function-map "\e[178q" [C-inset])
328 324
329 (define-key iris-function-map "\e[P" [delete]) 325(define-key iris-function-map "\e[P" [delete])
330 (define-key iris-function-map "\e[196q" [C-delete]) 326(define-key iris-function-map "\e[196q" [C-delete])
331 (define-key iris-function-map "\e[197q" [M-delete])) 327(define-key iris-function-map "\e[197q" [M-delete])
332 328
333(defun terminal-init-iris-ansi () 329(defun terminal-init-iris-ansi ()
334 "Terminal initialization function for iris-ansi." 330 "Terminal initialization function for iris-ansi."
335 ;; The terminal-local stuff only need to be set up on the first 331 ;; Use inheritance to let the main keymap override these defaults.
336 ;; frame on that device. 332 ;; This way we don't override terminfo-derived settings or settings
337 (when (eq 1 (length (frames-on-display-list))) 333 ;; made in the .emacs file.
338 ;; Use inheritance to let the main keymap override these defaults. 334 (let ((m (copy-keymap iris-function-map)))
339 ;; This way we don't override terminfo-derived settings or settings 335 (set-keymap-parent m (keymap-parent local-function-key-map))
340 ;; made in the .emacs file. 336 (set-keymap-parent local-function-key-map m)))
341 (let ((m (copy-keymap iris-function-map)))
342 (set-keymap-parent m (keymap-parent local-function-key-map))
343 (set-keymap-parent local-function-key-map m))))
344 337
345;;; arch-tag: b1d0e73a-bb7d-47be-9fb2-6fb126469a1b 338;;; arch-tag: b1d0e73a-bb7d-47be-9fb2-6fb126469a1b
346;;; iris-ansi.el ends here 339;;; iris-ansi.el ends here
diff --git a/lisp/term/lk201.el b/lisp/term/lk201.el
index 45271bca700..dad42d8f68f 100644
--- a/lisp/term/lk201.el
+++ b/lisp/term/lk201.el
@@ -1,91 +1,83 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2;; Define function key sequences for DEC terminals. 2;; Define function key sequences for DEC terminals.
3 3
4(defvar lk201-function-map nil 4(defvar lk201-function-map (make-sparse-keymap)
5 "Function key definitions for DEC terminals.") 5 "Function key definitions for DEC terminals.")
6 6
7;; Make reloads faster. 7;; Termcap or terminfo should set these.
8(unless lk201-function-map 8;; (define-key lk201-function-map "\e[A" [up])
9 (setq lk201-function-map (make-sparse-keymap)) 9;; (define-key lk201-function-map "\e[B" [down])
10;; (define-key lk201-function-map "\e[C" [right])
11;; (define-key lk201-function-map "\e[D" [left])
10 12
11 ;; Termcap or terminfo should set these. 13(define-key lk201-function-map "\e[1~" [find])
12 ;; (define-key lk201-function-map "\e[A" [up]) 14(define-key lk201-function-map "\e[2~" [insert])
13 ;; (define-key lk201-function-map "\e[B" [down]) 15(define-key lk201-function-map "\e[3~" [delete])
14 ;; (define-key lk201-function-map "\e[C" [right]) 16(define-key lk201-function-map "\e[4~" [select])
15 ;; (define-key lk201-function-map "\e[D" [left]) 17(define-key lk201-function-map "\e[5~" [prior])
18(define-key lk201-function-map "\e[6~" [next])
19(define-key lk201-function-map "\e[11~" [f1])
20(define-key lk201-function-map "\e[12~" [f2])
21(define-key lk201-function-map "\e[13~" [f3])
22(define-key lk201-function-map "\e[14~" [f4])
23(define-key lk201-function-map "\e[15~" [f5])
24(define-key lk201-function-map "\e[17~" [f6])
25(define-key lk201-function-map "\e[18~" [f7])
26(define-key lk201-function-map "\e[19~" [f8])
27(define-key lk201-function-map "\e[20~" [f9])
28(define-key lk201-function-map "\e[21~" [f10])
29;; Customarily F11 is used as the ESC key.
30;; The file that includes this one, takes care of that.
31(define-key lk201-function-map "\e[23~" [f11])
32(define-key lk201-function-map "\e[24~" [f12])
33(define-key lk201-function-map "\e[25~" [f13])
34(define-key lk201-function-map "\e[26~" [f14])
35(define-key lk201-function-map "\e[28~" [help])
36(define-key lk201-function-map "\e[29~" [menu])
37(define-key lk201-function-map "\e[31~" [f17])
38(define-key lk201-function-map "\e[32~" [f18])
39(define-key lk201-function-map "\e[33~" [f19])
40(define-key lk201-function-map "\e[34~" [f20])
16 41
17 (define-key lk201-function-map "\e[1~" [find]) 42;; Termcap or terminfo should set these.
18 (define-key lk201-function-map "\e[2~" [insert]) 43;; (define-key lk201-function-map "\eOA" [up])
19 (define-key lk201-function-map "\e[3~" [delete]) 44;; (define-key lk201-function-map "\eOB" [down])
20 (define-key lk201-function-map "\e[4~" [select]) 45;; (define-key lk201-function-map "\eOC" [right])
21 (define-key lk201-function-map "\e[5~" [prior]) 46;; (define-key lk201-function-map "\eOD" [left])
22 (define-key lk201-function-map "\e[6~" [next])
23 (define-key lk201-function-map "\e[11~" [f1])
24 (define-key lk201-function-map "\e[12~" [f2])
25 (define-key lk201-function-map "\e[13~" [f3])
26 (define-key lk201-function-map "\e[14~" [f4])
27 (define-key lk201-function-map "\e[15~" [f5])
28 (define-key lk201-function-map "\e[17~" [f6])
29 (define-key lk201-function-map "\e[18~" [f7])
30 (define-key lk201-function-map "\e[19~" [f8])
31 (define-key lk201-function-map "\e[20~" [f9])
32 (define-key lk201-function-map "\e[21~" [f10])
33 ;; Customarily F11 is used as the ESC key.
34 ;; The file that includes this one, takes care of that.
35 (define-key lk201-function-map "\e[23~" [f11])
36 (define-key lk201-function-map "\e[24~" [f12])
37 (define-key lk201-function-map "\e[25~" [f13])
38 (define-key lk201-function-map "\e[26~" [f14])
39 (define-key lk201-function-map "\e[28~" [help])
40 (define-key lk201-function-map "\e[29~" [menu])
41 (define-key lk201-function-map "\e[31~" [f17])
42 (define-key lk201-function-map "\e[32~" [f18])
43 (define-key lk201-function-map "\e[33~" [f19])
44 (define-key lk201-function-map "\e[34~" [f20])
45 47
46 ;; Termcap or terminfo should set these. 48;; Termcap or terminfo should set these, but doesn't properly.
47 ;; (define-key lk201-function-map "\eOA" [up]) 49;; Termcap sets these to k1-k4, which get mapped to f1-f4 in term.c
48 ;; (define-key lk201-function-map "\eOB" [down]) 50(define-key lk201-function-map "\eOP" [kp-f1])
49 ;; (define-key lk201-function-map "\eOC" [right]) 51(define-key lk201-function-map "\eOQ" [kp-f2])
50 ;; (define-key lk201-function-map "\eOD" [left]) 52(define-key lk201-function-map "\eOR" [kp-f3])
53(define-key lk201-function-map "\eOS" [kp-f4])
51 54
52 ;; Termcap or terminfo should set these, but doesn't properly. 55(define-key lk201-function-map "\eOI" [kp-tab])
53 ;; Termcap sets these to k1-k4, which get mapped to f1-f4 in term.c 56(define-key lk201-function-map "\eOj" [kp-multiply])
54 (define-key lk201-function-map "\eOP" [kp-f1]) 57(define-key lk201-function-map "\eOk" [kp-add])
55 (define-key lk201-function-map "\eOQ" [kp-f2]) 58(define-key lk201-function-map "\eOl" [kp-separator])
56 (define-key lk201-function-map "\eOR" [kp-f3]) 59(define-key lk201-function-map "\eOM" [kp-enter])
57 (define-key lk201-function-map "\eOS" [kp-f4]) 60(define-key lk201-function-map "\eOm" [kp-subtract])
58 61(define-key lk201-function-map "\eOn" [kp-decimal])
59 (define-key lk201-function-map "\eOI" [kp-tab]) 62(define-key lk201-function-map "\eOo" [kp-divide])
60 (define-key lk201-function-map "\eOj" [kp-multiply]) 63(define-key lk201-function-map "\eOp" [kp-0])
61 (define-key lk201-function-map "\eOk" [kp-add]) 64(define-key lk201-function-map "\eOq" [kp-1])
62 (define-key lk201-function-map "\eOl" [kp-separator]) 65(define-key lk201-function-map "\eOr" [kp-2])
63 (define-key lk201-function-map "\eOM" [kp-enter]) 66(define-key lk201-function-map "\eOs" [kp-3])
64 (define-key lk201-function-map "\eOm" [kp-subtract]) 67(define-key lk201-function-map "\eOt" [kp-4])
65 (define-key lk201-function-map "\eOn" [kp-decimal]) 68(define-key lk201-function-map "\eOu" [kp-5])
66 (define-key lk201-function-map "\eOo" [kp-divide]) 69(define-key lk201-function-map "\eOv" [kp-6])
67 (define-key lk201-function-map "\eOp" [kp-0]) 70(define-key lk201-function-map "\eOw" [kp-7])
68 (define-key lk201-function-map "\eOq" [kp-1]) 71(define-key lk201-function-map "\eOx" [kp-8])
69 (define-key lk201-function-map "\eOr" [kp-2]) 72(define-key lk201-function-map "\eOy" [kp-9]))
70 (define-key lk201-function-map "\eOs" [kp-3])
71 (define-key lk201-function-map "\eOt" [kp-4])
72 (define-key lk201-function-map "\eOu" [kp-5])
73 (define-key lk201-function-map "\eOv" [kp-6])
74 (define-key lk201-function-map "\eOw" [kp-7])
75 (define-key lk201-function-map "\eOx" [kp-8])
76 (define-key lk201-function-map "\eOy" [kp-9]))
77 73
78(defun terminal-init-lk201 () 74(defun terminal-init-lk201 ()
79 ;; The terminal-local stuff only need to be set up on the first 75 ;; Use inheritance to let the main keymap override these defaults.
80 ;; frame on that device. 76 ;; This way we don't override terminfo-derived settings or settings
81 (when (eq 1 (length (frames-on-display-list))) 77 ;; made in the .emacs file.
82 78 (let ((m (copy-keymap lk201-function-map)))
83 ;; Use inheritance to let the main keymap override these defaults. 79 (set-keymap-parent m (keymap-parent local-function-key-map))
84 ;; This way we don't override terminfo-derived settings or settings 80 (set-keymap-parent local-function-key-map m)))
85 ;; made in the .emacs file.
86 (let ((m (copy-keymap lk201-function-map)))
87 (set-keymap-parent m (keymap-parent local-function-key-map))
88 (set-keymap-parent local-function-key-map m))))
89 81
90;;; arch-tag: 7ffb4444-6a23-43e1-b457-43cf4f673c0d 82;;; arch-tag: 7ffb4444-6a23-43e1-b457-43cf4f673c0d
91;;; lk201.el ends here 83;;; lk201.el ends here
diff --git a/lisp/term/news.el b/lisp/term/news.el
index eaf662c8cfc..6fd39d24210 100644
--- a/lisp/term/news.el
+++ b/lisp/term/news.el
@@ -31,10 +31,8 @@
31 31
32(defun terminal-init-news () 32(defun terminal-init-news ()
33 "Terminal initialization function for news." 33 "Terminal initialization function for news."
34 (if (boundp 'news-fkey-prefix) 34 ;; The terminal initialization should already have set up some keys
35 nil 35 (let ((news-fkey-prefix (lookup-key local-function-key-map "\eO")))
36 ;; The terminal initialization should already have set up some keys
37 (setq news-fkey-prefix (lookup-key local-function-key-map "\eO"))
38 (if (not (keymapp news-fkey-prefix)) 36 (if (not (keymapp news-fkey-prefix))
39 (error "What? Your news termcap/terminfo has no keycaps in it")) 37 (error "What? Your news termcap/terminfo has no keycaps in it"))
40 38
diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el
index fe29b87f2e6..cd8160c507c 100644
--- a/lisp/term/rxvt.el
+++ b/lisp/term/rxvt.el
@@ -26,149 +26,142 @@
26 26
27;;; Code: 27;;; Code:
28 28
29(defvar rxvt-function-map nil 29(defvar rxvt-function-map (make-sparse-keymap)
30 "Function key overrides for rxvt.") 30 "Function key overrides for rxvt.")
31 31
32;; Protect against reloads. 32;; Set up function-key-map entries that termcap and terminfo don't know.
33(unless rxvt-function-map 33(define-key rxvt-function-map "\e[A" [up])
34 (setq rxvt-function-map (make-sparse-keymap)) 34(define-key rxvt-function-map "\e[B" [down])
35(define-key rxvt-function-map "\e[C" [right])
36(define-key rxvt-function-map "\e[D" [left])
37(define-key rxvt-function-map "\e[2~" [insert])
38(define-key rxvt-function-map "\e[3~" [delete])
39(define-key rxvt-function-map "\e[4~" [select])
40(define-key rxvt-function-map "\e[5~" [prior])
41(define-key rxvt-function-map "\e[6~" [next])
42(define-key rxvt-function-map "\e[7~" [home])
43(define-key rxvt-function-map "\e[8~" [end])
44(define-key rxvt-function-map "\e[11~" [f1])
45(define-key rxvt-function-map "\e[12~" [f2])
46(define-key rxvt-function-map "\e[13~" [f3])
47(define-key rxvt-function-map "\e[14~" [f4])
48(define-key rxvt-function-map "\e[15~" [f5])
49(define-key rxvt-function-map "\e[17~" [f6])
50(define-key rxvt-function-map "\e[18~" [f7])
51(define-key rxvt-function-map "\e[19~" [f8])
52(define-key rxvt-function-map "\e[20~" [f9])
53(define-key rxvt-function-map "\e[21~" [f10])
54;; The strings emitted by f11 and f12 are the same as the strings
55;; emitted by S-f1 and S-f2, so don't define f11 and f12.
56;; (define-key rxvt-function-map "\e[23~" [f11])
57;; (define-key rxvt-function-map "\e[24~" [f12])
58(define-key rxvt-function-map "\e[29~" [print])
35 59
36 ;; Set up function-key-map entries that termcap and terminfo don't know. 60(define-key rxvt-function-map "\e[11^" [C-f1])
37 (define-key rxvt-function-map "\e[A" [up]) 61(define-key rxvt-function-map "\e[12^" [C-f2])
38 (define-key rxvt-function-map "\e[B" [down]) 62(define-key rxvt-function-map "\e[13^" [C-f3])
39 (define-key rxvt-function-map "\e[C" [right]) 63(define-key rxvt-function-map "\e[14^" [C-f4])
40 (define-key rxvt-function-map "\e[D" [left]) 64(define-key rxvt-function-map "\e[15^" [C-f5])
41 (define-key rxvt-function-map "\e[2~" [insert]) 65(define-key rxvt-function-map "\e[17^" [C-f6])
42 (define-key rxvt-function-map "\e[3~" [delete]) 66(define-key rxvt-function-map "\e[18^" [C-f7])
43 (define-key rxvt-function-map "\e[4~" [select]) 67(define-key rxvt-function-map "\e[19^" [C-f8])
44 (define-key rxvt-function-map "\e[5~" [prior]) 68(define-key rxvt-function-map "\e[20^" [C-f9])
45 (define-key rxvt-function-map "\e[6~" [next]) 69(define-key rxvt-function-map "\e[21^" [C-f10])
46 (define-key rxvt-function-map "\e[7~" [home])
47 (define-key rxvt-function-map "\e[8~" [end])
48 (define-key rxvt-function-map "\e[11~" [f1])
49 (define-key rxvt-function-map "\e[12~" [f2])
50 (define-key rxvt-function-map "\e[13~" [f3])
51 (define-key rxvt-function-map "\e[14~" [f4])
52 (define-key rxvt-function-map "\e[15~" [f5])
53 (define-key rxvt-function-map "\e[17~" [f6])
54 (define-key rxvt-function-map "\e[18~" [f7])
55 (define-key rxvt-function-map "\e[19~" [f8])
56 (define-key rxvt-function-map "\e[20~" [f9])
57 (define-key rxvt-function-map "\e[21~" [f10])
58 ;; The strings emitted by f11 and f12 are the same as the strings
59 ;; emitted by S-f1 and S-f2, so don't define f11 and f12.
60 ;; (define-key rxvt-function-map "\e[23~" [f11])
61 ;; (define-key rxvt-function-map "\e[24~" [f12])
62 (define-key rxvt-function-map "\e[29~" [print])
63 70
64 (define-key rxvt-function-map "\e[11^" [C-f1]) 71(define-key rxvt-function-map "\e[23~" [S-f1])
65 (define-key rxvt-function-map "\e[12^" [C-f2]) 72(define-key rxvt-function-map "\e[24~" [S-f2])
66 (define-key rxvt-function-map "\e[13^" [C-f3]) 73(define-key rxvt-function-map "\e[25~" [S-f3])
67 (define-key rxvt-function-map "\e[14^" [C-f4]) 74(define-key rxvt-function-map "\e[26~" [S-f4])
68 (define-key rxvt-function-map "\e[15^" [C-f5]) 75(define-key rxvt-function-map "\e[28~" [S-f5])
69 (define-key rxvt-function-map "\e[17^" [C-f6]) 76(define-key rxvt-function-map "\e[29~" [S-f6])
70 (define-key rxvt-function-map "\e[18^" [C-f7]) 77(define-key rxvt-function-map "\e[31~" [S-f7])
71 (define-key rxvt-function-map "\e[19^" [C-f8]) 78(define-key rxvt-function-map "\e[32~" [S-f8])
72 (define-key rxvt-function-map "\e[20^" [C-f9]) 79(define-key rxvt-function-map "\e[33~" [S-f9])
73 (define-key rxvt-function-map "\e[21^" [C-f10]) 80(define-key rxvt-function-map "\e[34~" [S-f10])
74 81
75 (define-key rxvt-function-map "\e[23~" [S-f1]) 82(define-key rxvt-function-map "\e[23^" [C-S-f1])
76 (define-key rxvt-function-map "\e[24~" [S-f2]) 83(define-key rxvt-function-map "\e[24^" [C-S-f2])
77 (define-key rxvt-function-map "\e[25~" [S-f3]) 84(define-key rxvt-function-map "\e[25^" [C-S-f3])
78 (define-key rxvt-function-map "\e[26~" [S-f4]) 85(define-key rxvt-function-map "\e[26^" [C-S-f4])
79 (define-key rxvt-function-map "\e[28~" [S-f5]) 86(define-key rxvt-function-map "\e[28^" [C-S-f5])
80 (define-key rxvt-function-map "\e[29~" [S-f6]) 87(define-key rxvt-function-map "\e[29^" [C-S-f6])
81 (define-key rxvt-function-map "\e[31~" [S-f7]) 88(define-key rxvt-function-map "\e[31^" [C-S-f7])
82 (define-key rxvt-function-map "\e[32~" [S-f8]) 89(define-key rxvt-function-map "\e[32^" [C-S-f8])
83 (define-key rxvt-function-map "\e[33~" [S-f9]) 90(define-key rxvt-function-map "\e[33^" [C-S-f9])
84 (define-key rxvt-function-map "\e[34~" [S-f10]) 91(define-key rxvt-function-map "\e[34^" [C-S-f10])
85 92
86 (define-key rxvt-function-map "\e[23^" [C-S-f1]) 93(define-key rxvt-function-map "\e[2^" [C-insert])
87 (define-key rxvt-function-map "\e[24^" [C-S-f2]) 94(define-key rxvt-function-map "\e[3^" [C-delete])
88 (define-key rxvt-function-map "\e[25^" [C-S-f3]) 95(define-key rxvt-function-map "\e[5^" [C-prior])
89 (define-key rxvt-function-map "\e[26^" [C-S-f4]) 96(define-key rxvt-function-map "\e[6^" [C-next])
90 (define-key rxvt-function-map "\e[28^" [C-S-f5]) 97(define-key rxvt-function-map "\e[7^" [C-home])
91 (define-key rxvt-function-map "\e[29^" [C-S-f6]) 98(define-key rxvt-function-map "\e[8^" [C-end])
92 (define-key rxvt-function-map "\e[31^" [C-S-f7]) 99(define-key rxvt-function-map "\eOd" [C-left])
93 (define-key rxvt-function-map "\e[32^" [C-S-f8]) 100(define-key rxvt-function-map "\eOc" [C-right])
94 (define-key rxvt-function-map "\e[33^" [C-S-f9]) 101(define-key rxvt-function-map "\eOa" [C-up])
95 (define-key rxvt-function-map "\e[34^" [C-S-f10]) 102(define-key rxvt-function-map "\eOb" [C-down])
96 103
97 (define-key rxvt-function-map "\e[2^" [C-insert]) 104(define-key rxvt-function-map "\e[2;2~" [S-insert])
98 (define-key rxvt-function-map "\e[3^" [C-delete]) 105(define-key rxvt-function-map "\e[3$" [S-delete])
99 (define-key rxvt-function-map "\e[5^" [C-prior]) 106(define-key rxvt-function-map "\e[5$" [S-prior])
100 (define-key rxvt-function-map "\e[6^" [C-next]) 107(define-key rxvt-function-map "\e[6$" [S-next])
101 (define-key rxvt-function-map "\e[7^" [C-home]) 108(define-key rxvt-function-map "\e[7$" [S-home])
102 (define-key rxvt-function-map "\e[8^" [C-end]) 109(define-key rxvt-function-map "\e[8$" [S-end])
103 (define-key rxvt-function-map "\eOd" [C-left]) 110(define-key rxvt-function-map "\e[d" [S-left])
104 (define-key rxvt-function-map "\eOc" [C-right]) 111(define-key rxvt-function-map "\e[c" [S-right])
105 (define-key rxvt-function-map "\eOa" [C-up]) 112(define-key rxvt-function-map "\e[a" [S-up])
106 (define-key rxvt-function-map "\eOb" [C-down]) 113(define-key rxvt-function-map "\e[b" [S-down])
107
108 (define-key rxvt-function-map "\e[2;2~" [S-insert])
109 (define-key rxvt-function-map "\e[3$" [S-delete])
110 (define-key rxvt-function-map "\e[5$" [S-prior])
111 (define-key rxvt-function-map "\e[6$" [S-next])
112 (define-key rxvt-function-map "\e[7$" [S-home])
113 (define-key rxvt-function-map "\e[8$" [S-end])
114 (define-key rxvt-function-map "\e[d" [S-left])
115 (define-key rxvt-function-map "\e[c" [S-right])
116 (define-key rxvt-function-map "\e[a" [S-up])
117 (define-key rxvt-function-map "\e[b" [S-down]))
118 114
119(defun terminal-init-rxvt () 115(defun terminal-init-rxvt ()
120 "Terminal initialization function for rxvt." 116 "Terminal initialization function for rxvt."
121 117
122 ;; The terminal-local stuff only need to be set up on the first 118 ;; The terminal intialization C code file might have initialized
123 ;; frame on that device. 119 ;; function keys F11->F42 from the termcap/terminfo information. On
124 (when (eq 1 (length (frames-on-display-list))) 120 ;; a PC-style keyboard these keys correspond to
125 ;; The terminal intialization C code file might have initialized 121 ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C-, C-S-. The
126 ;; function keys F11->F42 from the termcap/terminfo information. On 122 ;; code here subsitutes the corresponding defintions in
127 ;; a PC-style keyboard these keys correspond to 123 ;; function-key-map. This substitution is needed because if a key
128 ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C-, C-S-. The 124 ;; definition if found in function-key-map, there are no further
129 ;; code here subsitutes the corresponding defintions in 125 ;; lookups in other keymaps.
130 ;; function-key-map. This substitution is needed because if a key 126 (substitute-key-definition [f11] [S-f1] local-function-key-map)
131 ;; definition if found in function-key-map, there are no further 127 (substitute-key-definition [f12] [S-f2] local-function-key-map)
132 ;; lookups in other keymaps. 128 (substitute-key-definition [f13] [S-f3] local-function-key-map)
133 (substitute-key-definition [f11] [S-f1] local-function-key-map) 129 (substitute-key-definition [f14] [S-f4] local-function-key-map)
134 (substitute-key-definition [f12] [S-f2] local-function-key-map) 130 (substitute-key-definition [f15] [S-f5] local-function-key-map)
135 (substitute-key-definition [f13] [S-f3] local-function-key-map) 131 (substitute-key-definition [f16] [S-f6] local-function-key-map)
136 (substitute-key-definition [f14] [S-f4] local-function-key-map) 132 (substitute-key-definition [f17] [S-f7] local-function-key-map)
137 (substitute-key-definition [f15] [S-f5] local-function-key-map) 133 (substitute-key-definition [f18] [S-f8] local-function-key-map)
138 (substitute-key-definition [f16] [S-f6] local-function-key-map) 134 (substitute-key-definition [f19] [S-f9] local-function-key-map)
139 (substitute-key-definition [f17] [S-f7] local-function-key-map) 135 (substitute-key-definition [f20] [S-f10] local-function-key-map)
140 (substitute-key-definition [f18] [S-f8] local-function-key-map)
141 (substitute-key-definition [f19] [S-f9] local-function-key-map)
142 (substitute-key-definition [f20] [S-f10] local-function-key-map)
143 136
144 (substitute-key-definition [f23] [C-f1] local-function-key-map) 137 (substitute-key-definition [f23] [C-f1] local-function-key-map)
145 (substitute-key-definition [f24] [C-f2] local-function-key-map) 138 (substitute-key-definition [f24] [C-f2] local-function-key-map)
146 (substitute-key-definition [f25] [C-f3] local-function-key-map) 139 (substitute-key-definition [f25] [C-f3] local-function-key-map)
147 (substitute-key-definition [f26] [C-f4] local-function-key-map) 140 (substitute-key-definition [f26] [C-f4] local-function-key-map)
148 (substitute-key-definition [f27] [C-f5] local-function-key-map) 141 (substitute-key-definition [f27] [C-f5] local-function-key-map)
149 (substitute-key-definition [f28] [C-f6] local-function-key-map) 142 (substitute-key-definition [f28] [C-f6] local-function-key-map)
150 (substitute-key-definition [f29] [C-f7] local-function-key-map) 143 (substitute-key-definition [f29] [C-f7] local-function-key-map)
151 (substitute-key-definition [f30] [C-f8] local-function-key-map) 144 (substitute-key-definition [f30] [C-f8] local-function-key-map)
152 (substitute-key-definition [f31] [C-f9] local-function-key-map) 145 (substitute-key-definition [f31] [C-f9] local-function-key-map)
153 (substitute-key-definition [f32] [C-f10] local-function-key-map) 146 (substitute-key-definition [f32] [C-f10] local-function-key-map)
154 147
155 (substitute-key-definition [f33] [C-S-f1] local-function-key-map) 148 (substitute-key-definition [f33] [C-S-f1] local-function-key-map)
156 (substitute-key-definition [f34] [C-S-f2] local-function-key-map) 149 (substitute-key-definition [f34] [C-S-f2] local-function-key-map)
157 (substitute-key-definition [f35] [C-S-f3] local-function-key-map) 150 (substitute-key-definition [f35] [C-S-f3] local-function-key-map)
158 (substitute-key-definition [f36] [C-S-f4] local-function-key-map) 151 (substitute-key-definition [f36] [C-S-f4] local-function-key-map)
159 (substitute-key-definition [f37] [C-S-f5] local-function-key-map) 152 (substitute-key-definition [f37] [C-S-f5] local-function-key-map)
160 (substitute-key-definition [f38] [C-S-f6] local-function-key-map) 153 (substitute-key-definition [f38] [C-S-f6] local-function-key-map)
161 (substitute-key-definition [f39] [C-S-f7] local-function-key-map) 154 (substitute-key-definition [f39] [C-S-f7] local-function-key-map)
162 (substitute-key-definition [f40] [C-S-f8] local-function-key-map) 155 (substitute-key-definition [f40] [C-S-f8] local-function-key-map)
163 (substitute-key-definition [f41] [C-S-f9] local-function-key-map) 156 (substitute-key-definition [f41] [C-S-f9] local-function-key-map)
164 (substitute-key-definition [f42] [C-S-f10] local-function-key-map) 157 (substitute-key-definition [f42] [C-S-f10] local-function-key-map)
165 158
166 ;; Use inheritance to let the main keymap override those defaults. 159 ;; Use inheritance to let the main keymap override those defaults.
167 ;; This way we don't override terminfo-derived settings or settings 160 ;; This way we don't override terminfo-derived settings or settings
168 ;; made in the .emacs file. 161 ;; made in the .emacs file.
169 (let ((m (copy-keymap rxvt-function-map))) 162 (let ((m (copy-keymap rxvt-function-map)))
170 (set-keymap-parent m (keymap-parent local-function-key-map)) 163 (set-keymap-parent m (keymap-parent local-function-key-map))
171 (set-keymap-parent local-function-key-map m))) 164 (set-keymap-parent local-function-key-map m))
172 165
173 ;; Initialize colors and background mode. 166 ;; Initialize colors and background mode.
174 (rxvt-register-default-colors) 167 (rxvt-register-default-colors)
@@ -250,7 +243,7 @@ for the currently selected frame."
250 (- 256 ncolors) 243 (- 256 ncolors)
251 (list color color color)) 244 (list color color color))
252 (setq ncolors (1- ncolors)))) 245 (setq ncolors (1- ncolors))))
253 246
254 ((= ncolors 72) ; rxvt-unicode 247 ((= ncolors 72) ; rxvt-unicode
255 ;; 64 non-gray colors 248 ;; 64 non-gray colors
256 (let ((levels '(0 139 205 255)) 249 (let ((levels '(0 139 205 255))
@@ -293,7 +286,7 @@ for the currently selected frame."
293 "Set background mode as appropriate for the default rxvt colors." 286 "Set background mode as appropriate for the default rxvt colors."
294 (let ((fgbg (getenv "COLORFGBG" (terminal-id))) 287 (let ((fgbg (getenv "COLORFGBG" (terminal-id)))
295 bg rgb) 288 bg rgb)
296 (setq default-frame-background-mode 'light) 289 (set-terminal-parameter nil 'background-mode 'light)
297 (when (and fgbg 290 (when (and fgbg
298 (string-match ".*;\\([0-9][0-9]?\\)\\'" fgbg)) 291 (string-match ".*;\\([0-9][0-9]?\\)\\'" fgbg))
299 (setq bg (string-to-number (substring fgbg (match-beginning 1)))) 292 (setq bg (string-to-number (substring fgbg (match-beginning 1))))
@@ -306,8 +299,7 @@ for the currently selected frame."
306 ;; The following line assumes that white is the 15th 299 ;; The following line assumes that white is the 15th
307 ;; color in rxvt-standard-colors. 300 ;; color in rxvt-standard-colors.
308 (* (apply '+ (car (cddr (nth 15 rxvt-standard-colors)))) 0.6)) 301 (* (apply '+ (car (cddr (nth 15 rxvt-standard-colors)))) 0.6))
309 (setq default-frame-background-mode 'dark))) 302 (set-terminal-parameter nil 'background-mode 'dark)))))
310 (frame-set-background-mode (selected-frame))))
311 303
312;; arch-tag: 20cf2fb6-6318-4bab-9dbf-1d15048f2257 304;; arch-tag: 20cf2fb6-6318-4bab-9dbf-1d15048f2257
313;;; rxvt.el ends here 305;;; rxvt.el ends here
diff --git a/lisp/term/vt100.el b/lisp/term/vt100.el
index d17f61bc782..be1d8ee1a49 100644
--- a/lisp/term/vt100.el
+++ b/lisp/term/vt100.el
@@ -40,7 +40,7 @@
40 40
41(defun terminal-init-vt100 () 41(defun terminal-init-vt100 ()
42 "Terminal initialization function for vt100." 42 "Terminal initialization function for vt100."
43 (terminal-init-lk201)) 43 (tty-run-terminal-initialization (selected-frame) "lk201"))
44 44
45;;; Controlling the screen width. 45;;; Controlling the screen width.
46(defvar vt100-wide-mode (= (frame-width) 132) 46(defvar vt100-wide-mode (= (frame-width) 132)
diff --git a/lisp/term/vt102.el b/lisp/term/vt102.el
index ba4ac80c92a..67a90a8242c 100644
--- a/lisp/term/vt102.el
+++ b/lisp/term/vt102.el
@@ -1,8 +1,8 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2 2
3(defun terminal-init-vt102 () 3(defun terminal-init-vt102 ()
4 "Terminal initialization function for vt102." 4 "Terminal initialization function for vt102."
5 (terminal-init-vt100)) 5 (tty-run-terminal-initialization (selected-frame) "vt100"))
6 6
7;;; arch-tag: 6e839cfc-125a-4574-82f1-c23a51f7c50f 7;;; arch-tag: 6e839cfc-125a-4574-82f1-c23a51f7c50f
8;;; vt102.el ends here 8;;; vt102.el ends here
diff --git a/lisp/term/vt125.el b/lisp/term/vt125.el
index 369dc5f28b9..82a7047fef1 100644
--- a/lisp/term/vt125.el
+++ b/lisp/term/vt125.el
@@ -1,8 +1,8 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2 2
3(defun terminal-init-vt125 () 3(defun terminal-init-vt125 ()
4 "Terminal initialization function for vt125." 4 "Terminal initialization function for vt125."
5 (terminal-init-vt100)) 5 (tty-run-terminal-initialization (selected-frame) "vt100"))
6 6
7;;; arch-tag: 1d92d70f-dd55-4a1d-9088-e215a4883801 7;;; arch-tag: 1d92d70f-dd55-4a1d-9088-e215a4883801
8;;; vt125.el ends here 8;;; vt125.el ends here
diff --git a/lisp/term/vt200.el b/lisp/term/vt200.el
index fd31fd11263..7e7b3281d92 100644
--- a/lisp/term/vt200.el
+++ b/lisp/term/vt200.el
@@ -3,7 +3,7 @@
3;; Most differences are handled by the termcap entry. 3;; Most differences are handled by the termcap entry.
4(defun terminal-init-vt200 () 4(defun terminal-init-vt200 ()
5 "Terminal initialization function for vt200." 5 "Terminal initialization function for vt200."
6 (terminal-init-vt100) 6 (tty-run-terminal-initialization (selected-frame) "vt100")
7 ;; Make F11 an escape key. 7 ;; Make F11 an escape key.
8 (define-key local-function-key-map "\e[23~" [?\e])) 8 (define-key local-function-key-map "\e[23~" [?\e]))
9 9
diff --git a/lisp/term/vt201.el b/lisp/term/vt201.el
index 95243322403..a63f9561a6d 100644
--- a/lisp/term/vt201.el
+++ b/lisp/term/vt201.el
@@ -3,7 +3,7 @@
3;; Most differences are handled by the termcap entry. 3;; Most differences are handled by the termcap entry.
4(defun terminal-init-vt201 () 4(defun terminal-init-vt201 ()
5 "Terminal initialization function for vt201." 5 "Terminal initialization function for vt201."
6 (terminal-init-vt100) 6 (tty-run-terminal-initialization (selected-frame) "vt100")
7 ;; Make F11 an escape key. 7 ;; Make F11 an escape key.
8 (define-key local-function-key-map "\e[23~" [?\e])) 8 (define-key local-function-key-map "\e[23~" [?\e]))
9 9
diff --git a/lisp/term/vt220.el b/lisp/term/vt220.el
index 7264b7d94a2..b2b8fc944cf 100644
--- a/lisp/term/vt220.el
+++ b/lisp/term/vt220.el
@@ -3,7 +3,7 @@
3;; Most differences are handled by the termcap entry. 3;; Most differences are handled by the termcap entry.
4(defun terminal-init-vt220 () 4(defun terminal-init-vt220 ()
5 "Terminal initialization function for vt220." 5 "Terminal initialization function for vt220."
6 (terminal-init-vt100) 6 (tty-run-terminal-initialization (selected-frame) "vt100")
7 ;; Make F11 an escape key. 7 ;; Make F11 an escape key.
8 (define-key local-function-key-map "\e[23~" [?\e])) 8 (define-key local-function-key-map "\e[23~" [?\e]))
9 9
diff --git a/lisp/term/vt240.el b/lisp/term/vt240.el
index 725e323c00c..cb26ebf4069 100644
--- a/lisp/term/vt240.el
+++ b/lisp/term/vt240.el
@@ -3,7 +3,7 @@
3;; Most differences are handled by the termcap entry. 3;; Most differences are handled by the termcap entry.
4(defun terminal-init-vt240 () 4(defun terminal-init-vt240 ()
5 "Terminal initialization function for vt240." 5 "Terminal initialization function for vt240."
6 (terminal-init-vt100) 6 (tty-run-terminal-initialization (selected-frame) "vt100")
7 ;; Make F11 an escape key. 7 ;; Make F11 an escape key.
8 (define-key local-function-key-map "\e[23~" [?\e])) 8 (define-key local-function-key-map "\e[23~" [?\e]))
9 9
diff --git a/lisp/term/vt300.el b/lisp/term/vt300.el
index fb749277d50..9a09ad5e8cb 100644
--- a/lisp/term/vt300.el
+++ b/lisp/term/vt300.el
@@ -1,7 +1,7 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2(defun terminal-init-vt300 () 2(defun terminal-init-vt300 ()
3 "Terminal initialization function for vt300." 3 "Terminal initialization function for vt300."
4 (terminal-init-vt100) 4 (tty-run-terminal-initialization (selected-frame) "vt100")
5 ;; Make F11 an escape key. 5 ;; Make F11 an escape key.
6 (define-key local-function-key-map "\e[23~" [?\e])) 6 (define-key local-function-key-map "\e[23~" [?\e]))
7 7
diff --git a/lisp/term/vt320.el b/lisp/term/vt320.el
index 3e52d27193b..803d7286067 100644
--- a/lisp/term/vt320.el
+++ b/lisp/term/vt320.el
@@ -1,7 +1,7 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2(defun terminal-init-vt320 () 2(defun terminal-init-vt320 ()
3 "Terminal initialization function for vt320." 3 "Terminal initialization function for vt320."
4 (terminal-init-vt100) 4 (tty-run-terminal-initialization (selected-frame) "vt100")
5 ;; Make F11 an escape key. 5 ;; Make F11 an escape key.
6 (define-key local-function-key-map "\e[23~" [?\e])) 6 (define-key local-function-key-map "\e[23~" [?\e]))
7 7
diff --git a/lisp/term/vt400.el b/lisp/term/vt400.el
index f1c7e3732d3..f73f4660b94 100644
--- a/lisp/term/vt400.el
+++ b/lisp/term/vt400.el
@@ -1,7 +1,7 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2(defun terminal-init-vt400 () 2(defun terminal-init-vt400 ()
3 "Terminal initialization function for vt400." 3 "Terminal initialization function for vt400."
4 (terminal-init-vt100) 4 (tty-run-terminal-initialization (selected-frame) "vt100")
5 ;; Make F11 an escape key. 5 ;; Make F11 an escape key.
6 (define-key local-function-key-map "\e[23~" [?\e])) 6 (define-key local-function-key-map "\e[23~" [?\e]))
7 7
diff --git a/lisp/term/vt420.el b/lisp/term/vt420.el
index 4d3206cbca1..e65ba1a61d5 100644
--- a/lisp/term/vt420.el
+++ b/lisp/term/vt420.el
@@ -1,7 +1,7 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2(defun terminal-init-vt420 2(defun terminal-init-vt420
3 "Terminal initialization function for vt420." 3 "Terminal initialization function for vt420."
4 (terminal-init-vt100) 4 (tty-run-terminal-initialization (selected-frame) "vt100")
5 ;; Make F11 an escape key. 5 ;; Make F11 an escape key.
6 (define-key local-function-key-map "\e[23~" [?\e])) 6 (define-key local-function-key-map "\e[23~" [?\e]))
7 7
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 5a32e7c15e9..9b3ebfe3420 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -27,257 +27,248 @@
27 27
28;;; Code: 28;;; Code:
29 29
30(defvar xterm-function-map nil 30(defvar xterm-function-map (make-sparse-keymap)
31 "Function key map overrides for xterm.") 31 "Function key map overrides for xterm.")
32 32
33;; Make reloads faster. 33;; xterm from X.org 6.8.2 uses these key definitions.
34(unless xterm-function-map 34(define-key xterm-function-map "\eOP" [f1])
35 (setq xterm-function-map (make-sparse-keymap)) 35(define-key xterm-function-map "\eOQ" [f2])
36 ;; xterm from X.org 6.8.2 uses these key definitions. 36(define-key xterm-function-map "\eOR" [f3])
37 (define-key xterm-function-map "\eOP" [f1]) 37(define-key xterm-function-map "\eOS" [f4])
38 (define-key xterm-function-map "\eOQ" [f2]) 38(define-key xterm-function-map "\e[15~" [f5])
39 (define-key xterm-function-map "\eOR" [f3]) 39(define-key xterm-function-map "\e[17~" [f6])
40 (define-key xterm-function-map "\eOS" [f4]) 40(define-key xterm-function-map "\e[18~" [f7])
41 (define-key xterm-function-map "\e[15~" [f5]) 41(define-key xterm-function-map "\e[19~" [f8])
42 (define-key xterm-function-map "\e[17~" [f6]) 42(define-key xterm-function-map "\e[20~" [f9])
43 (define-key xterm-function-map "\e[18~" [f7]) 43(define-key xterm-function-map "\e[21~" [f10])
44 (define-key xterm-function-map "\e[19~" [f8]) 44(define-key xterm-function-map "\e[23~" [f11])
45 (define-key xterm-function-map "\e[20~" [f9]) 45(define-key xterm-function-map "\e[24~" [f12])
46 (define-key xterm-function-map "\e[21~" [f10]) 46
47 (define-key xterm-function-map "\e[23~" [f11]) 47(define-key xterm-function-map "\eO2P" [S-f1])
48 (define-key xterm-function-map "\e[24~" [f12]) 48(define-key xterm-function-map "\eO2Q" [S-f2])
49 49(define-key xterm-function-map "\eO2R" [S-f3])
50 (define-key xterm-function-map "\eO2P" [S-f1]) 50(define-key xterm-function-map "\eO2S" [S-f4])
51 (define-key xterm-function-map "\eO2Q" [S-f2]) 51(define-key xterm-function-map "\e[15;2~" [S-f5])
52 (define-key xterm-function-map "\eO2R" [S-f3]) 52(define-key xterm-function-map "\e[17;2~" [S-f6])
53 (define-key xterm-function-map "\eO2S" [S-f4]) 53(define-key xterm-function-map "\e[18;2~" [S-f7])
54 (define-key xterm-function-map "\e[15;2~" [S-f5]) 54(define-key xterm-function-map "\e[19;2~" [S-f8])
55 (define-key xterm-function-map "\e[17;2~" [S-f6]) 55(define-key xterm-function-map "\e[20;2~" [S-f9])
56 (define-key xterm-function-map "\e[18;2~" [S-f7]) 56(define-key xterm-function-map "\e[21;2~" [S-f10])
57 (define-key xterm-function-map "\e[19;2~" [S-f8]) 57(define-key xterm-function-map "\e[23;2~" [S-f11])
58 (define-key xterm-function-map "\e[20;2~" [S-f9]) 58(define-key xterm-function-map "\e[24;2~" [S-f12])
59 (define-key xterm-function-map "\e[21;2~" [S-f10]) 59
60 (define-key xterm-function-map "\e[23;2~" [S-f11]) 60(define-key xterm-function-map "\eO5P" [C-f1])
61 (define-key xterm-function-map "\e[24;2~" [S-f12]) 61(define-key xterm-function-map "\eO5Q" [C-f2])
62 62(define-key xterm-function-map "\eO5R" [C-f3])
63 (define-key xterm-function-map "\eO5P" [C-f1]) 63(define-key xterm-function-map "\eO5S" [C-f4])
64 (define-key xterm-function-map "\eO5Q" [C-f2]) 64(define-key xterm-function-map "\e[15;5~" [C-f5])
65 (define-key xterm-function-map "\eO5R" [C-f3]) 65(define-key xterm-function-map "\e[17;5~" [C-f6])
66 (define-key xterm-function-map "\eO5S" [C-f4]) 66(define-key xterm-function-map "\e[18;5~" [C-f7])
67 (define-key xterm-function-map "\e[15;5~" [C-f5]) 67(define-key xterm-function-map "\e[19;5~" [C-f8])
68 (define-key xterm-function-map "\e[17;5~" [C-f6]) 68(define-key xterm-function-map "\e[20;5~" [C-f9])
69 (define-key xterm-function-map "\e[18;5~" [C-f7]) 69(define-key xterm-function-map "\e[21;5~" [C-f10])
70 (define-key xterm-function-map "\e[19;5~" [C-f8]) 70(define-key xterm-function-map "\e[23;5~" [C-f11])
71 (define-key xterm-function-map "\e[20;5~" [C-f9]) 71(define-key xterm-function-map "\e[24;5~" [C-f12])
72 (define-key xterm-function-map "\e[21;5~" [C-f10]) 72
73 (define-key xterm-function-map "\e[23;5~" [C-f11]) 73(define-key xterm-function-map "\eO6P" [C-S-f1])
74 (define-key xterm-function-map "\e[24;5~" [C-f12]) 74(define-key xterm-function-map "\eO6Q" [C-S-f2])
75 75(define-key xterm-function-map "\eO6R" [C-S-f3])
76 (define-key xterm-function-map "\eO6P" [C-S-f1]) 76(define-key xterm-function-map "\eO6S" [C-S-f4])
77 (define-key xterm-function-map "\eO6Q" [C-S-f2]) 77(define-key xterm-function-map "\e[15;6~" [C-S-f5])
78 (define-key xterm-function-map "\eO6R" [C-S-f3]) 78(define-key xterm-function-map "\e[17;6~" [C-S-f6])
79 (define-key xterm-function-map "\eO6S" [C-S-f4]) 79(define-key xterm-function-map "\e[18;6~" [C-S-f7])
80 (define-key xterm-function-map "\e[15;6~" [C-S-f5]) 80(define-key xterm-function-map "\e[19;6~" [C-S-f8])
81 (define-key xterm-function-map "\e[17;6~" [C-S-f6]) 81(define-key xterm-function-map "\e[20;6~" [C-S-f9])
82 (define-key xterm-function-map "\e[18;6~" [C-S-f7]) 82(define-key xterm-function-map "\e[21;6~" [C-S-f10])
83 (define-key xterm-function-map "\e[19;6~" [C-S-f8]) 83(define-key xterm-function-map "\e[23;6~" [C-S-f11])
84 (define-key xterm-function-map "\e[20;6~" [C-S-f9]) 84(define-key xterm-function-map "\e[24;6~" [C-S-f12])
85 (define-key xterm-function-map "\e[21;6~" [C-S-f10]) 85
86 (define-key xterm-function-map "\e[23;6~" [C-S-f11]) 86(define-key xterm-function-map "\eO3P" [A-f1])
87 (define-key xterm-function-map "\e[24;6~" [C-S-f12]) 87(define-key xterm-function-map "\eO3Q" [A-f2])
88 88(define-key xterm-function-map "\eO3R" [A-f3])
89 (define-key xterm-function-map "\eO3P" [A-f1]) 89(define-key xterm-function-map "\eO3S" [A-f4])
90 (define-key xterm-function-map "\eO3Q" [A-f2]) 90(define-key xterm-function-map "\e[15;3~" [A-f5])
91 (define-key xterm-function-map "\eO3R" [A-f3]) 91(define-key xterm-function-map "\e[17;3~" [A-f6])
92 (define-key xterm-function-map "\eO3S" [A-f4]) 92(define-key xterm-function-map "\e[18;3~" [A-f7])
93 (define-key xterm-function-map "\e[15;3~" [A-f5]) 93(define-key xterm-function-map "\e[19;3~" [A-f8])
94 (define-key xterm-function-map "\e[17;3~" [A-f6]) 94(define-key xterm-function-map "\e[20;3~" [A-f9])
95 (define-key xterm-function-map "\e[18;3~" [A-f7]) 95(define-key xterm-function-map "\e[21;3~" [A-f10])
96 (define-key xterm-function-map "\e[19;3~" [A-f8]) 96(define-key xterm-function-map "\e[23;3~" [A-f11])
97 (define-key xterm-function-map "\e[20;3~" [A-f9]) 97(define-key xterm-function-map "\e[24;3~" [A-f12])
98 (define-key xterm-function-map "\e[21;3~" [A-f10]) 98
99 (define-key xterm-function-map "\e[23;3~" [A-f11]) 99(define-key xterm-function-map "\eOA" [up])
100 (define-key xterm-function-map "\e[24;3~" [A-f12]) 100(define-key xterm-function-map "\eOB" [down])
101 101(define-key xterm-function-map "\eOC" [right])
102 (define-key xterm-function-map "\eOA" [up]) 102(define-key xterm-function-map "\eOD" [left])
103 (define-key xterm-function-map "\eOB" [down]) 103(define-key xterm-function-map "\eOF" [end])
104 (define-key xterm-function-map "\eOC" [right]) 104(define-key xterm-function-map "\eOH" [home])
105 (define-key xterm-function-map "\eOD" [left]) 105
106 (define-key xterm-function-map "\eOF" [end]) 106(define-key xterm-function-map "\e[1;2A" [S-up])
107 (define-key xterm-function-map "\eOH" [home]) 107(define-key xterm-function-map "\e[1;2B" [S-down])
108 108(define-key xterm-function-map "\e[1;2C" [S-right])
109 (define-key xterm-function-map "\e[1;2A" [S-up]) 109(define-key xterm-function-map "\e[1;2D" [S-left])
110 (define-key xterm-function-map "\e[1;2B" [S-down]) 110(define-key xterm-function-map "\e[1;2F" [S-end])
111 (define-key xterm-function-map "\e[1;2C" [S-right]) 111(define-key xterm-function-map "\e[1;2H" [S-home])
112 (define-key xterm-function-map "\e[1;2D" [S-left]) 112
113 (define-key xterm-function-map "\e[1;2F" [S-end]) 113(define-key xterm-function-map "\e[1;5A" [C-up])
114 (define-key xterm-function-map "\e[1;2H" [S-home]) 114(define-key xterm-function-map "\e[1;5B" [C-down])
115 115(define-key xterm-function-map "\e[1;5C" [C-right])
116 (define-key xterm-function-map "\e[1;5A" [C-up]) 116(define-key xterm-function-map "\e[1;5D" [C-left])
117 (define-key xterm-function-map "\e[1;5B" [C-down]) 117(define-key xterm-function-map "\e[1;5F" [C-end])
118 (define-key xterm-function-map "\e[1;5C" [C-right]) 118(define-key xterm-function-map "\e[1;5H" [C-home])
119 (define-key xterm-function-map "\e[1;5D" [C-left]) 119
120 (define-key xterm-function-map "\e[1;5F" [C-end]) 120(define-key xterm-function-map "\e[1;6A" [C-S-up])
121 (define-key xterm-function-map "\e[1;5H" [C-home]) 121(define-key xterm-function-map "\e[1;6B" [C-S-down])
122 122(define-key xterm-function-map "\e[1;6C" [C-S-right])
123 (define-key xterm-function-map "\e[1;6A" [C-S-up]) 123(define-key xterm-function-map "\e[1;6D" [C-S-left])
124 (define-key xterm-function-map "\e[1;6B" [C-S-down]) 124(define-key xterm-function-map "\e[1;6F" [C-S-end])
125 (define-key xterm-function-map "\e[1;6C" [C-S-right]) 125(define-key xterm-function-map "\e[1;6H" [C-S-home])
126 (define-key xterm-function-map "\e[1;6D" [C-S-left]) 126
127 (define-key xterm-function-map "\e[1;6F" [C-S-end]) 127(define-key xterm-function-map "\e[1;3A" [A-up])
128 (define-key xterm-function-map "\e[1;6H" [C-S-home]) 128(define-key xterm-function-map "\e[1;3B" [A-down])
129 129(define-key xterm-function-map "\e[1;3C" [A-right])
130 (define-key xterm-function-map "\e[1;3A" [A-up]) 130(define-key xterm-function-map "\e[1;3D" [A-left])
131 (define-key xterm-function-map "\e[1;3B" [A-down]) 131(define-key xterm-function-map "\e[1;3F" [A-end])
132 (define-key xterm-function-map "\e[1;3C" [A-right]) 132(define-key xterm-function-map "\e[1;3H" [A-home])
133 (define-key xterm-function-map "\e[1;3D" [A-left]) 133
134 (define-key xterm-function-map "\e[1;3F" [A-end]) 134(define-key xterm-function-map "\e[2~" [insert])
135 (define-key xterm-function-map "\e[1;3H" [A-home]) 135(define-key xterm-function-map "\e[3~" [delete])
136 136(define-key xterm-function-map "\e[5~" [prior])
137 (define-key xterm-function-map "\e[2~" [insert]) 137(define-key xterm-function-map "\e[6~" [next])
138 (define-key xterm-function-map "\e[3~" [delete]) 138
139 (define-key xterm-function-map "\e[5~" [prior]) 139(define-key xterm-function-map "\e[2;2~" [S-insert])
140 (define-key xterm-function-map "\e[6~" [next]) 140(define-key xterm-function-map "\e[3;2~" [S-delete])
141 141(define-key xterm-function-map "\e[5;2~" [S-prior])
142 (define-key xterm-function-map "\e[2;2~" [S-insert]) 142(define-key xterm-function-map "\e[6;2~" [S-next])
143 (define-key xterm-function-map "\e[3;2~" [S-delete]) 143
144 (define-key xterm-function-map "\e[5;2~" [S-prior]) 144(define-key xterm-function-map "\e[2;5~" [C-insert])
145 (define-key xterm-function-map "\e[6;2~" [S-next]) 145(define-key xterm-function-map "\e[3;5~" [C-delete])
146 146(define-key xterm-function-map "\e[5;5~" [C-prior])
147 (define-key xterm-function-map "\e[2;5~" [C-insert]) 147(define-key xterm-function-map "\e[6;5~" [C-next])
148 (define-key xterm-function-map "\e[3;5~" [C-delete]) 148
149 (define-key xterm-function-map "\e[5;5~" [C-prior]) 149(define-key xterm-function-map "\e[2;6~" [C-S-insert])
150 (define-key xterm-function-map "\e[6;5~" [C-next]) 150(define-key xterm-function-map "\e[3;6~" [C-S-delete])
151 151(define-key xterm-function-map "\e[5;6~" [C-S-prior])
152 (define-key xterm-function-map "\e[2;6~" [C-S-insert]) 152(define-key xterm-function-map "\e[6;6~" [C-S-next])
153 (define-key xterm-function-map "\e[3;6~" [C-S-delete]) 153
154 (define-key xterm-function-map "\e[5;6~" [C-S-prior]) 154(define-key xterm-function-map "\e[2;3~" [A-insert])
155 (define-key xterm-function-map "\e[6;6~" [C-S-next]) 155(define-key xterm-function-map "\e[3;3~" [A-delete])
156 156(define-key xterm-function-map "\e[5;3~" [A-prior])
157 (define-key xterm-function-map "\e[2;3~" [A-insert]) 157(define-key xterm-function-map "\e[6;3~" [A-next])
158 (define-key xterm-function-map "\e[3;3~" [A-delete]) 158
159 (define-key xterm-function-map "\e[5;3~" [A-prior]) 159(define-key xterm-function-map "\e[4~" [select])
160 (define-key xterm-function-map "\e[6;3~" [A-next]) 160(define-key xterm-function-map "\e[29~" [print])
161 161
162 (define-key xterm-function-map "\e[4~" [select]) 162;; These keys will be available xterm starting probably from
163 (define-key xterm-function-map "\e[29~" [print]) 163;; version 214.
164 164(define-key xterm-function-map "\e[27;5;9~" [(control ?\t)])
165 ;; These keys will be available xterm starting probably from 165(define-key xterm-function-map "\e[27;5;44~" [(control ?\,)])
166 ;; version 214. 166(define-key xterm-function-map "\e[27;5;46~" [(control ?\.)])
167 (define-key xterm-function-map "\e[27;5;9~" [(control ?\t)]) 167(define-key xterm-function-map "\e[27;5;47~" [(control ?\/)])
168 (define-key xterm-function-map "\e[27;5;44~" [(control ?\,)]) 168(define-key xterm-function-map "\e[27;5;92~" [(control ?\\)])
169 (define-key xterm-function-map "\e[27;5;46~" [(control ?\.)]) 169
170 (define-key xterm-function-map "\e[27;5;47~" [(control ?\/)]) 170;; Other versions of xterm might emit these.
171 (define-key xterm-function-map "\e[27;5;92~" [(control ?\\)]) 171(define-key xterm-function-map "\e[A" [up])
172 172(define-key xterm-function-map "\e[B" [down])
173 ;; Other versions of xterm might emit these. 173(define-key xterm-function-map "\e[C" [right])
174 (define-key xterm-function-map "\e[A" [up]) 174(define-key xterm-function-map "\e[D" [left])
175 (define-key xterm-function-map "\e[B" [down]) 175(define-key xterm-function-map "\e[1~" [home])
176 (define-key xterm-function-map "\e[C" [right]) 176
177 (define-key xterm-function-map "\e[D" [left]) 177(define-key xterm-function-map "\e[1;2A" [S-up])
178 (define-key xterm-function-map "\e[1~" [home]) 178(define-key xterm-function-map "\e[1;2B" [S-down])
179 179(define-key xterm-function-map "\e[1;2C" [S-right])
180 (define-key xterm-function-map "\e[1;2A" [S-up]) 180(define-key xterm-function-map "\e[1;2D" [S-left])
181 (define-key xterm-function-map "\e[1;2B" [S-down]) 181(define-key xterm-function-map "\e[1;2F" [S-end])
182 (define-key xterm-function-map "\e[1;2C" [S-right]) 182(define-key xterm-function-map "\e[1;2H" [S-home])
183 (define-key xterm-function-map "\e[1;2D" [S-left]) 183
184 (define-key xterm-function-map "\e[1;2F" [S-end]) 184(define-key xterm-function-map "\e[1;5A" [C-up])
185 (define-key xterm-function-map "\e[1;2H" [S-home]) 185(define-key xterm-function-map "\e[1;5B" [C-down])
186 186(define-key xterm-function-map "\e[1;5C" [C-right])
187 (define-key xterm-function-map "\e[1;5A" [C-up]) 187(define-key xterm-function-map "\e[1;5D" [C-left])
188 (define-key xterm-function-map "\e[1;5B" [C-down]) 188(define-key xterm-function-map "\e[1;5F" [C-end])
189 (define-key xterm-function-map "\e[1;5C" [C-right]) 189(define-key xterm-function-map "\e[1;5H" [C-home])
190 (define-key xterm-function-map "\e[1;5D" [C-left]) 190
191 (define-key xterm-function-map "\e[1;5F" [C-end]) 191(define-key xterm-function-map "\e[11~" [f1])
192 (define-key xterm-function-map "\e[1;5H" [C-home]) 192(define-key xterm-function-map "\e[12~" [f2])
193 193(define-key xterm-function-map "\e[13~" [f3])
194 (define-key xterm-function-map "\e[11~" [f1]) 194(define-key xterm-function-map "\e[14~" [f4])
195 (define-key xterm-function-map "\e[12~" [f2])
196 (define-key xterm-function-map "\e[13~" [f3])
197 (define-key xterm-function-map "\e[14~" [f4]))
198 195
199(defun terminal-init-xterm () 196(defun terminal-init-xterm ()
200 "Terminal initialization function for xterm." 197 "Terminal initialization function for xterm."
201 ;; rxvt terminals sometimes set the TERM variable to "xterm", but 198 ;; rxvt terminals sometimes set the TERM variable to "xterm", but
202 ;; rxvt's keybindings that are incompatible with xterm's. It is 199 ;; rxvt's keybindings are incompatible with xterm's. It is
203 ;; better in that case to use rxvt's initializion function. 200 ;; better in that case to use rxvt's initializion function.
204 (if (and (getenv "COLORTERM" (terminal-id)) 201 (if (and (getenv "COLORTERM" (terminal-id))
205 (string-match "\\`rxvt" (getenv "COLORTERM" (terminal-id)))) 202 (string-match "\\`rxvt" (getenv "COLORTERM" (terminal-id))))
206 (progn 203 (tty-run-terminal-initialization (selected-frame) "rxvt")
207 (eval-and-compile (load "term/rxvt")) 204
208 (terminal-init-rxvt)) 205 ;; The terminal intialization C code file might have initialized
209 206 ;; function keys F13->F60 from the termcap/terminfo information. On
210 ;; The terminal-local stuff only need to be set up on the first 207 ;; a PC-style keyboard these keys correspond to
211 ;; frame on that device. 208 ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C, A-, C-S-. The
212 (when (eq 1 (length (frames-on-display-list))) 209 ;; code here subsitutes the corresponding defintions in
213 ;; The terminal intialization C code file might have initialized 210 ;; function-key-map. This substitution is needed because if a key
214 ;; function keys F13->F60 from the termcap/terminfo information. On 211 ;; definition if found in function-key-map, there are no further
215 ;; a PC-style keyboard these keys correspond to 212 ;; lookups in other keymaps.
216 ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C, A-, C-S-. The 213 (substitute-key-definition [f13] [S-f1] local-function-key-map)
217 ;; code here subsitutes the corresponding defintions in 214 (substitute-key-definition [f14] [S-f2] local-function-key-map)
218 ;; function-key-map. This substitution is needed because if a key 215 (substitute-key-definition [f15] [S-f3] local-function-key-map)
219 ;; definition if found in function-key-map, there are no further 216 (substitute-key-definition [f16] [S-f4] local-function-key-map)
220 ;; lookups in other keymaps. 217 (substitute-key-definition [f17] [S-f5] local-function-key-map)
221 (substitute-key-definition [f13] [S-f1] local-function-key-map) 218 (substitute-key-definition [f18] [S-f6] local-function-key-map)
222 (substitute-key-definition [f14] [S-f2] local-function-key-map) 219 (substitute-key-definition [f19] [S-f7] local-function-key-map)
223 (substitute-key-definition [f15] [S-f3] local-function-key-map) 220 (substitute-key-definition [f20] [S-f8] local-function-key-map)
224 (substitute-key-definition [f16] [S-f4] local-function-key-map) 221 (substitute-key-definition [f21] [S-f9] local-function-key-map)
225 (substitute-key-definition [f17] [S-f5] local-function-key-map) 222 (substitute-key-definition [f22] [S-f10] local-function-key-map)
226 (substitute-key-definition [f18] [S-f6] local-function-key-map) 223 (substitute-key-definition [f23] [S-f11] local-function-key-map)
227 (substitute-key-definition [f19] [S-f7] local-function-key-map) 224 (substitute-key-definition [f24] [S-f12] local-function-key-map)
228 (substitute-key-definition [f20] [S-f8] local-function-key-map) 225
229 (substitute-key-definition [f21] [S-f9] local-function-key-map) 226 (substitute-key-definition [f25] [C-f1] local-function-key-map)
230 (substitute-key-definition [f22] [S-f10] local-function-key-map) 227 (substitute-key-definition [f26] [C-f2] local-function-key-map)
231 (substitute-key-definition [f23] [S-f11] local-function-key-map) 228 (substitute-key-definition [f27] [C-f3] local-function-key-map)
232 (substitute-key-definition [f24] [S-f12] local-function-key-map) 229 (substitute-key-definition [f28] [C-f4] local-function-key-map)
233 230 (substitute-key-definition [f29] [C-f5] local-function-key-map)
234 (substitute-key-definition [f25] [C-f1] local-function-key-map) 231 (substitute-key-definition [f30] [C-f6] local-function-key-map)
235 (substitute-key-definition [f26] [C-f2] local-function-key-map) 232 (substitute-key-definition [f31] [C-f7] local-function-key-map)
236 (substitute-key-definition [f27] [C-f3] local-function-key-map) 233 (substitute-key-definition [f32] [C-f8] local-function-key-map)
237 (substitute-key-definition [f28] [C-f4] local-function-key-map) 234 (substitute-key-definition [f33] [C-f9] local-function-key-map)
238 (substitute-key-definition [f29] [C-f5] local-function-key-map) 235 (substitute-key-definition [f34] [C-f10] local-function-key-map)
239 (substitute-key-definition [f30] [C-f6] local-function-key-map) 236 (substitute-key-definition [f35] [C-f11] local-function-key-map)
240 (substitute-key-definition [f31] [C-f7] local-function-key-map) 237 (substitute-key-definition [f36] [C-f12] local-function-key-map)
241 (substitute-key-definition [f32] [C-f8] local-function-key-map) 238
242 (substitute-key-definition [f33] [C-f9] local-function-key-map) 239 (substitute-key-definition [f37] [C-S-f1] local-function-key-map)
243 (substitute-key-definition [f34] [C-f10] local-function-key-map) 240 (substitute-key-definition [f38] [C-S-f2] local-function-key-map)
244 (substitute-key-definition [f35] [C-f11] local-function-key-map) 241 (substitute-key-definition [f39] [C-S-f3] local-function-key-map)
245 (substitute-key-definition [f36] [C-f12] local-function-key-map) 242 (substitute-key-definition [f40] [C-S-f4] local-function-key-map)
246 243 (substitute-key-definition [f41] [C-S-f5] local-function-key-map)
247 (substitute-key-definition [f37] [C-S-f1] local-function-key-map) 244 (substitute-key-definition [f42] [C-S-f6] local-function-key-map)
248 (substitute-key-definition [f38] [C-S-f2] local-function-key-map) 245 (substitute-key-definition [f43] [C-S-f7] local-function-key-map)
249 (substitute-key-definition [f39] [C-S-f3] local-function-key-map) 246 (substitute-key-definition [f44] [C-S-f8] local-function-key-map)
250 (substitute-key-definition [f40] [C-S-f4] local-function-key-map) 247 (substitute-key-definition [f45] [C-S-f9] local-function-key-map)
251 (substitute-key-definition [f41] [C-S-f5] local-function-key-map) 248 (substitute-key-definition [f46] [C-S-f10] local-function-key-map)
252 (substitute-key-definition [f42] [C-S-f6] local-function-key-map) 249 (substitute-key-definition [f47] [C-S-f11] local-function-key-map)
253 (substitute-key-definition [f43] [C-S-f7] local-function-key-map) 250 (substitute-key-definition [f48] [C-S-f12] local-function-key-map)
254 (substitute-key-definition [f44] [C-S-f8] local-function-key-map) 251
255 (substitute-key-definition [f45] [C-S-f9] local-function-key-map) 252 (substitute-key-definition [f49] [A-f1] local-function-key-map)
256 (substitute-key-definition [f46] [C-S-f10] local-function-key-map) 253 (substitute-key-definition [f50] [A-f2] local-function-key-map)
257 (substitute-key-definition [f47] [C-S-f11] local-function-key-map) 254 (substitute-key-definition [f51] [A-f3] local-function-key-map)
258 (substitute-key-definition [f48] [C-S-f12] local-function-key-map) 255 (substitute-key-definition [f52] [A-f4] local-function-key-map)
259 256 (substitute-key-definition [f53] [A-f5] local-function-key-map)
260 (substitute-key-definition [f49] [A-f1] local-function-key-map) 257 (substitute-key-definition [f54] [A-f6] local-function-key-map)
261 (substitute-key-definition [f50] [A-f2] local-function-key-map) 258 (substitute-key-definition [f55] [A-f7] local-function-key-map)
262 (substitute-key-definition [f51] [A-f3] local-function-key-map) 259 (substitute-key-definition [f56] [A-f8] local-function-key-map)
263 (substitute-key-definition [f52] [A-f4] local-function-key-map) 260 (substitute-key-definition [f57] [A-f9] local-function-key-map)
264 (substitute-key-definition [f53] [A-f5] local-function-key-map) 261 (substitute-key-definition [f58] [A-f10] local-function-key-map)
265 (substitute-key-definition [f54] [A-f6] local-function-key-map) 262 (substitute-key-definition [f59] [A-f11] local-function-key-map)
266 (substitute-key-definition [f55] [A-f7] local-function-key-map) 263 (substitute-key-definition [f60] [A-f12] local-function-key-map)
267 (substitute-key-definition [f56] [A-f8] local-function-key-map) 264
268 (substitute-key-definition [f57] [A-f9] local-function-key-map) 265 ;; Use inheritance to let the main keymap override those defaults.
269 (substitute-key-definition [f58] [A-f10] local-function-key-map) 266 ;; This way we don't override terminfo-derived settings or settings
270 (substitute-key-definition [f59] [A-f11] local-function-key-map) 267 ;; made in the .emacs file.
271 (substitute-key-definition [f60] [A-f12] local-function-key-map)) 268 (let ((m (copy-keymap xterm-function-map)))
272 269 (set-keymap-parent m (keymap-parent local-function-key-map))
273 ;; Use inheritance to let the main keymap override those defaults. 270 (set-keymap-parent local-function-key-map m)))
274 ;; This way we don't override terminfo-derived settings or settings 271
275 ;; made in the .emacs file.
276 (let ((m (copy-keymap xterm-function-map)))
277 (set-keymap-parent m (keymap-parent local-function-key-map))
278 (set-keymap-parent local-function-key-map m)))
279
280 ;; Do it!
281 (xterm-register-default-colors) 272 (xterm-register-default-colors)
282 ;; This recomputes all the default faces given the colors we've just set up. 273 ;; This recomputes all the default faces given the colors we've just set up.
283 (tty-set-up-initial-frame-faces)) 274 (tty-set-up-initial-frame-faces))