summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2006-05-20 17:02:47 +0000
committerKaroly Lorentey <lorentey@elte.hu>2006-05-20 17:02:47 +0000
commit8cbd7bed2db718a63ed37182c566f9e059925c71 (patch)
treeb8905d6abc17f84a33d1f80f35a0b87f69819da9
parentb34c34dae08d94ca9ab0cd50cb53f0ab0cd21491 (diff)
Fix and/or simplify terminal initialization files.
* lisp/faces.el (tty-create-frame-with-faces): Set up faces and background mode only after the terminal has been initialized. (frame-set-background-mode): Handle the 'background-mode terminal parameter. (tty-run-terminal-initialization): Add type option. * lisp/term/README: Update. * lisp/term/rxvt.el: Simplify. * lisp/term/xterm.el: Simplify and fix. * lisp/term/*.el: Simplify and fix. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-564
-rw-r--r--README.multi-tty2
-rw-r--r--lisp/faces.el19
-rw-r--r--lisp/term/AT386.el4
-rw-r--r--lisp/term/README50
-rw-r--r--lisp/term/apollo.el2
-rw-r--r--lisp/term/bobcat.el2
-rw-r--r--lisp/term/cygwin.el2
-rw-r--r--lisp/term/iris-ansi.el381
-rw-r--r--lisp/term/lk201.el146
-rw-r--r--lisp/term/news.el6
-rw-r--r--lisp/term/rxvt.el258
-rw-r--r--lisp/term/vt100.el2
-rw-r--r--lisp/term/vt102.el4
-rw-r--r--lisp/term/vt125.el4
-rw-r--r--lisp/term/vt200.el2
-rw-r--r--lisp/term/vt201.el2
-rw-r--r--lisp/term/vt220.el2
-rw-r--r--lisp/term/vt240.el2
-rw-r--r--lisp/term/vt300.el2
-rw-r--r--lisp/term/vt320.el2
-rw-r--r--lisp/term/vt400.el2
-rw-r--r--lisp/term/vt420.el2
-rw-r--r--lisp/term/xterm.el475
23 files changed, 684 insertions, 689 deletions
diff --git a/README.multi-tty b/README.multi-tty
index ed9c4b561b..9cce8f8dfa 100644
--- a/README.multi-tty
+++ b/README.multi-tty
@@ -404,6 +404,8 @@ is probably not very interesting for anyone else.)
THINGS TO DO
------------
+** See if `tty-defined-color-alist' needs to be terminal-local.
+
** emacsclient -t on the console does not work after su. You have to
use non-root accounts or start as root to see this.
diff --git a/lisp/faces.el b/lisp/faces.el
index b428db0ebf..69af786ee8 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1598,11 +1598,13 @@ according to the `background-mode' and `display-type' frame parameters."
(and (window-system frame)
(x-get-resource "backgroundMode" "BackgroundMode")))
(bg-color (frame-parameter frame 'background-color))
- (tty-type (frame-parameter frame 'tty-type))
+ (terminal-bg-mode (terminal-parameter frame 'background-mode))
+ (tty-type (tty-type frame))
(bg-mode
(cond (frame-background-mode)
(bg-resource
(intern (downcase bg-resource)))
+ (terminal-bg-mode)
((and (null (window-system frame))
;; Unspecified frame background color can only
;; happen on tty's.
@@ -1826,8 +1828,6 @@ created."
(unwind-protect
(with-selected-frame frame
(tty-handle-reverse-video frame (frame-parameters frame))
- (frame-set-background-mode frame)
- (face-set-after-frame-default frame)
;; Make sure the kill and yank functions do not touch the X clipboard.
(modify-frame-parameters frame '((interprogram-cut-function . nil)))
@@ -1835,6 +1835,8 @@ created."
(set-locale-environment nil frame)
(tty-run-terminal-initialization frame)
+ (frame-set-background-mode frame)
+ (face-set-after-frame-default frame)
(setq success t))
(unless success
(delete-frame frame)))
@@ -1857,8 +1859,11 @@ the above example."
nil))))
type)
-(defun tty-run-terminal-initialization (frame)
- "Run the special initialization code for the terminal type of FRAME."
+(defun tty-run-terminal-initialization (frame &optional type)
+ "Run the special initialization code for the terminal type of FRAME.
+The optional TYPE parameter may be used to override the autodetected
+terminal type to a different value."
+ (setq type (or type (tty-type frame)))
;; Load library for our terminal type.
;; User init file can set term-file-prefix to nil to prevent this.
(with-selected-frame frame
@@ -1874,12 +1879,12 @@ the above example."
(and file
(or (assoc file load-history)
(load file t t)))))
- (tty-type frame))
+ type)
;; Next, try to find a matching initialization function, and call it.
(tty-find-type #'(lambda (type)
(fboundp (setq term-init-func
(intern (concat "terminal-init-" type)))))
- (tty-type frame))
+ type)
(when (fboundp term-init-func)
(funcall term-init-func))
(set-terminal-parameter frame 'terminal-initted term-init-func)))))
diff --git a/lisp/term/AT386.el b/lisp/term/AT386.el
index adec1f1505..2f98e7bf6f 100644
--- a/lisp/term/AT386.el
+++ b/lisp/term/AT386.el
@@ -31,10 +31,8 @@
(defun terminal-init-AT386 ()
"Terminal initialization function for AT386."
- (if (boundp 'AT386-keypad-map)
- nil
+ (let ((AT386-keypad-map (lookup-key local-function-key-map "\e[")))
;; 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"))
diff --git a/lisp/term/README b/lisp/term/README
index 581f321d3b..1912df47f4 100644
--- a/lisp/term/README
+++ b/lisp/term/README
@@ -1,19 +1,43 @@
This directory contains files of elisp that customize Emacs for certain
terminal types.
- When Emacs starts, it checks the TERM environment variable to see what type
-of terminal the user is running on, checks for an elisp file named
-"term/${TERM}.el", and if one exists, loads it. If that doesn't yield a file
-that exists, the last hyphen and what follows it is stripped. If that doesn't
-yield a file that exists, the previous hyphen is stripped, and so on until all
-hyphens are gone. For example, if the terminal type is `aaa-48-foo', Emacs
-will try first `term/aaa-48-foo.el', then `term/aaa-48.el' and finally
-`term/aaa.el'. Each terminal specific file should contain a function
-named terminal-init-TERMINALNAME (eg terminal-init-aaa-48 for
-term/aaa-48.el) that Emacs will call in order to initialize the
-terminal. The terminal files should not contain any top level forms
-that are executed when the file is loaded, all the initialization
-actions are performed by the terminal-init-TERMINALNAME functions.
+ When Emacs opens a new terminal, it checks the TERM environment variable to
+see what type of terminal the user is running on, searches for an elisp file
+named "term/${TERM}.el", and if one exists, loads it. If Emacs finds no
+suitable file, then it strips the last hyphen and what follows it from TERM,
+and tries again. If that still doesn't yield a file, then the previous hyphen
+is stripped, and so on until all hyphens are gone. For example, if the
+terminal type is `aaa-48-foo', Emacs will try first `term/aaa-48-foo.el', then
+`term/aaa-48.el' and finally `term/aaa.el'. Emacs stops searching at the
+first file found, and will not load more than one file for any terminal. Note
+that it is not an error if Emacs is unable to find a terminal initialization
+file; in that case, it will simply proceed with the next step without loading
+any files.
+
+ Once the file has been loaded (or the search failed), Emacs tries to call a
+function named `terminal-init-TERMINALNAME' (eg `terminal-init-aaa-48' for the
+`aaa-48' terminal) in order to initialize the terminal. Once again, if the
+function is not found, Emacs strips the last component of the name and tries
+again using the shorter name. This search is independent of the previous file
+search, so that you can have terminal initialization functions for a family of
+terminals collected in a single file named after the family name, and users
+may put terminal initialization functions directly in their .emacs files.
+
+ Note that an individual terminal file is loaded only once in an Emacs
+session; if the same terminal type is opened again, Emacs will simply call the
+initialization function without reloading the file. Therefore, all the actual
+initialization actions should be collected in terminal-init-* functions; the
+file should not contain any top-level form that is not a function or variable
+declaration. Simply loading the file should not have any side effect.
+
+ Similarly, the terminal initialization function is called only once on any
+given terminal, when the first frame is created on it. The function is not
+called for subsequent frames on the same terminal. Therefore, terminal-init-*
+functions should only modify terminal-local variables (such as
+`local-function-key-map') and terminal parameters. For example, it is not
+correct to modify frame parameters, since the modifications will only be
+applied for the first frame opened on the terminal.
+
When writing terminal packages, there are some things it is good to keep in
mind.
diff --git a/lisp/term/apollo.el b/lisp/term/apollo.el
index 1e0e6f0a1f..c47de919b0 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."
- (terminal-init-vt100))
+ (tty-run-terminal-initialization (selected-frame) "vt100"))
;;; arch-tag: c72f446f-e6b7-4749-90a4-bd68632adacf
;;; apollo.el ends here
diff --git a/lisp/term/bobcat.el b/lisp/term/bobcat.el
index 82401f7bf7..974476f679 100644
--- a/lisp/term/bobcat.el
+++ b/lisp/term/bobcat.el
@@ -1,7 +1,7 @@
;; -*- no-byte-compile: t -*-
(defun terminal-init-bobcat ()
- "Terminal initialization function for bobcat."
+ "Terminal initialization function for bobcat."
;; HP terminals usually encourage using ^H as the rubout character
(keyboard-translate ?\177 ?\^h)
(keyboard-translate ?\^h ?\177))
diff --git a/lisp/term/cygwin.el b/lisp/term/cygwin.el
index 3bdd5d3aa0..df857ba662 100644
--- a/lisp/term/cygwin.el
+++ b/lisp/term/cygwin.el
@@ -3,7 +3,7 @@
;;; The Cygwin terminal can't really display underlines.
(defun terminal-init-cygwin ()
- "Terminal initialization function for cygwin."
+ "Terminal initialization function for cygwin."
(tty-no-underline))
;; arch-tag: ca81ce67-3c41-4883-a29b-4c3d64a21191
diff --git a/lisp/term/iris-ansi.el b/lisp/term/iris-ansi.el
index c68aa7f898..a6d0724cad 100644
--- a/lisp/term/iris-ansi.el
+++ b/lisp/term/iris-ansi.el
@@ -26,321 +26,314 @@
;;; Code:
-(defvar iris-function-map nil
+(defvar iris-function-map (make-sparse-keymap)
"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 iris-function-map "\e[120q" [S-escape])
- (define-key iris-function-map "\e[121q" [C-escape])
+(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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 iris-function-map "\e[057q" [C-`])
+(define-key iris-function-map "\e[115q" [M-`])
- (define-key iris-function-map "\e[057q" [C-`])
- (define-key iris-function-map "\e[115q" [M-`])
+(define-key iris-function-map "\e[049q" [?\C-1])
+(define-key iris-function-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 iris-function-map "\e[059q" [?\M-2])
- (define-key iris-function-map "\e[059q" [?\M-2])
+(define-key iris-function-map "\e[050q" [?\C-3])
+(define-key iris-function-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 iris-function-map "\e[051q" [?\C-4])
+(define-key iris-function-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 iris-function-map "\e[052q" [?\C-5])
+(define-key iris-function-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 iris-function-map "\e[063q" [?\M-6])
- (define-key iris-function-map "\e[063q" [?\M-6])
+(define-key iris-function-map "\e[053q" [?\C-7])
+(define-key iris-function-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 iris-function-map "\e[054q" [?\C-8])
+(define-key iris-function-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 iris-function-map "\e[055q" [?\C-9])
+(define-key iris-function-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 iris-function-map "\e[056q" [?\C-0])
+(define-key iris-function-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 iris-function-map "\e[068q" [?\M--])
- (define-key iris-function-map "\e[068q" [?\M--])
+(define-key iris-function-map "\e[069q" [?\C-=])
+(define-key iris-function-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 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>])
- ;; I don't know what to do with those.
- ;;(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 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 iris-function-map "\e[073q" [?\M-\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 iris-function-map "\e[073q" [?\M-\t])
+(define-key iris-function-map "\e[074q" [?\M-q])
- (define-key iris-function-map "\e[074q" [?\M-q])
+(define-key iris-function-map "\e[075q" [?\M-w])
- (define-key iris-function-map "\e[075q" [?\M-w])
+(define-key iris-function-map "\e[076q" [?\M-e])
- (define-key iris-function-map "\e[076q" [?\M-e])
+(define-key iris-function-map "\e[077q" [?\M-r])
- (define-key iris-function-map "\e[077q" [?\M-r])
+(define-key iris-function-map "\e[078q" [?\M-t])
- (define-key iris-function-map "\e[078q" [?\M-t])
+(define-key iris-function-map "\e[079q" [?\M-y])
- (define-key iris-function-map "\e[079q" [?\M-y])
+(define-key iris-function-map "\e[080q" [?\M-u])
- (define-key iris-function-map "\e[080q" [?\M-u])
+(define-key iris-function-map "\e[081q" [?\M-i])
- (define-key iris-function-map "\e[081q" [?\M-i])
+(define-key iris-function-map "\e[082q" [?\M-o])
- (define-key iris-function-map "\e[082q" [?\M-o])
+(define-key iris-function-map "\e[083q" [?\M-p])
- (define-key iris-function-map "\e[083q" [?\M-p])
+(define-key iris-function-map "\e[084q" [?\M-\[])
- (define-key iris-function-map "\e[084q" [?\M-\[])
+(define-key iris-function-map "\e[085q" [?\M-\]])
- (define-key iris-function-map "\e[085q" [?\M-\]])
+(define-key iris-function-map "\e[086q" [?\M-\\])
- (define-key iris-function-map "\e[086q" [?\M-\\])
+(define-key iris-function-map "\e[087q" [?\M-a])
- (define-key iris-function-map "\e[087q" [?\M-a])
+(define-key iris-function-map "\e[088q" [?\M-s])
- (define-key iris-function-map "\e[088q" [?\M-s])
+(define-key iris-function-map "\e[089q" [?\M-d])
- (define-key iris-function-map "\e[089q" [?\M-d])
+(define-key iris-function-map "\e[090q" [?\M-f])
- (define-key iris-function-map "\e[090q" [?\M-f])
+(define-key iris-function-map "\e[091q" [?\M-g])
- (define-key iris-function-map "\e[091q" [?\M-g])
+(define-key iris-function-map "\e[092q" [?\M-h])
- (define-key iris-function-map "\e[092q" [?\M-h])
+(define-key iris-function-map "\e[093q" [?\M-j])
- (define-key iris-function-map "\e[093q" [?\M-j])
+(define-key iris-function-map "\e[094q" [?\M-k])
- (define-key iris-function-map "\e[094q" [?\M-k])
+(define-key iris-function-map "\e[095q" [?\M-l])
- (define-key iris-function-map "\e[095q" [?\M-l])
-
- (define-key iris-function-map "\e[096q" [?\C-\;])
- (define-key iris-function-map "\e[097q" [?\M-:]) ;; we are cheating
+(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 iris-function-map "\e[098q" [?\C-'])
- (define-key iris-function-map "\e[099q" [?\M-'])
+(define-key iris-function-map "\e[098q" [?\C-'])
+(define-key iris-function-map "\e[099q" [?\M-'])
- (define-key iris-function-map "\e[100q" [?\M-\n])
+(define-key iris-function-map "\e[100q" [?\M-\n])
- (define-key iris-function-map "\e[101q" [?\M-z])
+(define-key iris-function-map "\e[101q" [?\M-z])
- (define-key iris-function-map "\e[102q" [?\M-x])
+(define-key iris-function-map "\e[102q" [?\M-x])
- (define-key iris-function-map "\e[103q" [?\M-c])
+(define-key iris-function-map "\e[103q" [?\M-c])
- (define-key iris-function-map "\e[104q" [?\M-v])
+(define-key iris-function-map "\e[104q" [?\M-v])
- (define-key iris-function-map "\e[105q" [?\M-b])
+(define-key iris-function-map "\e[105q" [?\M-b])
- (define-key iris-function-map "\e[106q" [M-n])
+(define-key iris-function-map "\e[106q" [M-n])
- (define-key iris-function-map "\e[107q" [M-m])
+(define-key iris-function-map "\e[107q" [M-m])
- (define-key iris-function-map "\e[108q" [?\C-,])
- (define-key iris-function-map "\e[109q" [?\M-,])
+(define-key iris-function-map "\e[108q" [?\C-,])
+(define-key iris-function-map "\e[109q" [?\M-,])
- (define-key iris-function-map "\e[110q" [?\C-.])
- (define-key iris-function-map "\e[111q" [?\M-.])
+(define-key iris-function-map "\e[110q" [?\C-.])
+(define-key iris-function-map "\e[111q" [?\M-.])
- (define-key iris-function-map "\e[112q" [?\C-/])
- (define-key iris-function-map "\e[113q" [?\M-/])
+(define-key iris-function-map "\e[112q" [?\C-/])
+(define-key iris-function-map "\e[113q" [?\M-/])
- (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 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 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 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 iris-function-map "\e[150q" [prior])
- (define-key iris-function-map "\e[151q" [S-prior]) ;; those don't seem
+(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 iris-function-map "\e[152q" [C-prior])
+(define-key iris-function-map "\e[152q" [C-prior])
- ;; (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 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 iris-function-map "\e[146q" [end])
- (define-key iris-function-map "\e[147q" [S-end]) ;; those don't seem to
+(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 iris-function-map "\e[148q" [C-end])
- (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 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 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 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 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 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 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 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 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])
+(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 iris-function-map "\e[179q" [?\C-/])
- (define-key iris-function-map "\e[180q" [?\M-/])
+;; Keypad functions, most of those are untested.
+(define-key iris-function-map "\e[179q" [?\C-/])
+(define-key iris-function-map "\e[180q" [?\M-/])
- (define-key iris-function-map "\e[187q" [?\C-*])
- (define-key iris-function-map "\e[188q" [?\M-*])
+(define-key iris-function-map "\e[187q" [?\C-*])
+(define-key iris-function-map "\e[188q" [?\M-*])
- (define-key iris-function-map "\e[198q" [?\C--])
- (define-key iris-function-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 iris-function-map "\e[H" [home])
- (define-key iris-function-map "\e[172q" [C-home])
+;; Something else takes care of home, up, prior, down, left, right, next
+;(define-key iris-function-map "\e[H" [home])
+(define-key iris-function-map "\e[172q" [C-home])
- ;(define-key iris-function-map "\e[A" [up])
- (define-key iris-function-map "\e[182q" [C-up])
+;(define-key iris-function-map "\e[A" [up])
+(define-key iris-function-map "\e[182q" [C-up])
- ;(define-key iris-function-map "\e[150q" [prior])
- (define-key iris-function-map "\e[190q" [C-prior])
+;(define-key iris-function-map "\e[150q" [prior])
+(define-key iris-function-map "\e[190q" [C-prior])
- (define-key iris-function-map "\e[200q" [?\C-+])
- (define-key iris-function-map "\e[201q" [?\M-+])
+(define-key iris-function-map "\e[200q" [?\C-+])
+(define-key iris-function-map "\e[201q" [?\M-+])
- ;(define-key iris-function-map "\e[D" [left])
- (define-key iris-function-map "\e[174q" [C-left])
+;(define-key iris-function-map "\e[D" [left])
+(define-key iris-function-map "\e[174q" [C-left])
- (define-key iris-function-map "\e[000q" [begin])
- (define-key iris-function-map "\e[184q" [C-begin])
+(define-key iris-function-map "\e[000q" [begin])
+(define-key iris-function-map "\e[184q" [C-begin])
- ;(define-key iris-function-map "\e[C" [right])
- (define-key iris-function-map "\e[192q" [C-right])
+;(define-key iris-function-map "\e[C" [right])
+(define-key iris-function-map "\e[192q" [C-right])
- ;(define-key iris-function-map "\e[146q" [end])
- (define-key iris-function-map "\e[176q" [C-end])
+;(define-key iris-function-map "\e[146q" [end])
+(define-key iris-function-map "\e[176q" [C-end])
- ;(define-key iris-function-map "\e[B" [down])
- (define-key iris-function-map "\e[186q" [C-down])
+;(define-key iris-function-map "\e[B" [down])
+(define-key iris-function-map "\e[186q" [C-down])
- ;(define-key iris-function-map "\e[154q" [next])
- (define-key iris-function-map "\e[194q" [C-next])
+;(define-key iris-function-map "\e[154q" [next])
+(define-key iris-function-map "\e[194q" [C-next])
- (define-key iris-function-map "\e[100q" [M-enter])
+(define-key iris-function-map "\e[100q" [M-enter])
- (define-key iris-function-map "\e[139q" [insert])
- (define-key iris-function-map "\e[178q" [C-inset])
+(define-key iris-function-map "\e[139q" [insert])
+(define-key iris-function-map "\e[178q" [C-inset])
- (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]))
+(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))))
+ ;; 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 45271bca70..dad42d8f68 100644
--- a/lisp/term/lk201.el
+++ b/lisp/term/lk201.el
@@ -1,91 +1,83 @@
;; -*- no-byte-compile: t -*-
;; Define function key sequences for DEC terminals.
-(defvar lk201-function-map nil
+(defvar lk201-function-map (make-sparse-keymap)
"Function key definitions for DEC terminals.")
-;; Make reloads faster.
-(unless lk201-function-map
- (setq lk201-function-map (make-sparse-keymap))
+;; 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.
- ;; (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])
+(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 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])
+;; 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.
- ;; (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])
- ;; 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]))
+(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))))
+ ;; 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/news.el b/lisp/term/news.el
index eaf662c8cf..6fd39d2421 100644
--- a/lisp/term/news.el
+++ b/lisp/term/news.el
@@ -31,10 +31,8 @@
(defun terminal-init-news ()
"Terminal initialization function for news."
- (if (boundp 'news-fkey-prefix)
- nil
- ;; The terminal initialization should already have set up some keys
- (setq news-fkey-prefix (lookup-key local-function-key-map "\eO"))
+ ;; The terminal initialization should already have set up some keys
+ (let ((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 fe29b87f2e..cd8160c507 100644
--- a/lisp/term/rxvt.el
+++ b/lisp/term/rxvt.el
@@ -26,149 +26,142 @@
;;; Code:
-(defvar rxvt-function-map nil
+(defvar rxvt-function-map (make-sparse-keymap)
"Function key overrides for rxvt.")
-;; 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.
+(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])
- ;; Set up function-key-map entries that termcap and terminfo don't know.
- (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[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 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 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 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 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^" [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]))
+(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."
- ;; 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)
+ ;; 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)
- (substitute-key-definition [f23] [C-f1] local-function-key-map)
- (substitute-key-definition [f24] [C-f2] local-function-key-map)
- (substitute-key-definition [f25] [C-f3] local-function-key-map)
- (substitute-key-definition [f26] [C-f4] local-function-key-map)
- (substitute-key-definition [f27] [C-f5] local-function-key-map)
- (substitute-key-definition [f28] [C-f6] local-function-key-map)
- (substitute-key-definition [f29] [C-f7] local-function-key-map)
- (substitute-key-definition [f30] [C-f8] local-function-key-map)
- (substitute-key-definition [f31] [C-f9] local-function-key-map)
- (substitute-key-definition [f32] [C-f10] local-function-key-map)
+ (substitute-key-definition [f23] [C-f1] local-function-key-map)
+ (substitute-key-definition [f24] [C-f2] local-function-key-map)
+ (substitute-key-definition [f25] [C-f3] local-function-key-map)
+ (substitute-key-definition [f26] [C-f4] local-function-key-map)
+ (substitute-key-definition [f27] [C-f5] local-function-key-map)
+ (substitute-key-definition [f28] [C-f6] local-function-key-map)
+ (substitute-key-definition [f29] [C-f7] local-function-key-map)
+ (substitute-key-definition [f30] [C-f8] local-function-key-map)
+ (substitute-key-definition [f31] [C-f9] local-function-key-map)
+ (substitute-key-definition [f32] [C-f10] local-function-key-map)
- (substitute-key-definition [f33] [C-S-f1] 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)
+ (substitute-key-definition [f33] [C-S-f1] local-function-key-map)
+ (substitute-key-definition [f34] [C-S-f2] local-function-key-map)
+ (substitute-key-definition [f35] [C-S-f3] local-function-key-map)
+ (substitute-key-definition [f36] [C-S-f4] local-function-key-map)
+ (substitute-key-definition [f37] [C-S-f5] local-function-key-map)
+ (substitute-key-definition [f38] [C-S-f6] local-function-key-map)
+ (substitute-key-definition [f39] [C-S-f7] local-function-key-map)
+ (substitute-key-definition [f40] [C-S-f8] local-function-key-map)
+ (substitute-key-definition [f41] [C-S-f9] local-function-key-map)
+ (substitute-key-definition [f42] [C-S-f10] local-function-key-map)
- ;; Use inheritance to let the main keymap override those defaults.
- ;; This way we don't override terminfo-derived settings or settings
- ;; made in the .emacs file.
- (let ((m (copy-keymap rxvt-function-map)))
- (set-keymap-parent m (keymap-parent local-function-key-map))
- (set-keymap-parent local-function-key-map m)))
+ ;; Use inheritance to let the main keymap override those defaults.
+ ;; This way we don't override terminfo-derived settings or settings
+ ;; made in the .emacs file.
+ (let ((m (copy-keymap rxvt-function-map)))
+ (set-keymap-parent m (keymap-parent local-function-key-map))
+ (set-keymap-parent local-function-key-map m))
;; Initialize colors and background mode.
(rxvt-register-default-colors)
@@ -250,7 +243,7 @@ for the currently selected frame."
(- 256 ncolors)
(list color color color))
(setq ncolors (1- ncolors))))
-
+
((= ncolors 72) ; rxvt-unicode
;; 64 non-gray colors
(let ((levels '(0 139 205 255))
@@ -293,7 +286,7 @@ for the currently selected frame."
"Set background mode as appropriate for the default rxvt colors."
(let ((fgbg (getenv "COLORFGBG" (terminal-id)))
bg rgb)
- (setq default-frame-background-mode 'light)
+ (set-terminal-parameter nil 'background-mode 'light)
(when (and fgbg
(string-match ".*;\\([0-9][0-9]?\\)\\'" fgbg))
(setq bg (string-to-number (substring fgbg (match-beginning 1))))
@@ -306,8 +299,7 @@ for the currently selected frame."
;; The following line assumes that white is the 15th
;; color in rxvt-standard-colors.
(* (apply '+ (car (cddr (nth 15 rxvt-standard-colors)))) 0.6))
- (setq default-frame-background-mode 'dark)))
- (frame-set-background-mode (selected-frame))))
+ (set-terminal-parameter nil 'background-mode 'dark)))))
;; arch-tag: 20cf2fb6-6318-4bab-9dbf-1d15048f2257
;;; rxvt.el ends here
diff --git a/lisp/term/vt100.el b/lisp/term/vt100.el
index d17f61bc78..be1d8ee1a4 100644
--- a/lisp/term/vt100.el
+++ b/lisp/term/vt100.el
@@ -40,7 +40,7 @@
(defun terminal-init-vt100 ()
"Terminal initialization function for vt100."
- (terminal-init-lk201))
+ (tty-run-terminal-initialization (selected-frame) "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 ba4ac80c92..67a90a8242 100644
--- a/lisp/term/vt102.el
+++ b/lisp/term/vt102.el
@@ -1,8 +1,8 @@
;; -*- no-byte-compile: t -*-
(defun terminal-init-vt102 ()
- "Terminal initialization function for vt102."
- (terminal-init-vt100))
+ "Terminal initialization function for vt102."
+ (tty-run-terminal-initialization (selected-frame) "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 369dc5f28b..82a7047fef 100644
--- a/lisp/term/vt125.el
+++ b/lisp/term/vt125.el
@@ -1,8 +1,8 @@
;; -*- no-byte-compile: t -*-
(defun terminal-init-vt125 ()
- "Terminal initialization function for vt125."
- (terminal-init-vt100))
+ "Terminal initialization function for vt125."
+ (tty-run-terminal-initialization (selected-frame) "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 fd31fd1126..7e7b3281d9 100644
--- a/lisp/term/vt200.el
+++ b/lisp/term/vt200.el
@@ -3,7 +3,7 @@
;; Most differences are handled by the termcap entry.
(defun terminal-init-vt200 ()
"Terminal initialization function for vt200."
- (terminal-init-vt100)
+ (tty-run-terminal-initialization (selected-frame) "vt100")
;; Make F11 an escape key.
(define-key local-function-key-map "\e[23~" [?\e]))
diff --git a/lisp/term/vt201.el b/lisp/term/vt201.el
index 9524332240..a63f9561a6 100644
--- a/lisp/term/vt201.el
+++ b/lisp/term/vt201.el
@@ -3,7 +3,7 @@
;; Most differences are handled by the termcap entry.
(defun terminal-init-vt201 ()
"Terminal initialization function for vt201."
- (terminal-init-vt100)
+ (tty-run-terminal-initialization (selected-frame) "vt100")
;; Make F11 an escape key.
(define-key local-function-key-map "\e[23~" [?\e]))
diff --git a/lisp/term/vt220.el b/lisp/term/vt220.el
index 7264b7d94a..b2b8fc944c 100644
--- a/lisp/term/vt220.el
+++ b/lisp/term/vt220.el
@@ -3,7 +3,7 @@
;; Most differences are handled by the termcap entry.
(defun terminal-init-vt220 ()
"Terminal initialization function for vt220."
- (terminal-init-vt100)
+ (tty-run-terminal-initialization (selected-frame) "vt100")
;; Make F11 an escape key.
(define-key local-function-key-map "\e[23~" [?\e]))
diff --git a/lisp/term/vt240.el b/lisp/term/vt240.el
index 725e323c00..cb26ebf406 100644
--- a/lisp/term/vt240.el
+++ b/lisp/term/vt240.el
@@ -3,7 +3,7 @@
;; Most differences are handled by the termcap entry.
(defun terminal-init-vt240 ()
"Terminal initialization function for vt240."
- (terminal-init-vt100)
+ (tty-run-terminal-initialization (selected-frame) "vt100")
;; Make F11 an escape key.
(define-key local-function-key-map "\e[23~" [?\e]))
diff --git a/lisp/term/vt300.el b/lisp/term/vt300.el
index fb749277d5..9a09ad5e8c 100644
--- a/lisp/term/vt300.el
+++ b/lisp/term/vt300.el
@@ -1,7 +1,7 @@
;; -*- no-byte-compile: t -*-
(defun terminal-init-vt300 ()
"Terminal initialization function for vt300."
- (terminal-init-vt100)
+ (tty-run-terminal-initialization (selected-frame) "vt100")
;; Make F11 an escape key.
(define-key local-function-key-map "\e[23~" [?\e]))
diff --git a/lisp/term/vt320.el b/lisp/term/vt320.el
index 3e52d27193..803d728606 100644
--- a/lisp/term/vt320.el
+++ b/lisp/term/vt320.el
@@ -1,7 +1,7 @@
;; -*- no-byte-compile: t -*-
(defun terminal-init-vt320 ()
"Terminal initialization function for vt320."
- (terminal-init-vt100)
+ (tty-run-terminal-initialization (selected-frame) "vt100")
;; Make F11 an escape key.
(define-key local-function-key-map "\e[23~" [?\e]))
diff --git a/lisp/term/vt400.el b/lisp/term/vt400.el
index f1c7e3732d..f73f4660b9 100644
--- a/lisp/term/vt400.el
+++ b/lisp/term/vt400.el
@@ -1,7 +1,7 @@
;; -*- no-byte-compile: t -*-
(defun terminal-init-vt400 ()
"Terminal initialization function for vt400."
- (terminal-init-vt100)
+ (tty-run-terminal-initialization (selected-frame) "vt100")
;; Make F11 an escape key.
(define-key local-function-key-map "\e[23~" [?\e]))
diff --git a/lisp/term/vt420.el b/lisp/term/vt420.el
index 4d3206cbca..e65ba1a61d 100644
--- a/lisp/term/vt420.el
+++ b/lisp/term/vt420.el
@@ -1,7 +1,7 @@
;; -*- no-byte-compile: t -*-
(defun terminal-init-vt420
"Terminal initialization function for vt420."
- (terminal-init-vt100)
+ (tty-run-terminal-initialization (selected-frame) "vt100")
;; Make F11 an escape key.
(define-key local-function-key-map "\e[23~" [?\e]))
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 5a32e7c15e..9b3ebfe342 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -27,257 +27,248 @@
;;; Code:
-(defvar xterm-function-map nil
+(defvar xterm-function-map (make-sparse-keymap)
"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])
-
- ;; These keys will be available xterm starting probably from
- ;; version 214.
- (define-key xterm-function-map "\e[27;5;9~" [(control ?\t)])
- (define-key xterm-function-map "\e[27;5;44~" [(control ?\,)])
- (define-key xterm-function-map "\e[27;5;46~" [(control ?\.)])
- (define-key xterm-function-map "\e[27;5;47~" [(control ?\/)])
- (define-key xterm-function-map "\e[27;5;92~" [(control ?\\)])
-
- ;; 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]))
+;; 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])
+
+;; These keys will be available xterm starting probably from
+;; version 214.
+(define-key xterm-function-map "\e[27;5;9~" [(control ?\t)])
+(define-key xterm-function-map "\e[27;5;44~" [(control ?\,)])
+(define-key xterm-function-map "\e[27;5;46~" [(control ?\.)])
+(define-key xterm-function-map "\e[27;5;47~" [(control ?\/)])
+(define-key xterm-function-map "\e[27;5;92~" [(control ?\\)])
+
+;; 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
+ ;; rxvt's keybindings are incompatible with xterm's. It is
;; better in that case to use rxvt's initializion function.
(if (and (getenv "COLORTERM" (terminal-id))
(string-match "\\`rxvt" (getenv "COLORTERM" (terminal-id))))
- (progn
- (eval-and-compile (load "term/rxvt"))
- (terminal-init-rxvt))
-
- ;; 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.
- (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!
+ (tty-run-terminal-initialization (selected-frame) "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] local-function-key-map)
+ (substitute-key-definition [f14] [S-f2] local-function-key-map)
+ (substitute-key-definition [f15] [S-f3] local-function-key-map)
+ (substitute-key-definition [f16] [S-f4] local-function-key-map)
+ (substitute-key-definition [f17] [S-f5] local-function-key-map)
+ (substitute-key-definition [f18] [S-f6] local-function-key-map)
+ (substitute-key-definition [f19] [S-f7] local-function-key-map)
+ (substitute-key-definition [f20] [S-f8] local-function-key-map)
+ (substitute-key-definition [f21] [S-f9] local-function-key-map)
+ (substitute-key-definition [f22] [S-f10] local-function-key-map)
+ (substitute-key-definition [f23] [S-f11] local-function-key-map)
+ (substitute-key-definition [f24] [S-f12] local-function-key-map)
+
+ (substitute-key-definition [f25] [C-f1] local-function-key-map)
+ (substitute-key-definition [f26] [C-f2] local-function-key-map)
+ (substitute-key-definition [f27] [C-f3] local-function-key-map)
+ (substitute-key-definition [f28] [C-f4] local-function-key-map)
+ (substitute-key-definition [f29] [C-f5] local-function-key-map)
+ (substitute-key-definition [f30] [C-f6] local-function-key-map)
+ (substitute-key-definition [f31] [C-f7] local-function-key-map)
+ (substitute-key-definition [f32] [C-f8] local-function-key-map)
+ (substitute-key-definition [f33] [C-f9] local-function-key-map)
+ (substitute-key-definition [f34] [C-f10] local-function-key-map)
+ (substitute-key-definition [f35] [C-f11] local-function-key-map)
+ (substitute-key-definition [f36] [C-f12] local-function-key-map)
+
+ (substitute-key-definition [f37] [C-S-f1] local-function-key-map)
+ (substitute-key-definition [f38] [C-S-f2] local-function-key-map)
+ (substitute-key-definition [f39] [C-S-f3] local-function-key-map)
+ (substitute-key-definition [f40] [C-S-f4] local-function-key-map)
+ (substitute-key-definition [f41] [C-S-f5] local-function-key-map)
+ (substitute-key-definition [f42] [C-S-f6] local-function-key-map)
+ (substitute-key-definition [f43] [C-S-f7] local-function-key-map)
+ (substitute-key-definition [f44] [C-S-f8] local-function-key-map)
+ (substitute-key-definition [f45] [C-S-f9] local-function-key-map)
+ (substitute-key-definition [f46] [C-S-f10] local-function-key-map)
+ (substitute-key-definition [f47] [C-S-f11] local-function-key-map)
+ (substitute-key-definition [f48] [C-S-f12] local-function-key-map)
+
+ (substitute-key-definition [f49] [A-f1] local-function-key-map)
+ (substitute-key-definition [f50] [A-f2] local-function-key-map)
+ (substitute-key-definition [f51] [A-f3] local-function-key-map)
+ (substitute-key-definition [f52] [A-f4] local-function-key-map)
+ (substitute-key-definition [f53] [A-f5] local-function-key-map)
+ (substitute-key-definition [f54] [A-f6] local-function-key-map)
+ (substitute-key-definition [f55] [A-f7] local-function-key-map)
+ (substitute-key-definition [f56] [A-f8] local-function-key-map)
+ (substitute-key-definition [f57] [A-f9] local-function-key-map)
+ (substitute-key-definition [f58] [A-f10] local-function-key-map)
+ (substitute-key-definition [f59] [A-f11] local-function-key-map)
+ (substitute-key-definition [f60] [A-f12] local-function-key-map)
+
+ ;; Use inheritance to let the main keymap override those defaults.
+ ;; This way we don't override terminfo-derived settings or settings
+ ;; made in the .emacs file.
+ (let ((m (copy-keymap xterm-function-map)))
+ (set-keymap-parent m (keymap-parent local-function-key-map))
+ (set-keymap-parent local-function-key-map m)))
+
(xterm-register-default-colors)
;; This recomputes all the default faces given the colors we've just set up.
(tty-set-up-initial-frame-faces))