summaryrefslogtreecommitdiff
path: root/lisp/term
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/term')
-rw-r--r--lisp/term/AT386.el58
-rw-r--r--lisp/term/apollo.el4
-rw-r--r--lisp/term/internal.el28
-rw-r--r--lisp/term/iris-ansi.el387
-rw-r--r--lisp/term/lk201.el143
-rw-r--r--lisp/term/mac-win.el28
-rw-r--r--lisp/term/news.el2
-rw-r--r--lisp/term/rxvt.el253
-rw-r--r--lisp/term/sun.el2
-rw-r--r--lisp/term/tvi970.el19
-rw-r--r--lisp/term/vt100.el3
-rw-r--r--lisp/term/vt102.el2
-rw-r--r--lisp/term/vt125.el2
-rw-r--r--lisp/term/vt200.el7
-rw-r--r--lisp/term/vt201.el6
-rw-r--r--lisp/term/vt220.el6
-rw-r--r--lisp/term/vt240.el6
-rw-r--r--lisp/term/vt300.el6
-rw-r--r--lisp/term/vt320.el6
-rw-r--r--lisp/term/vt400.el6
-rw-r--r--lisp/term/vt420.el8
-rw-r--r--lisp/term/wyse50.el14
-rw-r--r--lisp/term/x-win.el315
-rw-r--r--lisp/term/xterm.el455
24 files changed, 917 insertions, 849 deletions
diff --git a/lisp/term/AT386.el b/lisp/term/AT386.el
index 22768730e70..fda2da44ac8 100644
--- a/lisp/term/AT386.el
+++ b/lisp/term/AT386.el
@@ -28,34 +28,36 @@
;;; Code:
-(if (boundp 'AT386-keypad-map)
- nil
- ;; The terminal initialization should already have set up some keys
- (setq AT386-keypad-map (lookup-key function-key-map "\e["))
- (if (not (keymapp AT386-keypad-map))
- (error "What? Your AT386 termcap/terminfo has no keycaps in it"))
-
- ;; Equivalents of these are set up automatically by termcap/terminfo
- ;; (define-key AT386-keypad-map "A" [up])
- ;; (define-key AT386-keypad-map "B" [down])
- ;; (define-key AT386-keypad-map "C" [right])
- ;; (define-key AT386-keypad-map "D" [left])
-
- ;; These would be set up by terminfo, but not termcap
- (define-key AT386-keypad-map "H" [home])
- (define-key AT386-keypad-map "Y" [end])
- (define-key AT386-keypad-map "U" [next]) ;; PgDn
- (define-key AT386-keypad-map "V" [prior]) ;; PgUp
- (define-key AT386-keypad-map "@" [insert]) ;; Ins key
-
- ;; These are not normally set up by either
- (define-key AT386-keypad-map "G" [kp-5]) ;; Unlabeled center key
- (define-key AT386-keypad-map "S" [kp-subtract])
- (define-key AT386-keypad-map "T" [kp-add])
-
- ;; Arrange for the ALT key to be equivalent to ESC
- (define-key function-key-map "\eN" [27]) ; ALT map
- )
+(defun terminal-init-AT386 ()
+ "Terminal initialization function for AT386."
+ (if (boundp 'AT386-keypad-map)
+ nil
+ ;; The terminal initialization should already have set up some keys
+ (setq AT386-keypad-map (lookup-key local-function-key-map "\e["))
+ (if (not (keymapp AT386-keypad-map))
+ (error "What? Your AT386 termcap/terminfo has no keycaps in it"))
+
+ ;; Equivalents of these are set up automatically by termcap/terminfo
+ ;; (define-key AT386-keypad-map "A" [up])
+ ;; (define-key AT386-keypad-map "B" [down])
+ ;; (define-key AT386-keypad-map "C" [right])
+ ;; (define-key AT386-keypad-map "D" [left])
+
+ ;; These would be set up by terminfo, but not termcap
+ (define-key AT386-keypad-map "H" [home])
+ (define-key AT386-keypad-map "Y" [end])
+ (define-key AT386-keypad-map "U" [next]) ;; PgDn
+ (define-key AT386-keypad-map "V" [prior]) ;; PgUp
+ (define-key AT386-keypad-map "@" [insert]) ;; Ins key
+
+ ;; These are not normally set up by either
+ (define-key AT386-keypad-map "G" [kp-5]) ;; Unlabeled center key
+ (define-key AT386-keypad-map "S" [kp-subtract])
+ (define-key AT386-keypad-map "T" [kp-add])
+
+ ;; Arrange for the ALT key to be equivalent to ESC
+ (define-key local-function-key-map "\eN" [27]) ; ALT map
+ ))
;;; arch-tag: abec1b03-582f-49f8-b8cb-e2fd52ea4bd7
;;; AT386.el ends here
diff --git a/lisp/term/apollo.el b/lisp/term/apollo.el
index 749ff85a0a6..1e0e6f0a1f1 100644
--- a/lisp/term/apollo.el
+++ b/lisp/term/apollo.el
@@ -1,7 +1,7 @@
;; -*- no-byte-compile: t -*-
(defun terminal-init-apollo ()
- "Terminal initialization function for apollo."
- (load "term/vt100" nil t))
+ "Terminal initialization function for apollo."
+ (terminal-init-vt100))
;;; arch-tag: c72f446f-e6b7-4749-90a4-bd68632adacf
;;; apollo.el ends here
diff --git a/lisp/term/internal.el b/lisp/term/internal.el
index 1a266b0706f..e9de649158a 100644
--- a/lisp/term/internal.el
+++ b/lisp/term/internal.el
@@ -29,20 +29,20 @@
;; ---------------------------------------------------------------------------
;; keyboard setup -- that's simple!
(set-input-mode nil nil 0)
-(define-key function-key-map [backspace] "\177") ; Normal behaviour for BS
-(define-key function-key-map [delete] "\C-d") ; ... and Delete
-(define-key function-key-map [tab] [?\t])
-(define-key function-key-map [linefeed] [?\n])
-(define-key function-key-map [clear] [11])
-(define-key function-key-map [return] [13])
-(define-key function-key-map [escape] [?\e])
-(define-key function-key-map [M-backspace] [?\M-\d])
-(define-key function-key-map [M-delete] [?\M-d])
-(define-key function-key-map [M-tab] [?\M-\t])
-(define-key function-key-map [M-linefeed] [?\M-\n])
-(define-key function-key-map [M-clear] [?\M-\013])
-(define-key function-key-map [M-return] [?\M-\015])
-(define-key function-key-map [M-escape] [?\M-\e])
+(define-key local-function-key-map [backspace] "\177") ; Normal behaviour for BS
+(define-key local-function-key-map [delete] "\C-d") ; ... and Delete
+(define-key local-function-key-map [tab] [?\t])
+(define-key local-function-key-map [linefeed] [?\n])
+(define-key local-function-key-map [clear] [11])
+(define-key local-function-key-map [return] [13])
+(define-key local-function-key-map [escape] [?\e])
+(define-key local-function-key-map [M-backspace] [?\M-\d])
+(define-key local-function-key-map [M-delete] [?\M-d])
+(define-key local-function-key-map [M-tab] [?\M-\t])
+(define-key local-function-key-map [M-linefeed] [?\M-\n])
+(define-key local-function-key-map [M-clear] [?\M-\013])
+(define-key local-function-key-map [M-return] [?\M-\015])
+(define-key local-function-key-map [M-escape] [?\M-\e]))
(put 'backspace 'ascii-character 127)
(put 'delete 'ascii-character 127)
(put 'tab 'ascii-character ?\t)
diff --git a/lisp/term/iris-ansi.el b/lisp/term/iris-ansi.el
index e62434d2865..1a3a65fa716 100644
--- a/lisp/term/iris-ansi.el
+++ b/lisp/term/iris-ansi.el
@@ -25,306 +25,321 @@
;;; Code:
-(defun iris-ansi-initialize-terminal ()
- "Terminal initialization function for iris-ansi."
- (define-key function-key-map "\e[120q" [S-escape])
- (define-key function-key-map "\e[121q" [C-escape])
+(defvar iris-function-map nil
+ "Function key definitions for SGI xwsh and winterm apps.")
+
+;; Make reloads faster.
+(unless iris-function-map
+ (setq iris-function-map (make-sparse-keymap))
+
+ (define-key iris-function-map "\e[120q" [S-escape])
+ (define-key iris-function-map "\e[121q" [C-escape])
- (define-key function-key-map "\e[001q" [f1])
- (define-key function-key-map "\e[013q" [S-f1])
- (define-key function-key-map "\e[025q" [C-f1])
+ (define-key iris-function-map "\e[001q" [f1])
+ (define-key iris-function-map "\e[013q" [S-f1])
+ (define-key iris-function-map "\e[025q" [C-f1])
- (define-key function-key-map "\e[002q" [f2])
- (define-key function-key-map "\e[014q" [S-f2])
- (define-key function-key-map "\e[026q" [C-f2])
- (define-key function-key-map "\e[038q" [M-f2])
+ (define-key iris-function-map "\e[002q" [f2])
+ (define-key iris-function-map "\e[014q" [S-f2])
+ (define-key iris-function-map "\e[026q" [C-f2])
+ (define-key iris-function-map "\e[038q" [M-f2])
- (define-key function-key-map "\e[003q" [f3])
- (define-key function-key-map "\e[015q" [S-f3])
- (define-key function-key-map "\e[027q" [C-f3])
+ (define-key iris-function-map "\e[003q" [f3])
+ (define-key iris-function-map "\e[015q" [S-f3])
+ (define-key iris-function-map "\e[027q" [C-f3])
- (define-key function-key-map "\e[004q" [f4])
- (define-key function-key-map "\e[016q" [S-f4])
- (define-key function-key-map "\e[028q" [C-f4])
+ (define-key iris-function-map "\e[004q" [f4])
+ (define-key iris-function-map "\e[016q" [S-f4])
+ (define-key iris-function-map "\e[028q" [C-f4])
- (define-key function-key-map "\e[005q" [f5])
- (define-key function-key-map "\e[017q" [S-f5])
- (define-key function-key-map "\e[029q" [C-f5])
+ (define-key iris-function-map "\e[005q" [f5])
+ (define-key iris-function-map "\e[017q" [S-f5])
+ (define-key iris-function-map "\e[029q" [C-f5])
- (define-key function-key-map "\e[006q" [f6])
- (define-key function-key-map "\e[018q" [S-f6])
- (define-key function-key-map "\e[030q" [C-f6])
+ (define-key iris-function-map "\e[006q" [f6])
+ (define-key iris-function-map "\e[018q" [S-f6])
+ (define-key iris-function-map "\e[030q" [C-f6])
- (define-key function-key-map "\e[007q" [f7])
- (define-key function-key-map "\e[019q" [S-f7])
- (define-key function-key-map "\e[031q" [C-f7])
+ (define-key iris-function-map "\e[007q" [f7])
+ (define-key iris-function-map "\e[019q" [S-f7])
+ (define-key iris-function-map "\e[031q" [C-f7])
- (define-key function-key-map "\e[008q" [f8])
- (define-key function-key-map "\e[020q" [S-f8])
- (define-key function-key-map "\e[032q" [C-f8])
+ (define-key iris-function-map "\e[008q" [f8])
+ (define-key iris-function-map "\e[020q" [S-f8])
+ (define-key iris-function-map "\e[032q" [C-f8])
- (define-key function-key-map "\e[009q" [f9])
- (define-key function-key-map "\e[021q" [S-f9])
- (define-key function-key-map "\e[033q" [C-f9])
+ (define-key iris-function-map "\e[009q" [f9])
+ (define-key iris-function-map "\e[021q" [S-f9])
+ (define-key iris-function-map "\e[033q" [C-f9])
- (define-key function-key-map "\e[010q" [f10])
- (define-key function-key-map "\e[022q" [S-f10])
- (define-key function-key-map "\e[034q" [C-f10])
+ (define-key iris-function-map "\e[010q" [f10])
+ (define-key iris-function-map "\e[022q" [S-f10])
+ (define-key iris-function-map "\e[034q" [C-f10])
- (define-key function-key-map "\e[011q" [f11])
- (define-key function-key-map "\e[023q" [S-f11])
- (define-key function-key-map "\e[035q" [C-f11])
- (define-key function-key-map "\e[047q" [M-f11])
+ (define-key iris-function-map "\e[011q" [f11])
+ (define-key iris-function-map "\e[023q" [S-f11])
+ (define-key iris-function-map "\e[035q" [C-f11])
+ (define-key iris-function-map "\e[047q" [M-f11])
- (define-key function-key-map "\e[012q" [f12])
- (define-key function-key-map "\e[024q" [S-f12])
- (define-key function-key-map "\e[036q" [C-f12])
- (define-key function-key-map "\e[048q" [M-f12])
+ (define-key iris-function-map "\e[012q" [f12])
+ (define-key iris-function-map "\e[024q" [S-f12])
+ (define-key iris-function-map "\e[036q" [C-f12])
+ (define-key iris-function-map "\e[048q" [M-f12])
- (define-key function-key-map "\e[057q" [?\C-`])
- (define-key function-key-map "\e[115q" [?\M-`])
+ (define-key iris-function-map "\e[057q" [C-`])
+ (define-key iris-function-map "\e[115q" [M-`])
- (define-key function-key-map "\e[049q" [?\C-1])
- (define-key function-key-map "\e[058q" [?\M-1])
+ (define-key iris-function-map "\e[049q" [?\C-1])
+ (define-key iris-function-map "\e[058q" [?\M-1])
- (define-key function-key-map "\e[059q" [?\M-2])
+ (define-key iris-function-map "\e[059q" [?\M-2])
- (define-key function-key-map "\e[050q" [?\C-3])
- (define-key function-key-map "\e[060q" [?\M-3])
+ (define-key iris-function-map "\e[050q" [?\C-3])
+ (define-key iris-function-map "\e[060q" [?\M-3])
- (define-key function-key-map "\e[051q" [?\C-4])
- (define-key function-key-map "\e[061q" [?\M-4])
+ (define-key iris-function-map "\e[051q" [?\C-4])
+ (define-key iris-function-map "\e[061q" [?\M-4])
- (define-key function-key-map "\e[052q" [?\C-5])
- (define-key function-key-map "\e[062q" [?\M-5])
+ (define-key iris-function-map "\e[052q" [?\C-5])
+ (define-key iris-function-map "\e[062q" [?\M-5])
- (define-key function-key-map "\e[063q" [?\M-6])
+ (define-key iris-function-map "\e[063q" [?\M-6])
- (define-key function-key-map "\e[053q" [?\C-7])
- (define-key function-key-map "\e[064q" [?\M-7])
+ (define-key iris-function-map "\e[053q" [?\C-7])
+ (define-key iris-function-map "\e[064q" [?\M-7])
- (define-key function-key-map "\e[054q" [?\C-8])
- (define-key function-key-map "\e[065q" [?\M-8])
+ (define-key iris-function-map "\e[054q" [?\C-8])
+ (define-key iris-function-map "\e[065q" [?\M-8])
- (define-key function-key-map "\e[055q" [?\C-9])
- (define-key function-key-map "\e[066q" [?\M-9])
+ (define-key iris-function-map "\e[055q" [?\C-9])
+ (define-key iris-function-map "\e[066q" [?\M-9])
- (define-key function-key-map "\e[056q" [?\C-0])
- (define-key function-key-map "\e[067q" [?\M-0])
+ (define-key iris-function-map "\e[056q" [?\C-0])
+ (define-key iris-function-map "\e[067q" [?\M-0])
- (define-key function-key-map "\e[068q" [?\M--])
+ (define-key iris-function-map "\e[068q" [?\M--])
- (define-key function-key-map "\e[069q" [?\C-=])
- (define-key function-key-map "\e[070q" [?\M-=])
+ (define-key iris-function-map "\e[069q" [?\C-=])
+ (define-key iris-function-map "\e[070q" [?\M-=])
;; I don't know what to do with those.
- ;;(define-key function-key-map "^H" [<del>])
- ;;(define-key function-key-map "^H" [S-<del>])
- ;;(define-key function-key-map "\177" [C-<del>])
- ;;(define-key function-key-map "\e[071q" [M-<del>])
+ ;;(define-key iris-function-map "^H" [<del>])
+ ;;(define-key iris-function-map "^H" [S-<del>])
+ ;;(define-key iris-function-map "\177" [C-<del>])
+ ;;(define-key iris-function-map "\e[071q" [M-<del>])
- (define-key function-key-map "\e[Z" [?\S-\t])
- (define-key function-key-map "\e[072q" [?\C-\t])
+ (define-key iris-function-map "\e[Z" [?\S-\t])
+ (define-key iris-function-map "\e[072q" [?\C-\t])
;; This only works if you remove the M-TAB keybing from the system.4Dwmrc
;; our your ~/.4Dwmrc, if you use the 4Dwm window manager.
- (define-key function-key-map "\e[073q" [?\M-\t])
+ (define-key iris-function-map "\e[073q" [?\M-\t])
- (define-key function-key-map "\e[074q" [?\M-q])
+ (define-key iris-function-map "\e[074q" [?\M-q])
- (define-key function-key-map "\e[075q" [?\M-w])
+ (define-key iris-function-map "\e[075q" [?\M-w])
- (define-key function-key-map "\e[076q" [?\M-e])
+ (define-key iris-function-map "\e[076q" [?\M-e])
- (define-key function-key-map "\e[077q" [?\M-r])
+ (define-key iris-function-map "\e[077q" [?\M-r])
- (define-key function-key-map "\e[078q" [?\M-t])
+ (define-key iris-function-map "\e[078q" [?\M-t])
- (define-key function-key-map "\e[079q" [?\M-y])
+ (define-key iris-function-map "\e[079q" [?\M-y])
- (define-key function-key-map "\e[080q" [?\M-u])
+ (define-key iris-function-map "\e[080q" [?\M-u])
- (define-key function-key-map "\e[081q" [?\M-i])
+ (define-key iris-function-map "\e[081q" [?\M-i])
- (define-key function-key-map "\e[082q" [?\M-o])
+ (define-key iris-function-map "\e[082q" [?\M-o])
- (define-key function-key-map "\e[083q" [?\M-p])
+ (define-key iris-function-map "\e[083q" [?\M-p])
- (define-key function-key-map "\e[084q" [?\M-\[])
+ (define-key iris-function-map "\e[084q" [?\M-\[])
- (define-key function-key-map "\e[085q" [?\M-\]])
+ (define-key iris-function-map "\e[085q" [?\M-\]])
- (define-key function-key-map "\e[086q" [?\M-\\])
+ (define-key iris-function-map "\e[086q" [?\M-\\])
- (define-key function-key-map "\e[087q" [?\M-a])
+ (define-key iris-function-map "\e[087q" [?\M-a])
- (define-key function-key-map "\e[088q" [?\M-s])
+ (define-key iris-function-map "\e[088q" [?\M-s])
- (define-key function-key-map "\e[089q" [?\M-d])
+ (define-key iris-function-map "\e[089q" [?\M-d])
- (define-key function-key-map "\e[090q" [?\M-f])
+ (define-key iris-function-map "\e[090q" [?\M-f])
- (define-key function-key-map "\e[091q" [?\M-g])
+ (define-key iris-function-map "\e[091q" [?\M-g])
- (define-key function-key-map "\e[092q" [?\M-h])
+ (define-key iris-function-map "\e[092q" [?\M-h])
- (define-key function-key-map "\e[093q" [?\M-j])
+ (define-key iris-function-map "\e[093q" [?\M-j])
- (define-key function-key-map "\e[094q" [?\M-k])
+ (define-key iris-function-map "\e[094q" [?\M-k])
- (define-key function-key-map "\e[095q" [?\M-l])
+ (define-key iris-function-map "\e[095q" [?\M-l])
- (define-key function-key-map "\e[096q" [?\C-\;])
- (define-key function-key-map "\e[097q" [?\M-:]) ;; we are cheating
- ;; here, this is
- ;; realy M-;, but
- ;; M-: generates the
- ;; same string and
- ;; is more usefull.
+ (define-key iris-function-map "\e[096q" [?\C-\;])
+ (define-key iris-function-map "\e[097q" [?\M-:]) ;; we are cheating
+ ;; here, this is realy
+ ;; M-;, but M-:
+ ;; generates the same
+ ;; string and is more
+ ;; usefull.
- (define-key function-key-map "\e[098q" [?\C-'])
- (define-key function-key-map "\e[099q" [?\M-'])
+ (define-key iris-function-map "\e[098q" [?\C-'])
+ (define-key iris-function-map "\e[099q" [?\M-'])
- (define-key function-key-map "\e[100q" [?\M-\n])
+ (define-key iris-function-map "\e[100q" [?\M-\n])
- (define-key function-key-map "\e[101q" [?\M-z])
+ (define-key iris-function-map "\e[101q" [?\M-z])
- (define-key function-key-map "\e[102q" [?\M-x])
+ (define-key iris-function-map "\e[102q" [?\M-x])
- (define-key function-key-map "\e[103q" [?\M-c])
+ (define-key iris-function-map "\e[103q" [?\M-c])
- (define-key function-key-map "\e[104q" [?\M-v])
+ (define-key iris-function-map "\e[104q" [?\M-v])
- (define-key function-key-map "\e[105q" [?\M-b])
+ (define-key iris-function-map "\e[105q" [?\M-b])
- (define-key function-key-map "\e[106q" [M-n])
+ (define-key iris-function-map "\e[106q" [M-n])
- (define-key function-key-map "\e[107q" [M-m])
+ (define-key iris-function-map "\e[107q" [M-m])
- (define-key function-key-map "\e[108q" [?\C-,])
- (define-key function-key-map "\e[109q" [?\M-,])
+ (define-key iris-function-map "\e[108q" [?\C-,])
+ (define-key iris-function-map "\e[109q" [?\M-,])
- (define-key function-key-map "\e[110q" [?\C-.])
- (define-key function-key-map "\e[111q" [?\M-.])
+ (define-key iris-function-map "\e[110q" [?\C-.])
+ (define-key iris-function-map "\e[111q" [?\M-.])
- (define-key function-key-map "\e[112q" [?\C-/])
- (define-key function-key-map "\e[113q" [?\M-/])
+ (define-key iris-function-map "\e[112q" [?\C-/])
+ (define-key iris-function-map "\e[113q" [?\M-/])
- (define-key function-key-map "\e[139q" [insert])
- (define-key function-key-map "\e[139q" [S-insert])
- (define-key function-key-map "\e[140q" [C-insert])
- (define-key function-key-map "\e[141q" [M-insert])
+ (define-key iris-function-map "\e[139q" [insert])
+ (define-key iris-function-map "\e[139q" [S-insert])
+ (define-key iris-function-map "\e[140q" [C-insert])
+ (define-key iris-function-map "\e[141q" [M-insert])
- (define-key function-key-map "\e[H" [home])
- (define-key function-key-map "\e[143q" [S-home])
- (define-key function-key-map "\e[144q" [C-home])
+ (define-key iris-function-map "\e[H" [home])
+ (define-key iris-function-map "\e[143q" [S-home])
+ (define-key iris-function-map "\e[144q" [C-home])
- (define-key function-key-map "\e[150q" [prior])
- (define-key function-key-map "\e[151q" [S-prior]) ;; those don't
- ;; seem to
- ;; generate
+ (define-key iris-function-map "\e[150q" [prior])
+ (define-key iris-function-map "\e[151q" [S-prior]) ;; those don't seem
+ ;; to generate
;; anything
- (define-key function-key-map "\e[152q" [C-prior])
+ (define-key iris-function-map "\e[152q" [C-prior])
- ;; (define-key function-key-map "^?" [delete])
- (define-key function-key-map "\e[P" [S-delete])
- (define-key function-key-map "\e[142q" [C-delete])
- (define-key function-key-map "\e[M" [M-delete])
+ ;; (define-key iris-function-map "^?" [delete]) ?? something else seems to take care of this.
+ (define-key iris-function-map "\e[P" [S-delete])
+ (define-key iris-function-map "\e[142q" [C-delete])
+ (define-key iris-function-map "\e[M" [M-delete])
- (define-key function-key-map "\e[146q" [end])
- (define-key function-key-map "\e[147q" [S-end]) ;; those don't seem
- ;; to generate
- ;; anything
- (define-key function-key-map "\e[148q" [C-end])
+ (define-key iris-function-map "\e[146q" [end])
+ (define-key iris-function-map "\e[147q" [S-end]) ;; those don't seem to
+ ;; generate anything
+ (define-key iris-function-map "\e[148q" [C-end])
- (define-key function-key-map "\e[154q" [next])
- (define-key function-key-map "\e[155q" [S-next])
- (define-key function-key-map "\e[156q" [C-next])
+ (define-key iris-function-map "\e[154q" [next])
+ (define-key iris-function-map "\e[155q" [S-next])
+ (define-key iris-function-map "\e[156q" [C-next])
- (define-key function-key-map "\e[161q" [S-up])
- (define-key function-key-map "\e[162q" [C-up])
- (define-key function-key-map "\e[163q" [M-up])
+ (define-key iris-function-map "\e[161q" [S-up])
+ (define-key iris-function-map "\e[162q" [C-up])
+ (define-key iris-function-map "\e[163q" [M-up])
- (define-key function-key-map "\e[158q" [S-left])
- (define-key function-key-map "\e[159q" [C-left])
- (define-key function-key-map "\e[160q" [M-left])
+ (define-key iris-function-map "\e[158q" [S-left])
+ (define-key iris-function-map "\e[159q" [C-left])
+ (define-key iris-function-map "\e[160q" [M-left])
- (define-key function-key-map "\e[164q" [S-down])
- (define-key function-key-map "\e[165q" [C-down])
- (define-key function-key-map "\e[166q" [M-down])
+ (define-key iris-function-map "\e[164q" [S-down])
+ (define-key iris-function-map "\e[165q" [C-down])
+ (define-key iris-function-map "\e[166q" [M-down])
- (define-key function-key-map "\e[167q" [S-right])
- (define-key function-key-map "\e[168q" [C-right])
- (define-key function-key-map "\e[169q" [M-right])
+ (define-key iris-function-map "\e[167q" [S-right])
+ (define-key iris-function-map "\e[168q" [C-right])
+ (define-key iris-function-map "\e[169q" [M-right])
;; Keypad functions, most of those are untested.
- (define-key function-key-map "\e[179q" [?\C-/])
- (define-key function-key-map "\e[180q" [?\M-/])
+ (define-key iris-function-map "\e[179q" [?\C-/])
+ (define-key iris-function-map "\e[180q" [?\M-/])
- (define-key function-key-map "\e[187q" [?\C-*])
- (define-key function-key-map "\e[188q" [?\M-*])
+ (define-key iris-function-map "\e[187q" [?\C-*])
+ (define-key iris-function-map "\e[188q" [?\M-*])
- (define-key function-key-map "\e[198q" [?\C--])
- (define-key function-key-map "\e[199q" [?\M--])
+ (define-key iris-function-map "\e[198q" [?\C--])
+ (define-key iris-function-map "\e[199q" [?\M--])
;; Something else takes care of home, up, prior, down, left, right, next
- ;;(define-key function-key-map "\e[H" [home])
- (define-key function-key-map "\e[172q" [C-home])
+ ;(define-key iris-function-map "\e[H" [home])
+ (define-key iris-function-map "\e[172q" [C-home])
- ;;(define-key function-key-map "\e[A" [up])
- (define-key function-key-map "\e[182q" [C-up])
+ ;(define-key iris-function-map "\e[A" [up])
+ (define-key iris-function-map "\e[182q" [C-up])
- ;;(define-key function-key-map "\e[150q" [prior])
- (define-key function-key-map "\e[190q" [C-prior])
+ ;(define-key iris-function-map "\e[150q" [prior])
+ (define-key iris-function-map "\e[190q" [C-prior])
- (define-key function-key-map "\e[200q" [?\C-+])
- (define-key function-key-map "\e[201q" [?\M-+])
+ (define-key iris-function-map "\e[200q" [?\C-+])
+ (define-key iris-function-map "\e[201q" [?\M-+])
- ;;(define-key function-key-map "\e[D" [left])
- (define-key function-key-map "\e[174q" [C-left])
+ ;(define-key iris-function-map "\e[D" [left])
+ (define-key iris-function-map "\e[174q" [C-left])
- (define-key function-key-map "\e[000q" [begin])
- (define-key function-key-map "\e[184q" [C-begin])
+ (define-key iris-function-map "\e[000q" [begin])
+ (define-key iris-function-map "\e[184q" [C-begin])
- ;;(define-key function-key-map "\e[C" [right])
- (define-key function-key-map "\e[192q" [C-right])
+ ;(define-key iris-function-map "\e[C" [right])
+ (define-key iris-function-map "\e[192q" [C-right])
- ;;(define-key function-key-map "\e[146q" [end])
- (define-key function-key-map "\e[176q" [C-end])
+ ;(define-key iris-function-map "\e[146q" [end])
+ (define-key iris-function-map "\e[176q" [C-end])
- ;;(define-key function-key-map "\e[B" [down])
- (define-key function-key-map "\e[186q" [C-down])
+ ;(define-key iris-function-map "\e[B" [down])
+ (define-key iris-function-map "\e[186q" [C-down])
- ;;(define-key function-key-map "\e[154q" [next])
- (define-key function-key-map "\e[194q" [C-next])
+ ;(define-key iris-function-map "\e[154q" [next])
+ (define-key iris-function-map "\e[194q" [C-next])
- (define-key function-key-map "\e[100q" [M-enter])
+ (define-key iris-function-map "\e[100q" [M-enter])
- (define-key function-key-map "\e[139q" [insert])
- (define-key function-key-map "\e[178q" [C-inset])
+ (define-key iris-function-map "\e[139q" [insert])
+ (define-key iris-function-map "\e[178q" [C-inset])
- (define-key function-key-map "\e[P" [delete])
- (define-key function-key-map "\e[196q" [C-delete])
- (define-key function-key-map "\e[197q" [M-delete]))
+ (define-key iris-function-map "\e[P" [delete])
+ (define-key iris-function-map "\e[196q" [C-delete])
+ (define-key iris-function-map "\e[197q" [M-delete]))
+
+(defun terminal-init-iris-ansi ()
+ "Terminal initialization function for iris-ansi."
+ ;; The terminal-local stuff only need to be set up on the first
+ ;; frame on that device.
+ (when (eq 1 (length (frames-on-display-list)))
+ ;; Use inheritance to let the main keymap override these defaults.
+ ;; This way we don't override terminfo-derived settings or settings
+ ;; made in the .emacs file.
+ (let ((m (copy-keymap iris-function-map)))
+ (set-keymap-parent m (keymap-parent local-function-key-map))
+ (set-keymap-parent local-function-key-map m))))
;;; arch-tag: b1d0e73a-bb7d-47be-9fb2-6fb126469a1b
;;; iris-ansi.el ends here
diff --git a/lisp/term/lk201.el b/lisp/term/lk201.el
index 1f8d9ca77a3..45271bca700 100644
--- a/lisp/term/lk201.el
+++ b/lisp/term/lk201.el
@@ -1,72 +1,91 @@
;; -*- no-byte-compile: t -*-
;; Define function key sequences for DEC terminals.
-;; Termcap or terminfo should set these.
-;; (define-key function-key-map "\e[A" [up])
-;; (define-key function-key-map "\e[B" [down])
-;; (define-key function-key-map "\e[C" [right])
-;; (define-key function-key-map "\e[D" [left])
+(defvar lk201-function-map nil
+ "Function key definitions for DEC terminals.")
-(define-key function-key-map "\e[1~" [find])
-(define-key function-key-map "\e[2~" [insert])
-(define-key function-key-map "\e[3~" [delete])
-(define-key function-key-map "\e[4~" [select])
-(define-key function-key-map "\e[5~" [prior])
-(define-key function-key-map "\e[6~" [next])
-(define-key function-key-map "\e[11~" [f1])
-(define-key function-key-map "\e[12~" [f2])
-(define-key function-key-map "\e[13~" [f3])
-(define-key function-key-map "\e[14~" [f4])
-(define-key function-key-map "\e[15~" [f5])
-(define-key function-key-map "\e[17~" [f6])
-(define-key function-key-map "\e[18~" [f7])
-(define-key function-key-map "\e[19~" [f8])
-(define-key function-key-map "\e[20~" [f9])
-(define-key function-key-map "\e[21~" [f10])
-;; Customarily F11 is used as the ESC key.
-;; The file that includes this one, takes care of that.
-(define-key function-key-map "\e[23~" [f11])
-(define-key function-key-map "\e[24~" [f12])
-(define-key function-key-map "\e[25~" [f13])
-(define-key function-key-map "\e[26~" [f14])
-(define-key function-key-map "\e[28~" [help])
-(define-key function-key-map "\e[29~" [menu])
-(define-key function-key-map "\e[31~" [f17])
-(define-key function-key-map "\e[32~" [f18])
-(define-key function-key-map "\e[33~" [f19])
-(define-key function-key-map "\e[34~" [f20])
+;; Make reloads faster.
+(unless lk201-function-map
+ (setq lk201-function-map (make-sparse-keymap))
-;; Termcap or terminfo should set these.
-;; (define-key function-key-map "\eOA" [up])
-;; (define-key function-key-map "\eOB" [down])
-;; (define-key function-key-map "\eOC" [right])
-;; (define-key function-key-map "\eOD" [left])
+ ;; Termcap or terminfo should set these.
+ ;; (define-key lk201-function-map "\e[A" [up])
+ ;; (define-key lk201-function-map "\e[B" [down])
+ ;; (define-key lk201-function-map "\e[C" [right])
+ ;; (define-key lk201-function-map "\e[D" [left])
-;; Termcap or terminfo should set these, but doesn't properly.
-;; Termcap sets these to k1-k4, which get mapped to f1-f4 in term.c
-(define-key function-key-map "\eOP" [kp-f1])
-(define-key function-key-map "\eOQ" [kp-f2])
-(define-key function-key-map "\eOR" [kp-f3])
-(define-key function-key-map "\eOS" [kp-f4])
+ (define-key lk201-function-map "\e[1~" [find])
+ (define-key lk201-function-map "\e[2~" [insert])
+ (define-key lk201-function-map "\e[3~" [delete])
+ (define-key lk201-function-map "\e[4~" [select])
+ (define-key lk201-function-map "\e[5~" [prior])
+ (define-key lk201-function-map "\e[6~" [next])
+ (define-key lk201-function-map "\e[11~" [f1])
+ (define-key lk201-function-map "\e[12~" [f2])
+ (define-key lk201-function-map "\e[13~" [f3])
+ (define-key lk201-function-map "\e[14~" [f4])
+ (define-key lk201-function-map "\e[15~" [f5])
+ (define-key lk201-function-map "\e[17~" [f6])
+ (define-key lk201-function-map "\e[18~" [f7])
+ (define-key lk201-function-map "\e[19~" [f8])
+ (define-key lk201-function-map "\e[20~" [f9])
+ (define-key lk201-function-map "\e[21~" [f10])
+ ;; Customarily F11 is used as the ESC key.
+ ;; The file that includes this one, takes care of that.
+ (define-key lk201-function-map "\e[23~" [f11])
+ (define-key lk201-function-map "\e[24~" [f12])
+ (define-key lk201-function-map "\e[25~" [f13])
+ (define-key lk201-function-map "\e[26~" [f14])
+ (define-key lk201-function-map "\e[28~" [help])
+ (define-key lk201-function-map "\e[29~" [menu])
+ (define-key lk201-function-map "\e[31~" [f17])
+ (define-key lk201-function-map "\e[32~" [f18])
+ (define-key lk201-function-map "\e[33~" [f19])
+ (define-key lk201-function-map "\e[34~" [f20])
-(define-key function-key-map "\eOI" [kp-tab])
-(define-key function-key-map "\eOj" [kp-multiply])
-(define-key function-key-map "\eOk" [kp-add])
-(define-key function-key-map "\eOl" [kp-separator])
-(define-key function-key-map "\eOM" [kp-enter])
-(define-key function-key-map "\eOm" [kp-subtract])
-(define-key function-key-map "\eOn" [kp-decimal])
-(define-key function-key-map "\eOo" [kp-divide])
-(define-key function-key-map "\eOp" [kp-0])
-(define-key function-key-map "\eOq" [kp-1])
-(define-key function-key-map "\eOr" [kp-2])
-(define-key function-key-map "\eOs" [kp-3])
-(define-key function-key-map "\eOt" [kp-4])
-(define-key function-key-map "\eOu" [kp-5])
-(define-key function-key-map "\eOv" [kp-6])
-(define-key function-key-map "\eOw" [kp-7])
-(define-key function-key-map "\eOx" [kp-8])
-(define-key function-key-map "\eOy" [kp-9])
+ ;; Termcap or terminfo should set these.
+ ;; (define-key lk201-function-map "\eOA" [up])
+ ;; (define-key lk201-function-map "\eOB" [down])
+ ;; (define-key lk201-function-map "\eOC" [right])
+ ;; (define-key lk201-function-map "\eOD" [left])
+
+ ;; Termcap or terminfo should set these, but doesn't properly.
+ ;; Termcap sets these to k1-k4, which get mapped to f1-f4 in term.c
+ (define-key lk201-function-map "\eOP" [kp-f1])
+ (define-key lk201-function-map "\eOQ" [kp-f2])
+ (define-key lk201-function-map "\eOR" [kp-f3])
+ (define-key lk201-function-map "\eOS" [kp-f4])
+
+ (define-key lk201-function-map "\eOI" [kp-tab])
+ (define-key lk201-function-map "\eOj" [kp-multiply])
+ (define-key lk201-function-map "\eOk" [kp-add])
+ (define-key lk201-function-map "\eOl" [kp-separator])
+ (define-key lk201-function-map "\eOM" [kp-enter])
+ (define-key lk201-function-map "\eOm" [kp-subtract])
+ (define-key lk201-function-map "\eOn" [kp-decimal])
+ (define-key lk201-function-map "\eOo" [kp-divide])
+ (define-key lk201-function-map "\eOp" [kp-0])
+ (define-key lk201-function-map "\eOq" [kp-1])
+ (define-key lk201-function-map "\eOr" [kp-2])
+ (define-key lk201-function-map "\eOs" [kp-3])
+ (define-key lk201-function-map "\eOt" [kp-4])
+ (define-key lk201-function-map "\eOu" [kp-5])
+ (define-key lk201-function-map "\eOv" [kp-6])
+ (define-key lk201-function-map "\eOw" [kp-7])
+ (define-key lk201-function-map "\eOx" [kp-8])
+ (define-key lk201-function-map "\eOy" [kp-9]))
+
+(defun terminal-init-lk201 ()
+ ;; The terminal-local stuff only need to be set up on the first
+ ;; frame on that device.
+ (when (eq 1 (length (frames-on-display-list)))
+
+ ;; Use inheritance to let the main keymap override these defaults.
+ ;; This way we don't override terminfo-derived settings or settings
+ ;; made in the .emacs file.
+ (let ((m (copy-keymap lk201-function-map)))
+ (set-keymap-parent m (keymap-parent local-function-key-map))
+ (set-keymap-parent local-function-key-map m))))
;;; arch-tag: 7ffb4444-6a23-43e1-b457-43cf4f673c0d
;;; lk201.el ends here
diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el
index 88d6ef7da2c..7912bb1a4d6 100644
--- a/lisp/term/mac-win.el
+++ b/lisp/term/mac-win.el
@@ -1060,20 +1060,20 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
;; Map certain keypad keys into ASCII characters
;; that people usually expect.
-(define-key function-key-map [backspace] [?\d])
-(define-key function-key-map [delete] [?\d])
-(define-key function-key-map [tab] [?\t])
-(define-key function-key-map [linefeed] [?\n])
-(define-key function-key-map [clear] [?\C-l])
-(define-key function-key-map [return] [?\C-m])
-(define-key function-key-map [escape] [?\e])
-(define-key function-key-map [M-backspace] [?\M-\d])
-(define-key function-key-map [M-delete] [?\M-\d])
-(define-key function-key-map [M-tab] [?\M-\t])
-(define-key function-key-map [M-linefeed] [?\M-\n])
-(define-key function-key-map [M-clear] [?\M-\C-l])
-(define-key function-key-map [M-return] [?\M-\C-m])
-(define-key function-key-map [M-escape] [?\M-\e])
+(define-key local-function-key-map [backspace] [?\d])
+(define-key local-function-key-map [delete] [?\d])
+(define-key local-function-key-map [tab] [?\t])
+(define-key local-function-key-map [linefeed] [?\n])
+(define-key local-function-key-map [clear] [?\C-l])
+(define-key local-function-key-map [return] [?\C-m])
+(define-key local-function-key-map [escape] [?\e])
+(define-key local-function-key-map [M-backspace] [?\M-\d])
+(define-key local-function-key-map [M-delete] [?\M-\d])
+(define-key local-function-key-map [M-tab] [?\M-\t])
+(define-key local-function-key-map [M-linefeed] [?\M-\n])
+(define-key local-function-key-map [M-clear] [?\M-\C-l])
+(define-key local-function-key-map [M-return] [?\M-\C-m])
+(define-key local-function-key-map [M-escape] [?\M-\e])
;; These tell read-char how to convert
;; these special chars to ASCII.
diff --git a/lisp/term/news.el b/lisp/term/news.el
index 014ecb1cc13..ab2d10158c8 100644
--- a/lisp/term/news.el
+++ b/lisp/term/news.el
@@ -34,7 +34,7 @@
(if (boundp 'news-fkey-prefix)
nil
;; The terminal initialization should already have set up some keys
- (setq news-fkey-prefix (lookup-key function-key-map "\eO"))
+ (setq news-fkey-prefix (lookup-key local-function-key-map "\eO"))
(if (not (keymapp news-fkey-prefix))
(error "What? Your news termcap/terminfo has no keycaps in it"))
diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el
index 7cd02570d84..cb3d019d640 100644
--- a/lisp/term/rxvt.el
+++ b/lisp/term/rxvt.el
@@ -26,138 +26,151 @@
;;; Code:
-(defun terminal-init-rxvt ()
- "Terminal initialization function for rxvt."
- ;; The terminal intialization C code file might have initialized
- ;; function keys F11->F42 from the termcap/terminfo information. On
- ;; a PC-style keyboard these keys correspond to
- ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C-, C-S-. The
- ;; code here subsitutes the corresponding defintions in
- ;; function-key-map. This substitution is needed because if a key
- ;; definition if found in function-key-map, there are no further
- ;; lookups in other keymaps.
- (substitute-key-definition [f11] [S-f1] function-key-map)
- (substitute-key-definition [f12] [S-f2] function-key-map)
- (substitute-key-definition [f13] [S-f3] function-key-map)
- (substitute-key-definition [f14] [S-f4] function-key-map)
- (substitute-key-definition [f15] [S-f5] function-key-map)
- (substitute-key-definition [f16] [S-f6] function-key-map)
- (substitute-key-definition [f17] [S-f7] function-key-map)
- (substitute-key-definition [f18] [S-f8] function-key-map)
- (substitute-key-definition [f19] [S-f9] function-key-map)
- (substitute-key-definition [f20] [S-f10] function-key-map)
+(require 'server)
- (substitute-key-definition [f23] [C-f1] function-key-map)
- (substitute-key-definition [f24] [C-f2] function-key-map)
- (substitute-key-definition [f25] [C-f3] function-key-map)
- (substitute-key-definition [f26] [C-f4] function-key-map)
- (substitute-key-definition [f27] [C-f5] function-key-map)
- (substitute-key-definition [f28] [C-f6] function-key-map)
- (substitute-key-definition [f29] [C-f7] function-key-map)
- (substitute-key-definition [f30] [C-f8] function-key-map)
- (substitute-key-definition [f31] [C-f9] function-key-map)
- (substitute-key-definition [f32] [C-f10] function-key-map)
+(defvar rxvt-function-map nil
+ "Function key overrides for rxvt.")
- (substitute-key-definition [f33] [C-S-f1] function-key-map)
- (substitute-key-definition [f34] [C-S-f2] function-key-map)
- (substitute-key-definition [f35] [C-S-f3] function-key-map)
- (substitute-key-definition [f36] [C-S-f4] function-key-map)
- (substitute-key-definition [f37] [C-S-f5] function-key-map)
- (substitute-key-definition [f38] [C-S-f6] function-key-map)
- (substitute-key-definition [f39] [C-S-f7] function-key-map)
- (substitute-key-definition [f40] [C-S-f8] function-key-map)
- (substitute-key-definition [f41] [C-S-f9] function-key-map)
- (substitute-key-definition [f42] [C-S-f10] function-key-map)
+;; Protect against reloads.
+(unless rxvt-function-map
+ (setq rxvt-function-map (make-sparse-keymap))
;; Set up function-key-map entries that termcap and terminfo don't know.
- (let ((map (make-sparse-keymap)))
- (define-key map "\e[A" [up])
- (define-key map "\e[B" [down])
- (define-key map "\e[C" [right])
- (define-key map "\e[D" [left])
- (define-key map "\e[2~" [insert])
- (define-key map "\e[3~" [delete])
- (define-key map "\e[4~" [select])
- (define-key map "\e[5~" [prior])
- (define-key map "\e[6~" [next])
- (define-key map "\e[7~" [home])
- (define-key map "\e[8~" [end])
- (define-key map "\e[11~" [f1])
- (define-key map "\e[12~" [f2])
- (define-key map "\e[13~" [f3])
- (define-key map "\e[14~" [f4])
- (define-key map "\e[15~" [f5])
- (define-key map "\e[17~" [f6])
- (define-key map "\e[18~" [f7])
- (define-key map "\e[19~" [f8])
- (define-key map "\e[20~" [f9])
- (define-key map "\e[21~" [f10])
- ;; The strings emitted by f11 and f12 are the same as the strings
- ;; emitted by S-f1 and S-f2, so don't define f11 and f12.
- ;; (define-key map "\e[23~" [f11])
- ;; (define-key map "\e[24~" [f12])
- (define-key map "\e[29~" [print])
+ (define-key rxvt-function-map "\e[A" [up])
+ (define-key rxvt-function-map "\e[B" [down])
+ (define-key rxvt-function-map "\e[C" [right])
+ (define-key rxvt-function-map "\e[D" [left])
+ (define-key rxvt-function-map "\e[2~" [insert])
+ (define-key rxvt-function-map "\e[3~" [delete])
+ (define-key rxvt-function-map "\e[4~" [select])
+ (define-key rxvt-function-map "\e[5~" [prior])
+ (define-key rxvt-function-map "\e[6~" [next])
+ (define-key rxvt-function-map "\e[7~" [home])
+ (define-key rxvt-function-map "\e[8~" [end])
+ (define-key rxvt-function-map "\e[11~" [f1])
+ (define-key rxvt-function-map "\e[12~" [f2])
+ (define-key rxvt-function-map "\e[13~" [f3])
+ (define-key rxvt-function-map "\e[14~" [f4])
+ (define-key rxvt-function-map "\e[15~" [f5])
+ (define-key rxvt-function-map "\e[17~" [f6])
+ (define-key rxvt-function-map "\e[18~" [f7])
+ (define-key rxvt-function-map "\e[19~" [f8])
+ (define-key rxvt-function-map "\e[20~" [f9])
+ (define-key rxvt-function-map "\e[21~" [f10])
+ ;; The strings emitted by f11 and f12 are the same as the strings
+ ;; emitted by S-f1 and S-f2, so don't define f11 and f12.
+ ;; (define-key rxvt-function-map "\e[23~" [f11])
+ ;; (define-key rxvt-function-map "\e[24~" [f12])
+ (define-key rxvt-function-map "\e[29~" [print])
+
+ (define-key rxvt-function-map "\e[11^" [C-f1])
+ (define-key rxvt-function-map "\e[12^" [C-f2])
+ (define-key rxvt-function-map "\e[13^" [C-f3])
+ (define-key rxvt-function-map "\e[14^" [C-f4])
+ (define-key rxvt-function-map "\e[15^" [C-f5])
+ (define-key rxvt-function-map "\e[17^" [C-f6])
+ (define-key rxvt-function-map "\e[18^" [C-f7])
+ (define-key rxvt-function-map "\e[19^" [C-f8])
+ (define-key rxvt-function-map "\e[20^" [C-f9])
+ (define-key rxvt-function-map "\e[21^" [C-f10])
+
+ (define-key rxvt-function-map "\e[23~" [S-f1])
+ (define-key rxvt-function-map "\e[24~" [S-f2])
+ (define-key rxvt-function-map "\e[25~" [S-f3])
+ (define-key rxvt-function-map "\e[26~" [S-f4])
+ (define-key rxvt-function-map "\e[28~" [S-f5])
+ (define-key rxvt-function-map "\e[29~" [S-f6])
+ (define-key rxvt-function-map "\e[31~" [S-f7])
+ (define-key rxvt-function-map "\e[32~" [S-f8])
+ (define-key rxvt-function-map "\e[33~" [S-f9])
+ (define-key rxvt-function-map "\e[34~" [S-f10])
- (define-key map "\e[11^" [C-f1])
- (define-key map "\e[12^" [C-f2])
- (define-key map "\e[13^" [C-f3])
- (define-key map "\e[14^" [C-f4])
- (define-key map "\e[15^" [C-f5])
- (define-key map "\e[17^" [C-f6])
- (define-key map "\e[18^" [C-f7])
- (define-key map "\e[19^" [C-f8])
- (define-key map "\e[20^" [C-f9])
- (define-key map "\e[21^" [C-f10])
+ (define-key rxvt-function-map "\e[23^" [C-S-f1])
+ (define-key rxvt-function-map "\e[24^" [C-S-f2])
+ (define-key rxvt-function-map "\e[25^" [C-S-f3])
+ (define-key rxvt-function-map "\e[26^" [C-S-f4])
+ (define-key rxvt-function-map "\e[28^" [C-S-f5])
+ (define-key rxvt-function-map "\e[29^" [C-S-f6])
+ (define-key rxvt-function-map "\e[31^" [C-S-f7])
+ (define-key rxvt-function-map "\e[32^" [C-S-f8])
+ (define-key rxvt-function-map "\e[33^" [C-S-f9])
+ (define-key rxvt-function-map "\e[34^" [C-S-f10])
- (define-key map "\e[23~" [S-f1])
- (define-key map "\e[24~" [S-f2])
- (define-key map "\e[25~" [S-f3])
- (define-key map "\e[26~" [S-f4])
- (define-key map "\e[28~" [S-f5])
- (define-key map "\e[29~" [S-f6])
- (define-key map "\e[31~" [S-f7])
- (define-key map "\e[32~" [S-f8])
- (define-key map "\e[33~" [S-f9])
- (define-key map "\e[34~" [S-f10])
+ (define-key rxvt-function-map "\e[2^" [C-insert])
+ (define-key rxvt-function-map "\e[3^" [C-delete])
+ (define-key rxvt-function-map "\e[5^" [C-prior])
+ (define-key rxvt-function-map "\e[6^" [C-next])
+ (define-key rxvt-function-map "\e[7^" [C-home])
+ (define-key rxvt-function-map "\e[8^" [C-end])
+ (define-key rxvt-function-map "\eOd" [C-left])
+ (define-key rxvt-function-map "\eOc" [C-right])
+ (define-key rxvt-function-map "\eOa" [C-up])
+ (define-key rxvt-function-map "\eOb" [C-down])
+
+ (define-key rxvt-function-map "\e[2;2~" [S-insert])
+ (define-key rxvt-function-map "\e[3$" [S-delete])
+ (define-key rxvt-function-map "\e[5$" [S-prior])
+ (define-key rxvt-function-map "\e[6$" [S-next])
+ (define-key rxvt-function-map "\e[7$" [S-home])
+ (define-key rxvt-function-map "\e[8$" [S-end])
+ (define-key rxvt-function-map "\e[d" [S-left])
+ (define-key rxvt-function-map "\e[c" [S-right])
+ (define-key rxvt-function-map "\e[a" [S-up])
+ (define-key rxvt-function-map "\e[b" [S-down]))
+
+(defun terminal-init-rxvt ()
+ "Terminal initialization function for rxvt."
- (define-key map "\e[23^" [C-S-f1])
- (define-key map "\e[24^" [C-S-f2])
- (define-key map "\e[25^" [C-S-f3])
- (define-key map "\e[26^" [C-S-f4])
- (define-key map "\e[28^" [C-S-f5])
- (define-key map "\e[29^" [C-S-f6])
- (define-key map "\e[31^" [C-S-f7])
- (define-key map "\e[32^" [C-S-f8])
- (define-key map "\e[33^" [C-S-f9])
- (define-key map "\e[34^" [C-S-f10])
+ ;; The terminal-local stuff only need to be set up on the first
+ ;; frame on that device.
+ (when (eq 1 (length (frames-on-display-list)))
+ ;; The terminal intialization C code file might have initialized
+ ;; function keys F11->F42 from the termcap/terminfo information. On
+ ;; a PC-style keyboard these keys correspond to
+ ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C-, C-S-. The
+ ;; code here subsitutes the corresponding defintions in
+ ;; function-key-map. This substitution is needed because if a key
+ ;; definition if found in function-key-map, there are no further
+ ;; lookups in other keymaps.
+ (substitute-key-definition [f11] [S-f1] local-function-key-map)
+ (substitute-key-definition [f12] [S-f2] local-function-key-map)
+ (substitute-key-definition [f13] [S-f3] local-function-key-map)
+ (substitute-key-definition [f14] [S-f4] local-function-key-map)
+ (substitute-key-definition [f15] [S-f5] local-function-key-map)
+ (substitute-key-definition [f16] [S-f6] local-function-key-map)
+ (substitute-key-definition [f17] [S-f7] local-function-key-map)
+ (substitute-key-definition [f18] [S-f8] local-function-key-map)
+ (substitute-key-definition [f19] [S-f9] local-function-key-map)
+ (substitute-key-definition [f20] [S-f10] local-function-key-map)
- (define-key map "\e[2^" [C-insert])
- (define-key map "\e[3^" [C-delete])
- (define-key map "\e[5^" [C-prior])
- (define-key map "\e[6^" [C-next])
- (define-key map "\e[7^" [C-home])
- (define-key map "\e[8^" [C-end])
- (define-key map "\eOd" [C-left])
- (define-key map "\eOc" [C-right])
- (define-key map "\eOa" [C-up])
- (define-key map "\eOb" [C-down])
+ (substitute-key-definition [f23] [C-f1] local-function-key-map)
+ (substitute-key-definition [f24] [C-f2] local-function-key-map)
+ (substitute-key-definition [f25] [C-f3] local-function-key-map)
+ (substitute-key-definition [f26] [C-f4] local-function-key-map)
+ (substitute-key-definition [f27] [C-f5] local-function-key-map)
+ (substitute-key-definition [f28] [C-f6] local-function-key-map)
+ (substitute-key-definition [f29] [C-f7] local-function-key-map)
+ (substitute-key-definition [f30] [C-f8] local-function-key-map)
+ (substitute-key-definition [f31] [C-f9] local-function-key-map)
+ (substitute-key-definition [f32] [C-f10] local-function-key-map)
- (define-key map "\e[2;2~" [S-insert])
- (define-key map "\e[3$" [S-delete])
- (define-key map "\e[5$" [S-prior])
- (define-key map "\e[6$" [S-next])
- (define-key map "\e[7$" [S-home])
- (define-key map "\e[8$" [S-end])
- (define-key map "\e[d" [S-left])
- (define-key map "\e[c" [S-right])
- (define-key map "\e[a" [S-up])
- (define-key map "\e[b" [S-down])
+ (substitute-key-definition [f33] [C-S-f1] local-function-key-map)
+ (substitute-key-definition [f34] [C-S-f2] local-function-key-map)
+ (substitute-key-definition [f35] [C-S-f3] local-function-key-map)
+ (substitute-key-definition [f36] [C-S-f4] local-function-key-map)
+ (substitute-key-definition [f37] [C-S-f5] local-function-key-map)
+ (substitute-key-definition [f38] [C-S-f6] local-function-key-map)
+ (substitute-key-definition [f39] [C-S-f7] local-function-key-map)
+ (substitute-key-definition [f40] [C-S-f8] local-function-key-map)
+ (substitute-key-definition [f41] [C-S-f9] local-function-key-map)
+ (substitute-key-definition [f42] [C-S-f10] local-function-key-map)
;; Use inheritance to let the main keymap override those defaults.
;; This way we don't override terminfo-derived settings or settings
;; made in the .emacs file.
- (set-keymap-parent map (keymap-parent function-key-map))
- (set-keymap-parent function-key-map map))
+ (let ((m (copy-keymap rxvt-function-map)))
+ (set-keymap-parent m (keymap-parent local-function-key-map))
+ (set-keymap-parent local-function-key-map m)))
;; Initialize colors and background mode.
(rxvt-register-default-colors)
@@ -280,7 +293,7 @@ for the currently selected frame."
;; intelligent way than the default guesswork in startup.el.
(defun rxvt-set-background-mode ()
"Set background mode as appropriate for the default rxvt colors."
- (let ((fgbg (getenv "COLORFGBG"))
+ (let ((fgbg (server-getenv "COLORFGBG"))
bg rgb)
(setq default-frame-background-mode 'light)
(when (and fgbg
diff --git a/lisp/term/sun.el b/lisp/term/sun.el
index 3963a18efdb..99e3ec28c7c 100644
--- a/lisp/term/sun.el
+++ b/lisp/term/sun.el
@@ -150,7 +150,7 @@
(defun terminal-init-sun ()
"Terminal initialization function for sun."
- (define-key function-key-map "\e[" sun-raw-prefix)
+ (define-key local-function-key-map "\e[" sun-raw-prefix)
(define-key sun-raw-prefix "210z" [r3])
(define-key sun-raw-prefix "213z" [r6])
diff --git a/lisp/term/tvi970.el b/lisp/term/tvi970.el
index 23eea911b79..647e4cc2745 100644
--- a/lisp/term/tvi970.el
+++ b/lisp/term/tvi970.el
@@ -30,14 +30,14 @@
(defun terminal-init-tvi970 ()
"Terminal initialization function for tvi970."
- (or (lookup-key function-key-map "\e[")
- (define-key function-key-map "\e[" (make-keymap)))
- ;; (or (lookup-key function-key-map "\eO")
- ;; (define-key function-key-map "\eO" (make-keymap)))
+ (or (lookup-key local-function-key-map "\e[")
+ (define-key local-function-key-map "\e[" (make-keymap)))
+ ;; (or (lookup-key local-function-key-map "\eO")
+ ;; (define-key local-function-key-map "\eO" (make-keymap)))
;; Miscellaneous keys
(mapcar (function (lambda (key-binding)
- (define-key function-key-map
+ (define-key local-function-key-map
(car key-binding) (nth 1 key-binding))))
'(
;; These are set up by termcap or terminfo
@@ -53,7 +53,7 @@
("\e[@" [insert])
("\e[L" [insertline])
("\e[M" [deleteline])
- ("\e[U" [next]) ;; actually the `page' key
+ ("\e[U" [next]) ;; actually the `page' key
;; These won't be set up by either
("\eOm" [kp-subtract])
@@ -86,22 +86,23 @@
;; The numeric keypad keys.
(let ((i 0))
(while (< i 10)
- (define-key function-key-map
+ (define-key local-function-key-map
(format "\eO%c" (+ i ?p))
(vector (intern (format "kp-%d" i))))
(setq i (1+ i))))
;; The numbered function keys.
(let ((i 0))
(while (< i 16)
- (define-key function-key-map
+ (define-key local-function-key-map
(format "\e?%c" (+ i ?a))
(vector (intern (format "f%d" (1+ i)))))
- (define-key function-key-map
+ (define-key local-function-key-map
(format "\e?%c" (+ i ?A))
(vector (intern (format "S-f%d" (1+ i)))))
(setq i (1+ i))))
(tvi970-set-keypad-mode 1))
+
;;; Should keypad numbers send ordinary digits or distinct escape sequences?
(defvar tvi970-keypad-numeric nil
diff --git a/lisp/term/vt100.el b/lisp/term/vt100.el
index 3f744a5212a..9822bd6e5a2 100644
--- a/lisp/term/vt100.el
+++ b/lisp/term/vt100.el
@@ -38,10 +38,9 @@
;; Set up function-key-map entries that termcap and terminfo don't know.
-
(defun terminal-init-vt100 ()
"Terminal initialization function for vt100."
- (load "term/lk201" nil t))
+ (terminal-init-lk201))
;;; Controlling the screen width.
(defvar vt100-wide-mode (= (frame-width) 132)
diff --git a/lisp/term/vt102.el b/lisp/term/vt102.el
index ad780ed5081..ba4ac80c92a 100644
--- a/lisp/term/vt102.el
+++ b/lisp/term/vt102.el
@@ -2,7 +2,7 @@
(defun terminal-init-vt102 ()
"Terminal initialization function for vt102."
- (load "term/vt100" nil t))
+ (terminal-init-vt100))
;;; arch-tag: 6e839cfc-125a-4574-82f1-c23a51f7c50f
;;; vt102.el ends here
diff --git a/lisp/term/vt125.el b/lisp/term/vt125.el
index 2221e597aed..369dc5f28b9 100644
--- a/lisp/term/vt125.el
+++ b/lisp/term/vt125.el
@@ -2,7 +2,7 @@
(defun terminal-init-vt125 ()
"Terminal initialization function for vt125."
- (load "term/vt100" nil t))
+ (terminal-init-vt100))
;;; arch-tag: 1d92d70f-dd55-4a1d-9088-e215a4883801
;;; vt125.el ends here
diff --git a/lisp/term/vt200.el b/lisp/term/vt200.el
index e1215d15023..fd31fd11263 100644
--- a/lisp/term/vt200.el
+++ b/lisp/term/vt200.el
@@ -1,12 +1,11 @@
;; -*- no-byte-compile: t -*-
;; For our purposes we can treat the vt200 and vt100 almost alike.
;; Most differences are handled by the termcap entry.
-
(defun terminal-init-vt200 ()
- "Terminal initialization function for vt200."
- (load "term/vt100" nil t)
+ "Terminal initialization function for vt200."
+ (terminal-init-vt100)
;; Make F11 an escape key.
- (define-key function-key-map "\e[23~" [?\e]))
+ (define-key local-function-key-map "\e[23~" [?\e]))
;;; arch-tag: 0f78f583-9f32-4237-b106-28bcfff21d89
;;; vt200.el ends here
diff --git a/lisp/term/vt201.el b/lisp/term/vt201.el
index 315030ab687..95243322403 100644
--- a/lisp/term/vt201.el
+++ b/lisp/term/vt201.el
@@ -2,10 +2,10 @@
;; For our purposes we can treat the vt200 and vt100 almost alike.
;; Most differences are handled by the termcap entry.
(defun terminal-init-vt201 ()
- "Terminal initialization function for vt201."
- (load "term/vt100" nil t)
+ "Terminal initialization function for vt201."
+ (terminal-init-vt100)
;; Make F11 an escape key.
- (define-key function-key-map "\e[23~" [?\e]))
+ (define-key local-function-key-map "\e[23~" [?\e]))
;;; arch-tag: a6abb38f-60ea-449e-a9e9-3fb8572c52ae
;;; vt201.el ends here
diff --git a/lisp/term/vt220.el b/lisp/term/vt220.el
index cccd2a6dfb7..7264b7d94a2 100644
--- a/lisp/term/vt220.el
+++ b/lisp/term/vt220.el
@@ -2,10 +2,10 @@
;; For our purposes we can treat the vt200 and vt100 almost alike.
;; Most differences are handled by the termcap entry.
(defun terminal-init-vt220 ()
- "Terminal initialization function for vt220."
- (load "term/vt100" nil t)
+ "Terminal initialization function for vt220."
+ (terminal-init-vt100)
;; Make F11 an escape key.
- (define-key function-key-map "\e[23~" [?\e]))
+ (define-key local-function-key-map "\e[23~" [?\e]))
;;; arch-tag: 98fc4867-a20d-46a1-a276-d7be31e49871
;;; vt220.el ends here
diff --git a/lisp/term/vt240.el b/lisp/term/vt240.el
index bb3931edac8..725e323c00c 100644
--- a/lisp/term/vt240.el
+++ b/lisp/term/vt240.el
@@ -2,10 +2,10 @@
;; For our purposes we can treat the vt200 and vt100 almost alike.
;; Most differences are handled by the termcap entry.
(defun terminal-init-vt240 ()
- "Terminal initialization function for vt240."
- (load "term/vt100" nil t)
+ "Terminal initialization function for vt240."
+ (terminal-init-vt100)
;; Make F11 an escape key.
- (define-key function-key-map "\e[23~" [?\e]))
+ (define-key local-function-key-map "\e[23~" [?\e]))
;;; arch-tag: d9f88e9c-02dc-49ff-871c-a415f08e4eb7
;;; vt240.el ends here
diff --git a/lisp/term/vt300.el b/lisp/term/vt300.el
index ff600f47a1e..fb749277d50 100644
--- a/lisp/term/vt300.el
+++ b/lisp/term/vt300.el
@@ -1,9 +1,9 @@
;; -*- no-byte-compile: t -*-
(defun terminal-init-vt300 ()
- "Terminal initialization function for vt300."
- (load "term/vt100" nil t)
+ "Terminal initialization function for vt300."
+ (terminal-init-vt100)
;; Make F11 an escape key.
- (define-key function-key-map "\e[23~" [?\e]))
+ (define-key local-function-key-map "\e[23~" [?\e]))
;;; arch-tag: 876831c9-a6f2-444a-b033-706e6fbc149f
;;; vt300.el ends here
diff --git a/lisp/term/vt320.el b/lisp/term/vt320.el
index fb7772c7b5b..3e52d27193b 100644
--- a/lisp/term/vt320.el
+++ b/lisp/term/vt320.el
@@ -1,9 +1,9 @@
;; -*- no-byte-compile: t -*-
(defun terminal-init-vt320 ()
- "Terminal initialization function for vt320."
- (load "term/vt100" nil t)
+ "Terminal initialization function for vt320."
+ (terminal-init-vt100)
;; Make F11 an escape key.
- (define-key function-key-map "\e[23~" [?\e]))
+ (define-key local-function-key-map "\e[23~" [?\e]))
;;; arch-tag: f9f4c954-0b9e-45f9-b450-a320d32abd9c
;;; vt320.el ends here
diff --git a/lisp/term/vt400.el b/lisp/term/vt400.el
index 97c0c5d7372..f1c7e3732d3 100644
--- a/lisp/term/vt400.el
+++ b/lisp/term/vt400.el
@@ -1,9 +1,9 @@
;; -*- no-byte-compile: t -*-
(defun terminal-init-vt400 ()
- "Terminal initialization function for vt400."
- (load "term/vt100" nil t)
+ "Terminal initialization function for vt400."
+ (terminal-init-vt100)
;; Make F11 an escape key.
- (define-key function-key-map "\e[23~" [?\e]))
+ (define-key local-function-key-map "\e[23~" [?\e]))
;;; arch-tag: a70809c5-6b21-42cc-ba20-536683e5e7d5
;;; vt400.el ends here
diff --git a/lisp/term/vt420.el b/lisp/term/vt420.el
index 65ffa759c17..4d3206cbca1 100644
--- a/lisp/term/vt420.el
+++ b/lisp/term/vt420.el
@@ -1,9 +1,9 @@
;; -*- no-byte-compile: t -*-
-(defun terminal-init-vt420 ()
- "Terminal initialization function for vt420."
- (load "term/vt100" nil t)
+(defun terminal-init-vt420
+ "Terminal initialization function for vt420."
+ (terminal-init-vt100)
;; Make F11 an escape key.
- (define-key function-key-map "\e[23~" [?\e]))
+ (define-key local-function-key-map "\e[23~" [?\e]))
;;; arch-tag: df2f897c-3a12-4b3c-9259-df089f96c160
;;; vt420.el ends here
diff --git a/lisp/term/wyse50.el b/lisp/term/wyse50.el
index 75f43420013..d561329d9c6 100644
--- a/lisp/term/wyse50.el
+++ b/lisp/term/wyse50.el
@@ -40,9 +40,9 @@
(defun terminal-init-wyse50 ()
"Terminal initialization function for wyse50."
- (define-key function-key-map "\C-a" (make-keymap))
+ (define-key local-function-key-map "\C-a" (make-keymap))
(mapcar (function (lambda (key-definition)
- (define-key function-key-map
+ (define-key local-function-key-map
(car key-definition) (nth 1 key-definition))))
'(
;; These might be set up by termcap and terminfo
@@ -100,11 +100,11 @@
("\eY" [key-clear]) ;; Not an X keysym
;; These are totally strange :-)
- ("\eW" [?\C-?]) ;; Not an X keysym
- ("\^a\^k\^m" [funct-up]) ;; Not an X keysym
- ("\^a\^j\^m" [funct-down]) ;; Not an X keysym
- ("\^a\^l\^m" [funct-right]) ;; Not an X keysym
- ("\^a\^h\^m" [funct-left]) ;; Not an X keysym
+ ("\eW" [?\C-?]) ;; Not an X keysym
+ ("\^a\^k\^m" [funct-up]) ;; Not an X keysym
+ ("\^a\^j\^m" [funct-down]) ;; Not an X keysym
+ ("\^a\^l\^m" [funct-right]) ;; Not an X keysym
+ ("\^a\^h\^m" [funct-left]) ;; Not an X keysym
("\^a\^m\^m" [funct-return]) ;; Not an X keysym
("\^a\^i\^m" [funct-tab]) ;; Not an X keysym
))
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index f38baa6b720..af168eb23ac 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -25,10 +25,16 @@
;;; Commentary:
-;; X-win.el: this file is loaded from ../lisp/startup.el when it recognizes
-;; that X windows are to be used. Command line switches are parsed and those
-;; pertaining to X are processed and removed from the command line. The
-;; X display is opened and hooks are set for popping up the initial window.
+;; X-win.el: this file defines functions to initialize the X window
+;; system and process X-specific command line parameters before
+;; creating the first X frame.
+
+;; Note that contrary to previous Emacs versions, the act of loading
+;; this file should not have the side effect of initializing the
+;; window system or processing command line arguments (this file is
+;; now loaded in loadup.el). See the variables
+;; `handle-args-function-alist' and
+;; `window-system-initialization-alist' for more details.
;; startup.el will then examine startup files, and eventually call the hooks
;; which create the first window(s).
@@ -65,7 +71,7 @@
;; An alist of X options and the function which handles them. See
;; ../startup.el.
-(if (not (eq window-system 'x))
+(if (not (fboundp 'x-create-frame))
(error "%s: Loading x-win.el but not compiled for X" (invocation-name)))
(require 'frame)
@@ -76,6 +82,7 @@
(require 'menu-bar)
(require 'fontset)
(require 'x-dnd)
+(require 'server)
(defvar x-invocation-args)
(defvar x-keysym-table)
@@ -1163,27 +1170,26 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
;;;; Function keys
-(substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
- global-map)
-
-;; Map certain keypad keys into ASCII characters
-;; that people usually expect.
-(define-key function-key-map [backspace] [127])
-(define-key function-key-map [delete] [127])
-(define-key function-key-map [tab] [?\t])
-(define-key function-key-map [linefeed] [?\n])
-(define-key function-key-map [clear] [?\C-l])
-(define-key function-key-map [return] [?\C-m])
-(define-key function-key-map [escape] [?\e])
-(define-key function-key-map [M-backspace] [?\M-\d])
-(define-key function-key-map [M-delete] [?\M-\d])
-(define-key function-key-map [M-tab] [?\M-\t])
-(define-key function-key-map [M-linefeed] [?\M-\n])
-(define-key function-key-map [M-clear] [?\M-\C-l])
-(define-key function-key-map [M-return] [?\M-\C-m])
-(define-key function-key-map [M-escape] [?\M-\e])
-(define-key function-key-map [iso-lefttab] [backtab])
-(define-key function-key-map [S-iso-lefttab] [backtab])
+(defun x-setup-function-keys (frame)
+ "Set up `function-key-map' on FRAME for the X window system."
+ ;; Map certain keypad keys into ASCII characters that people usually expect.
+ (with-selected-frame frame
+ (define-key local-function-key-map [backspace] [127])
+ (define-key local-function-key-map [delete] [127])
+ (define-key local-function-key-map [tab] [?\t])
+ (define-key local-function-key-map [linefeed] [?\n])
+ (define-key local-function-key-map [clear] [?\C-l])
+ (define-key local-function-key-map [return] [?\C-m])
+ (define-key local-function-key-map [escape] [?\e])
+ (define-key local-function-key-map [M-backspace] [?\M-\d])
+ (define-key local-function-key-map [M-delete] [?\M-\d])
+ (define-key local-function-key-map [M-tab] [?\M-\t])
+ (define-key local-function-key-map [M-linefeed] [?\M-\n])
+ (define-key local-function-key-map [M-clear] [?\M-\C-l])
+ (define-key local-function-key-map [M-return] [?\M-\C-m])
+ (define-key local-function-key-map [M-escape] [?\M-\e])
+ (define-key local-function-key-map [iso-lefttab] [backtab])
+ (define-key local-function-key-map [S-iso-lefttab] [backtab])))
;; These tell read-char how to convert
;; these special chars to ASCII.
@@ -2372,146 +2378,149 @@ order until succeed.")
(or clip-text primary-text cut-text)
))
-
-;;; Do the actual X Windows setup here; the above code just defines
-;;; functions and variables that we use now.
-
-(setq command-line-args (x-handle-args command-line-args))
-
-;;; Make sure we have a valid resource name.
-(or (stringp x-resource-name)
- (let (i)
- (setq x-resource-name (invocation-name))
-
- ;; Change any . or * characters in x-resource-name to hyphens,
- ;; so as not to choke when we use it in X resource queries.
- (while (setq i (string-match "[.*]" x-resource-name))
- (aset x-resource-name i ?-))))
-
-(x-open-connection (or x-display-name
- (setq x-display-name (getenv "DISPLAY")))
- x-command-line-resources
- ;; Exit Emacs with fatal error if this fails.
- t)
-
-(setq frame-creation-function 'x-create-frame-with-faces)
-
-(setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
- x-cut-buffer-max))
-
-;; Setup the default fontset.
-(setup-default-fontset)
-
-;; Create the standard fontset.
-(create-fontset-from-fontset-spec standard-fontset-spec t)
-
-;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...).
-(create-fontset-from-x-resource)
-
-;; Try to create a fontset from a font specification which comes
-;; from initial-frame-alist, default-frame-alist, or X resource.
-;; A font specification in command line argument (i.e. -fn XXXX)
-;; should be already in default-frame-alist as a `font'
-;; parameter. However, any font specifications in site-start
-;; library, user's init file (.emacs), and default.el are not
-;; yet handled here.
-
-(let ((font (or (cdr (assq 'font initial-frame-alist))
- (cdr (assq 'font default-frame-alist))
- (x-get-resource "font" "Font")))
- xlfd-fields resolved-name)
- (if (and font
- (not (query-fontset font))
- (setq resolved-name (x-resolve-font-name font))
- (setq xlfd-fields (x-decompose-font-name font)))
- (if (string= "fontset" (aref xlfd-fields xlfd-regexp-registry-subnum))
- (new-fontset font (x-complement-fontset-spec xlfd-fields nil))
- ;; Create a fontset from FONT. The fontset name is
- ;; generated from FONT.
- (create-fontset-from-ascii-font font resolved-name "startup"))))
-
-;; Apply a geometry resource to the initial frame. Put it at the end
-;; of the alist, so that anything specified on the command line takes
-;; precedence.
-(let* ((res-geometry (x-get-resource "geometry" "Geometry"))
- parsed)
- (if res-geometry
- (progn
- (setq parsed (x-parse-geometry res-geometry))
- ;; If the resource specifies a position,
- ;; call the position and size "user-specified".
- (if (or (assq 'top parsed) (assq 'left parsed))
- (setq parsed (cons '(user-position . t)
- (cons '(user-size . t) parsed))))
- ;; All geometry parms apply to the initial frame.
- (setq initial-frame-alist (append initial-frame-alist parsed))
- ;; The size parms apply to all frames.
- (if (assq 'height parsed)
- (setq default-frame-alist
- (cons (cons 'height (cdr (assq 'height parsed)))
- default-frame-alist)))
- (if (assq 'width parsed)
- (setq default-frame-alist
- (cons (cons 'width (cdr (assq 'width parsed)))
- default-frame-alist))))))
-
-;; Check the reverseVideo resource.
-(let ((case-fold-search t))
- (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
- (if (and rv
- (string-match "^\\(true\\|yes\\|on\\)$" rv))
- (setq default-frame-alist
- (cons '(reverse . t) default-frame-alist)))))
+(defun x-clipboard-yank ()
+ "Insert the clipboard contents, or the last stretch of killed text."
+ (interactive)
+ (let ((clipboard-text (x-selection-value 'CLIPBOARD))
+ (x-select-enable-clipboard t))
+ (if (and clipboard-text (> (length clipboard-text) 0))
+ (kill-new clipboard-text))
+ (yank)))
-;; Set x-selection-timeout, measured in milliseconds.
-(let ((res-selection-timeout
- (x-get-resource "selectionTimeout" "SelectionTimeout")))
- (setq x-selection-timeout 20000)
- (if res-selection-timeout
- (setq x-selection-timeout (string-to-number res-selection-timeout))))
+
+;;; Window system initialization.
(defun x-win-suspend-error ()
(error "Suspending an Emacs running under X makes no sense"))
-(add-hook 'suspend-hook 'x-win-suspend-error)
-;;; Arrange for the kill and yank functions to set and check the clipboard.
-(setq interprogram-cut-function 'x-select-text)
-(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
+(defvar x-initialized nil
+ "Non-nil if the X window system has been initialized.")
+
+(defun x-initialize-window-system ()
+ "Initialize Emacs for X frames and open the first connection to an X server."
+ ;; Make sure we have a valid resource name.
+ (or (stringp x-resource-name)
+ (let (i)
+ (setq x-resource-name (invocation-name))
+
+ ;; Change any . or * characters in x-resource-name to hyphens,
+ ;; so as not to choke when we use it in X resource queries.
+ (while (setq i (string-match "[.*]" x-resource-name))
+ (aset x-resource-name i ?-))))
+
+ (x-open-connection (or x-display-name
+ (setq x-display-name (server-getenv "DISPLAY")))
+ x-command-line-resources
+ ;; Exit Emacs with fatal error if this fails and we
+ ;; are the initial display.
+ (eq initial-window-system 'x))
+
+ (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
+ x-cut-buffer-max))
+
+ ;; Setup the default fontset.
+ (setup-default-fontset)
+
+ ;; Create the standard fontset.
+ (create-fontset-from-fontset-spec standard-fontset-spec t)
+
+ ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...).
+ (create-fontset-from-x-resource)
+
+ ;; Try to create a fontset from a font specification which comes
+ ;; from initial-frame-alist, default-frame-alist, or X resource.
+ ;; A font specification in command line argument (i.e. -fn XXXX)
+ ;; should be already in default-frame-alist as a `font'
+ ;; parameter. However, any font specifications in site-start
+ ;; library, user's init file (.emacs), and default.el are not
+ ;; yet handled here.
+
+ (let ((font (or (cdr (assq 'font initial-frame-alist))
+ (cdr (assq 'font default-frame-alist))
+ (x-get-resource "font" "Font")))
+ xlfd-fields resolved-name)
+ (if (and font
+ (not (query-fontset font))
+ (setq resolved-name (x-resolve-font-name font))
+ (setq xlfd-fields (x-decompose-font-name font)))
+ (if (string= "fontset" (aref xlfd-fields xlfd-regexp-registry-subnum))
+ (new-fontset font (x-complement-fontset-spec xlfd-fields nil))
+ ;; Create a fontset from FONT. The fontset name is
+ ;; generated from FONT.
+ (create-fontset-from-ascii-font font resolved-name "startup"))))
+
+ ;; Apply a geometry resource to the initial frame. Put it at the end
+ ;; of the alist, so that anything specified on the command line takes
+ ;; precedence.
+ (let* ((res-geometry (x-get-resource "geometry" "Geometry"))
+ parsed)
+ (if res-geometry
+ (progn
+ (setq parsed (x-parse-geometry res-geometry))
+ ;; If the resource specifies a position,
+ ;; call the position and size "user-specified".
+ (if (or (assq 'top parsed) (assq 'left parsed))
+ (setq parsed (cons '(user-position . t)
+ (cons '(user-size . t) parsed))))
+ ;; All geometry parms apply to the initial frame.
+ (setq initial-frame-alist (append initial-frame-alist parsed))
+ ;; The size parms apply to all frames.
+ (if (assq 'height parsed)
+ (setq default-frame-alist
+ (cons (cons 'height (cdr (assq 'height parsed)))
+ default-frame-alist)))
+ (if (assq 'width parsed)
+ (setq default-frame-alist
+ (cons (cons 'width (cdr (assq 'width parsed)))
+ default-frame-alist))))))
+
+ ;; Check the reverseVideo resource.
+ (let ((case-fold-search t))
+ (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
+ (if (and rv
+ (string-match "^\\(true\\|yes\\|on\\)$" rv))
+ (setq default-frame-alist
+ (cons '(reverse . t) default-frame-alist)))))
-;;; Turn off window-splitting optimization; X is usually fast enough
-;;; that this is only annoying.
-(setq split-window-keep-point t)
+ ;; Set x-selection-timeout, measured in milliseconds.
+ (let ((res-selection-timeout
+ (x-get-resource "selectionTimeout" "SelectionTimeout")))
+ (setq x-selection-timeout 20000)
+ (if res-selection-timeout
+ (setq x-selection-timeout (string-to-number res-selection-timeout))))
-;; Don't show the frame name; that's redundant with X.
-(setq-default mode-line-frame-identification " ")
+ ;; Don't let Emacs suspend under X.
+ (add-hook 'suspend-hook 'x-win-suspend-error)
-;; Motif direct handling of f10 wasn't working right,
-;; So temporarily we've turned it off in lwlib-Xm.c
-;; and turned the Emacs f10 back on.
-;; ;; Motif normally handles f10 itself, so don't try to handle it a second time.
-;; (if (featurep 'motif)
-;; (global-set-key [f10] 'ignore))
+ ;; Turn off window-splitting optimization; X is usually fast enough
+ ;; that this is only annoying.
+ (setq split-window-keep-point t)
-;; Turn on support for mouse wheels.
-(mouse-wheel-mode 1)
+ ;; Motif direct handling of f10 wasn't working right,
+ ;; So temporarily we've turned it off in lwlib-Xm.c
+ ;; and turned the Emacs f10 back on.
+ ;; ;; Motif normally handles f10 itself, so don't try to handle it a second time.
+ ;; (if (featurep 'motif)
+ ;; (global-set-key [f10] 'ignore))
+ ;; Turn on support for mouse wheels.
+ (mouse-wheel-mode 1)
-;; Enable CLIPBOARD copy/paste through menu bar commands.
-(menu-bar-enable-clipboard)
+ ;; Enable CLIPBOARD copy/paste through menu bar commands.
+ (menu-bar-enable-clipboard)
-;; Override Paste so it looks at CLIPBOARD first.
-(defun x-clipboard-yank ()
- "Insert the clipboard contents, or the last stretch of killed text."
- (interactive)
- (let ((clipboard-text (x-selection-value 'CLIPBOARD))
- (x-select-enable-clipboard t))
- (if (and clipboard-text (> (length clipboard-text) 0))
- (kill-new clipboard-text))
- (yank)))
+ ;; Override Paste so it looks at CLIPBOARD first.
+ (define-key menu-bar-edit-menu [paste]
+ (cons "Paste" (cons "Paste text from clipboard or kill ring"
+ 'x-clipboard-yank)))
+
+ (setq x-initialized t))
+
+(add-to-list 'handle-args-function-alist '(x . x-handle-args))
+(add-to-list 'frame-creation-function-alist '(x . x-create-frame-with-faces))
+(add-to-list 'window-system-initialization-alist '(x . x-initialize-window-system))
-(define-key menu-bar-edit-menu [paste]
- (cons "Paste" (cons "Paste text from clipboard or kill ring"
- 'x-clipboard-yank)))
+(provide 'x-win)
;; Initiate drag and drop
(add-hook 'after-make-frame-functions 'x-dnd-init-frame)
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 60b85a4522a..aeaaeeba1ae 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -26,243 +26,254 @@
;;; Code:
+(require 'server)
+
+(defvar xterm-function-map nil
+ "Function key map overrides for xterm.")
+
+;; Make reloads faster.
+(unless xterm-function-map
+ (setq xterm-function-map (make-sparse-keymap))
+ ;; xterm from X.org 6.8.2 uses these key definitions.
+ (define-key xterm-function-map "\eOP" [f1])
+ (define-key xterm-function-map "\eOQ" [f2])
+ (define-key xterm-function-map "\eOR" [f3])
+ (define-key xterm-function-map "\eOS" [f4])
+ (define-key xterm-function-map "\e[15~" [f5])
+ (define-key xterm-function-map "\e[17~" [f6])
+ (define-key xterm-function-map "\e[18~" [f7])
+ (define-key xterm-function-map "\e[19~" [f8])
+ (define-key xterm-function-map "\e[20~" [f9])
+ (define-key xterm-function-map "\e[21~" [f10])
+ (define-key xterm-function-map "\e[23~" [f11])
+ (define-key xterm-function-map "\e[24~" [f12])
+
+ (define-key xterm-function-map "\eO2P" [S-f1])
+ (define-key xterm-function-map "\eO2Q" [S-f2])
+ (define-key xterm-function-map "\eO2R" [S-f3])
+ (define-key xterm-function-map "\eO2S" [S-f4])
+ (define-key xterm-function-map "\e[15;2~" [S-f5])
+ (define-key xterm-function-map "\e[17;2~" [S-f6])
+ (define-key xterm-function-map "\e[18;2~" [S-f7])
+ (define-key xterm-function-map "\e[19;2~" [S-f8])
+ (define-key xterm-function-map "\e[20;2~" [S-f9])
+ (define-key xterm-function-map "\e[21;2~" [S-f10])
+ (define-key xterm-function-map "\e[23;2~" [S-f11])
+ (define-key xterm-function-map "\e[24;2~" [S-f12])
+
+ (define-key xterm-function-map "\eO5P" [C-f1])
+ (define-key xterm-function-map "\eO5Q" [C-f2])
+ (define-key xterm-function-map "\eO5R" [C-f3])
+ (define-key xterm-function-map "\eO5S" [C-f4])
+ (define-key xterm-function-map "\e[15;5~" [C-f5])
+ (define-key xterm-function-map "\e[17;5~" [C-f6])
+ (define-key xterm-function-map "\e[18;5~" [C-f7])
+ (define-key xterm-function-map "\e[19;5~" [C-f8])
+ (define-key xterm-function-map "\e[20;5~" [C-f9])
+ (define-key xterm-function-map "\e[21;5~" [C-f10])
+ (define-key xterm-function-map "\e[23;5~" [C-f11])
+ (define-key xterm-function-map "\e[24;5~" [C-f12])
+
+ (define-key xterm-function-map "\eO6P" [C-S-f1])
+ (define-key xterm-function-map "\eO6Q" [C-S-f2])
+ (define-key xterm-function-map "\eO6R" [C-S-f3])
+ (define-key xterm-function-map "\eO6S" [C-S-f4])
+ (define-key xterm-function-map "\e[15;6~" [C-S-f5])
+ (define-key xterm-function-map "\e[17;6~" [C-S-f6])
+ (define-key xterm-function-map "\e[18;6~" [C-S-f7])
+ (define-key xterm-function-map "\e[19;6~" [C-S-f8])
+ (define-key xterm-function-map "\e[20;6~" [C-S-f9])
+ (define-key xterm-function-map "\e[21;6~" [C-S-f10])
+ (define-key xterm-function-map "\e[23;6~" [C-S-f11])
+ (define-key xterm-function-map "\e[24;6~" [C-S-f12])
+
+ (define-key xterm-function-map "\eO3P" [A-f1])
+ (define-key xterm-function-map "\eO3Q" [A-f2])
+ (define-key xterm-function-map "\eO3R" [A-f3])
+ (define-key xterm-function-map "\eO3S" [A-f4])
+ (define-key xterm-function-map "\e[15;3~" [A-f5])
+ (define-key xterm-function-map "\e[17;3~" [A-f6])
+ (define-key xterm-function-map "\e[18;3~" [A-f7])
+ (define-key xterm-function-map "\e[19;3~" [A-f8])
+ (define-key xterm-function-map "\e[20;3~" [A-f9])
+ (define-key xterm-function-map "\e[21;3~" [A-f10])
+ (define-key xterm-function-map "\e[23;3~" [A-f11])
+ (define-key xterm-function-map "\e[24;3~" [A-f12])
+
+ (define-key xterm-function-map "\eOA" [up])
+ (define-key xterm-function-map "\eOB" [down])
+ (define-key xterm-function-map "\eOC" [right])
+ (define-key xterm-function-map "\eOD" [left])
+ (define-key xterm-function-map "\eOF" [end])
+ (define-key xterm-function-map "\eOH" [home])
+
+ (define-key xterm-function-map "\e[1;2A" [S-up])
+ (define-key xterm-function-map "\e[1;2B" [S-down])
+ (define-key xterm-function-map "\e[1;2C" [S-right])
+ (define-key xterm-function-map "\e[1;2D" [S-left])
+ (define-key xterm-function-map "\e[1;2F" [S-end])
+ (define-key xterm-function-map "\e[1;2H" [S-home])
+
+ (define-key xterm-function-map "\e[1;5A" [C-up])
+ (define-key xterm-function-map "\e[1;5B" [C-down])
+ (define-key xterm-function-map "\e[1;5C" [C-right])
+ (define-key xterm-function-map "\e[1;5D" [C-left])
+ (define-key xterm-function-map "\e[1;5F" [C-end])
+ (define-key xterm-function-map "\e[1;5H" [C-home])
+
+ (define-key xterm-function-map "\e[1;6A" [C-S-up])
+ (define-key xterm-function-map "\e[1;6B" [C-S-down])
+ (define-key xterm-function-map "\e[1;6C" [C-S-right])
+ (define-key xterm-function-map "\e[1;6D" [C-S-left])
+ (define-key xterm-function-map "\e[1;6F" [C-S-end])
+ (define-key xterm-function-map "\e[1;6H" [C-S-home])
+
+ (define-key xterm-function-map "\e[1;3A" [A-up])
+ (define-key xterm-function-map "\e[1;3B" [A-down])
+ (define-key xterm-function-map "\e[1;3C" [A-right])
+ (define-key xterm-function-map "\e[1;3D" [A-left])
+ (define-key xterm-function-map "\e[1;3F" [A-end])
+ (define-key xterm-function-map "\e[1;3H" [A-home])
+
+ (define-key xterm-function-map "\e[2~" [insert])
+ (define-key xterm-function-map "\e[3~" [delete])
+ (define-key xterm-function-map "\e[5~" [prior])
+ (define-key xterm-function-map "\e[6~" [next])
+
+ (define-key xterm-function-map "\e[2;2~" [S-insert])
+ (define-key xterm-function-map "\e[3;2~" [S-delete])
+ (define-key xterm-function-map "\e[5;2~" [S-prior])
+ (define-key xterm-function-map "\e[6;2~" [S-next])
+
+ (define-key xterm-function-map "\e[2;5~" [C-insert])
+ (define-key xterm-function-map "\e[3;5~" [C-delete])
+ (define-key xterm-function-map "\e[5;5~" [C-prior])
+ (define-key xterm-function-map "\e[6;5~" [C-next])
+
+ (define-key xterm-function-map "\e[2;6~" [C-S-insert])
+ (define-key xterm-function-map "\e[3;6~" [C-S-delete])
+ (define-key xterm-function-map "\e[5;6~" [C-S-prior])
+ (define-key xterm-function-map "\e[6;6~" [C-S-next])
+
+ (define-key xterm-function-map "\e[2;3~" [A-insert])
+ (define-key xterm-function-map "\e[3;3~" [A-delete])
+ (define-key xterm-function-map "\e[5;3~" [A-prior])
+ (define-key xterm-function-map "\e[6;3~" [A-next])
+
+ (define-key xterm-function-map "\e[4~" [select])
+ (define-key xterm-function-map "\e[29~" [print])
+
+ ;; Other versions of xterm might emit these.
+ (define-key xterm-function-map "\e[A" [up])
+ (define-key xterm-function-map "\e[B" [down])
+ (define-key xterm-function-map "\e[C" [right])
+ (define-key xterm-function-map "\e[D" [left])
+ (define-key xterm-function-map "\e[1~" [home])
+
+ (define-key xterm-function-map "\e[1;2A" [S-up])
+ (define-key xterm-function-map "\e[1;2B" [S-down])
+ (define-key xterm-function-map "\e[1;2C" [S-right])
+ (define-key xterm-function-map "\e[1;2D" [S-left])
+ (define-key xterm-function-map "\e[1;2F" [S-end])
+ (define-key xterm-function-map "\e[1;2H" [S-home])
+
+ (define-key xterm-function-map "\e[1;5A" [C-up])
+ (define-key xterm-function-map "\e[1;5B" [C-down])
+ (define-key xterm-function-map "\e[1;5C" [C-right])
+ (define-key xterm-function-map "\e[1;5D" [C-left])
+ (define-key xterm-function-map "\e[1;5F" [C-end])
+ (define-key xterm-function-map "\e[1;5H" [C-home])
+
+ (define-key xterm-function-map "\e[11~" [f1])
+ (define-key xterm-function-map "\e[12~" [f2])
+ (define-key xterm-function-map "\e[13~" [f3])
+ (define-key xterm-function-map "\e[14~" [f4]))
+
(defun terminal-init-xterm ()
"Terminal initialization function for xterm."
;; rxvt terminals sometimes set the TERM variable to "xterm", but
;; rxvt's keybindings that are incompatible with xterm's. It is
;; better in that case to use rxvt's initializion function.
- (if (and (getenv "COLORTERM")
- (string-match "\\`rxvt" (getenv "COLORTERM")))
- (progn
+ (if (and (server-getenv "COLORTERM")
+ (string-match "\\`rxvt" (server-getenv "COLORTERM")))
+ (progn
(eval-and-compile (load "term/rxvt"))
(terminal-init-rxvt))
- ;; The terminal intialization C code file might have initialized
- ;; function keys F13->F60 from the termcap/terminfo information. On
- ;; a PC-style keyboard these keys correspond to
- ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C, A-, C-S-. The
- ;; code here subsitutes the corresponding defintions in
- ;; function-key-map. This substitution is needed because if a key
- ;; definition if found in function-key-map, there are no further
- ;; lookups in other keymaps.
- (substitute-key-definition [f13] [S-f1] function-key-map)
- (substitute-key-definition [f14] [S-f2] function-key-map)
- (substitute-key-definition [f15] [S-f3] function-key-map)
- (substitute-key-definition [f16] [S-f4] function-key-map)
- (substitute-key-definition [f17] [S-f5] function-key-map)
- (substitute-key-definition [f18] [S-f6] function-key-map)
- (substitute-key-definition [f19] [S-f7] function-key-map)
- (substitute-key-definition [f20] [S-f8] function-key-map)
- (substitute-key-definition [f21] [S-f9] function-key-map)
- (substitute-key-definition [f22] [S-f10] function-key-map)
- (substitute-key-definition [f23] [S-f11] function-key-map)
- (substitute-key-definition [f24] [S-f12] function-key-map)
-
- (substitute-key-definition [f25] [C-f1] function-key-map)
- (substitute-key-definition [f26] [C-f2] function-key-map)
- (substitute-key-definition [f27] [C-f3] function-key-map)
- (substitute-key-definition [f28] [C-f4] function-key-map)
- (substitute-key-definition [f29] [C-f5] function-key-map)
- (substitute-key-definition [f30] [C-f6] function-key-map)
- (substitute-key-definition [f31] [C-f7] function-key-map)
- (substitute-key-definition [f32] [C-f8] function-key-map)
- (substitute-key-definition [f33] [C-f9] function-key-map)
- (substitute-key-definition [f34] [C-f10] function-key-map)
- (substitute-key-definition [f35] [C-f11] function-key-map)
- (substitute-key-definition [f36] [C-f12] function-key-map)
-
- (substitute-key-definition [f37] [C-S-f1] function-key-map)
- (substitute-key-definition [f38] [C-S-f2] function-key-map)
- (substitute-key-definition [f39] [C-S-f3] function-key-map)
- (substitute-key-definition [f40] [C-S-f4] function-key-map)
- (substitute-key-definition [f41] [C-S-f5] function-key-map)
- (substitute-key-definition [f42] [C-S-f6] function-key-map)
- (substitute-key-definition [f43] [C-S-f7] function-key-map)
- (substitute-key-definition [f44] [C-S-f8] function-key-map)
- (substitute-key-definition [f45] [C-S-f9] function-key-map)
- (substitute-key-definition [f46] [C-S-f10] function-key-map)
- (substitute-key-definition [f47] [C-S-f11] function-key-map)
- (substitute-key-definition [f48] [C-S-f12] function-key-map)
-
- (substitute-key-definition [f49] [A-f1] function-key-map)
- (substitute-key-definition [f50] [A-f2] function-key-map)
- (substitute-key-definition [f51] [A-f3] function-key-map)
- (substitute-key-definition [f52] [A-f4] function-key-map)
- (substitute-key-definition [f53] [A-f5] function-key-map)
- (substitute-key-definition [f54] [A-f6] function-key-map)
- (substitute-key-definition [f55] [A-f7] function-key-map)
- (substitute-key-definition [f56] [A-f8] function-key-map)
- (substitute-key-definition [f57] [A-f9] function-key-map)
- (substitute-key-definition [f58] [A-f10] function-key-map)
- (substitute-key-definition [f59] [A-f11] function-key-map)
- (substitute-key-definition [f60] [A-f12] function-key-map)
-
- (let ((map (make-sparse-keymap)))
- ;; xterm from X.org 6.8.2 uses these key definitions.
- (define-key map "\eOP" [f1])
- (define-key map "\eOQ" [f2])
- (define-key map "\eOR" [f3])
- (define-key map "\eOS" [f4])
- (define-key map "\e[15~" [f5])
- (define-key map "\e[17~" [f6])
- (define-key map "\e[18~" [f7])
- (define-key map "\e[19~" [f8])
- (define-key map "\e[20~" [f9])
- (define-key map "\e[21~" [f10])
- (define-key map "\e[23~" [f11])
- (define-key map "\e[24~" [f12])
-
- (define-key map "\eO2P" [S-f1])
- (define-key map "\eO2Q" [S-f2])
- (define-key map "\eO2R" [S-f3])
- (define-key map "\eO2S" [S-f4])
- (define-key map "\e[15;2~" [S-f5])
- (define-key map "\e[17;2~" [S-f6])
- (define-key map "\e[18;2~" [S-f7])
- (define-key map "\e[19;2~" [S-f8])
- (define-key map "\e[20;2~" [S-f9])
- (define-key map "\e[21;2~" [S-f10])
- (define-key map "\e[23;2~" [S-f11])
- (define-key map "\e[24;2~" [S-f12])
-
- (define-key map "\eO5P" [C-f1])
- (define-key map "\eO5Q" [C-f2])
- (define-key map "\eO5R" [C-f3])
- (define-key map "\eO5S" [C-f4])
- (define-key map "\e[15;5~" [C-f5])
- (define-key map "\e[17;5~" [C-f6])
- (define-key map "\e[18;5~" [C-f7])
- (define-key map "\e[19;5~" [C-f8])
- (define-key map "\e[20;5~" [C-f9])
- (define-key map "\e[21;5~" [C-f10])
- (define-key map "\e[23;5~" [C-f11])
- (define-key map "\e[24;5~" [C-f12])
-
- (define-key map "\eO6P" [C-S-f1])
- (define-key map "\eO6Q" [C-S-f2])
- (define-key map "\eO6R" [C-S-f3])
- (define-key map "\eO6S" [C-S-f4])
- (define-key map "\e[15;6~" [C-S-f5])
- (define-key map "\e[17;6~" [C-S-f6])
- (define-key map "\e[18;6~" [C-S-f7])
- (define-key map "\e[19;6~" [C-S-f8])
- (define-key map "\e[20;6~" [C-S-f9])
- (define-key map "\e[21;6~" [C-S-f10])
- (define-key map "\e[23;6~" [C-S-f11])
- (define-key map "\e[24;6~" [C-S-f12])
-
- (define-key map "\eO3P" [A-f1])
- (define-key map "\eO3Q" [A-f2])
- (define-key map "\eO3R" [A-f3])
- (define-key map "\eO3S" [A-f4])
- (define-key map "\e[15;3~" [A-f5])
- (define-key map "\e[17;3~" [A-f6])
- (define-key map "\e[18;3~" [A-f7])
- (define-key map "\e[19;3~" [A-f8])
- (define-key map "\e[20;3~" [A-f9])
- (define-key map "\e[21;3~" [A-f10])
- (define-key map "\e[23;3~" [A-f11])
- (define-key map "\e[24;3~" [A-f12])
-
- (define-key map "\eOA" [up])
- (define-key map "\eOB" [down])
- (define-key map "\eOC" [right])
- (define-key map "\eOD" [left])
- (define-key map "\eOF" [end])
- (define-key map "\eOH" [home])
-
- (define-key map "\e[1;2A" [S-up])
- (define-key map "\e[1;2B" [S-down])
- (define-key map "\e[1;2C" [S-right])
- (define-key map "\e[1;2D" [S-left])
- (define-key map "\e[1;2F" [S-end])
- (define-key map "\e[1;2H" [S-home])
-
- (define-key map "\e[1;5A" [C-up])
- (define-key map "\e[1;5B" [C-down])
- (define-key map "\e[1;5C" [C-right])
- (define-key map "\e[1;5D" [C-left])
- (define-key map "\e[1;5F" [C-end])
- (define-key map "\e[1;5H" [C-home])
-
- (define-key map "\e[1;6A" [C-S-up])
- (define-key map "\e[1;6B" [C-S-down])
- (define-key map "\e[1;6C" [C-S-right])
- (define-key map "\e[1;6D" [C-S-left])
- (define-key map "\e[1;6F" [C-S-end])
- (define-key map "\e[1;6H" [C-S-home])
-
- (define-key map "\e[1;3A" [A-up])
- (define-key map "\e[1;3B" [A-down])
- (define-key map "\e[1;3C" [A-right])
- (define-key map "\e[1;3D" [A-left])
- (define-key map "\e[1;3F" [A-end])
- (define-key map "\e[1;3H" [A-home])
-
- (define-key map "\e[2~" [insert])
- (define-key map "\e[3~" [delete])
- (define-key map "\e[5~" [prior])
- (define-key map "\e[6~" [next])
-
- (define-key map "\e[2;2~" [S-insert])
- (define-key map "\e[3;2~" [S-delete])
- (define-key map "\e[5;2~" [S-prior])
- (define-key map "\e[6;2~" [S-next])
-
- (define-key map "\e[2;5~" [C-insert])
- (define-key map "\e[3;5~" [C-delete])
- (define-key map "\e[5;5~" [C-prior])
- (define-key map "\e[6;5~" [C-next])
-
- (define-key map "\e[2;6~" [C-S-insert])
- (define-key map "\e[3;6~" [C-S-delete])
- (define-key map "\e[5;6~" [C-S-prior])
- (define-key map "\e[6;6~" [C-S-next])
-
- (define-key map "\e[2;3~" [A-insert])
- (define-key map "\e[3;3~" [A-delete])
- (define-key map "\e[5;3~" [A-prior])
- (define-key map "\e[6;3~" [A-next])
-
- (define-key map "\e[4~" [select])
- (define-key map "\e[29~" [print])
-
- ;; Other versions of xterm might emit these.
- (define-key map "\e[A" [up])
- (define-key map "\e[B" [down])
- (define-key map "\e[C" [right])
- (define-key map "\e[D" [left])
- (define-key map "\e[1~" [home])
-
- (define-key map "\eO2A" [S-up])
- (define-key map "\eO2B" [S-down])
- (define-key map "\eO2C" [S-right])
- (define-key map "\eO2D" [S-left])
- (define-key map "\eO2F" [S-end])
- (define-key map "\eO2H" [S-home])
-
- (define-key map "\eO5A" [C-up])
- (define-key map "\eO5B" [C-down])
- (define-key map "\eO5C" [C-right])
- (define-key map "\eO5D" [C-left])
- (define-key map "\eO5F" [C-end])
- (define-key map "\eO5H" [C-home])
-
- (define-key map "\e[11~" [f1])
- (define-key map "\e[12~" [f2])
- (define-key map "\e[13~" [f3])
- (define-key map "\e[14~" [f4])
+ ;; The terminal-local stuff only need to be set up on the first
+ ;; frame on that device.
+ (when (eq 1 (length (frames-on-display-list)))
+ ;; The terminal intialization C code file might have initialized
+ ;; function keys F13->F60 from the termcap/terminfo information. On
+ ;; a PC-style keyboard these keys correspond to
+ ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C, A-, C-S-. The
+ ;; code here subsitutes the corresponding defintions in
+ ;; function-key-map. This substitution is needed because if a key
+ ;; definition if found in function-key-map, there are no further
+ ;; lookups in other keymaps.
+ (substitute-key-definition [f13] [S-f1] local-function-key-map)
+ (substitute-key-definition [f14] [S-f2] local-function-key-map)
+ (substitute-key-definition [f15] [S-f3] local-function-key-map)
+ (substitute-key-definition [f16] [S-f4] local-function-key-map)
+ (substitute-key-definition [f17] [S-f5] local-function-key-map)
+ (substitute-key-definition [f18] [S-f6] local-function-key-map)
+ (substitute-key-definition [f19] [S-f7] local-function-key-map)
+ (substitute-key-definition [f20] [S-f8] local-function-key-map)
+ (substitute-key-definition [f21] [S-f9] local-function-key-map)
+ (substitute-key-definition [f22] [S-f10] local-function-key-map)
+ (substitute-key-definition [f23] [S-f11] local-function-key-map)
+ (substitute-key-definition [f24] [S-f12] local-function-key-map)
+
+ (substitute-key-definition [f25] [C-f1] local-function-key-map)
+ (substitute-key-definition [f26] [C-f2] local-function-key-map)
+ (substitute-key-definition [f27] [C-f3] local-function-key-map)
+ (substitute-key-definition [f28] [C-f4] local-function-key-map)
+ (substitute-key-definition [f29] [C-f5] local-function-key-map)
+ (substitute-key-definition [f30] [C-f6] local-function-key-map)
+ (substitute-key-definition [f31] [C-f7] local-function-key-map)
+ (substitute-key-definition [f32] [C-f8] local-function-key-map)
+ (substitute-key-definition [f33] [C-f9] local-function-key-map)
+ (substitute-key-definition [f34] [C-f10] local-function-key-map)
+ (substitute-key-definition [f35] [C-f11] local-function-key-map)
+ (substitute-key-definition [f36] [C-f12] local-function-key-map)
+
+ (substitute-key-definition [f37] [C-S-f1] local-function-key-map)
+ (substitute-key-definition [f38] [C-S-f2] local-function-key-map)
+ (substitute-key-definition [f39] [C-S-f3] local-function-key-map)
+ (substitute-key-definition [f40] [C-S-f4] local-function-key-map)
+ (substitute-key-definition [f41] [C-S-f5] local-function-key-map)
+ (substitute-key-definition [f42] [C-S-f6] local-function-key-map)
+ (substitute-key-definition [f43] [C-S-f7] local-function-key-map)
+ (substitute-key-definition [f44] [C-S-f8] local-function-key-map)
+ (substitute-key-definition [f45] [C-S-f9] local-function-key-map)
+ (substitute-key-definition [f46] [C-S-f10] local-function-key-map)
+ (substitute-key-definition [f47] [C-S-f11] local-function-key-map)
+ (substitute-key-definition [f48] [C-S-f12] local-function-key-map)
+
+ (substitute-key-definition [f49] [A-f1] local-function-key-map)
+ (substitute-key-definition [f50] [A-f2] local-function-key-map)
+ (substitute-key-definition [f51] [A-f3] local-function-key-map)
+ (substitute-key-definition [f52] [A-f4] local-function-key-map)
+ (substitute-key-definition [f53] [A-f5] local-function-key-map)
+ (substitute-key-definition [f54] [A-f6] local-function-key-map)
+ (substitute-key-definition [f55] [A-f7] local-function-key-map)
+ (substitute-key-definition [f56] [A-f8] local-function-key-map)
+ (substitute-key-definition [f57] [A-f9] local-function-key-map)
+ (substitute-key-definition [f58] [A-f10] local-function-key-map)
+ (substitute-key-definition [f59] [A-f11] local-function-key-map)
+ (substitute-key-definition [f60] [A-f12] local-function-key-map))
;; Use inheritance to let the main keymap override those defaults.
;; This way we don't override terminfo-derived settings or settings
;; made in the .emacs file.
- (set-keymap-parent map (keymap-parent function-key-map))
- (set-keymap-parent function-key-map map))
+ (let ((m (copy-keymap xterm-function-map)))
+ (set-keymap-parent m (keymap-parent local-function-key-map))
+ (set-keymap-parent local-function-key-map m)))
;; Do it!
(xterm-register-default-colors)
;; This recomputes all the default faces given the colors we've just set up.
- (tty-set-up-initial-frame-faces)))
+ (tty-set-up-initial-frame-faces))
;; Set up colors, for those versions of xterm that support it.
(defvar xterm-standard-colors
@@ -299,7 +310,7 @@ for the currently selected frame. The first 16 colors are taken from
`xterm-standard-colors', which see, while the rest are computed assuming
either the 88- or 256-color standard color scheme supported by latest
versions of xterm."
- (let* ((ncolors (display-color-cells))
+ (let* ((ncolors (display-color-cells (selected-frame)))
(colors xterm-standard-colors)
(color (car colors)))
(if (> ncolors 0)