From 2bb819d593a8cbf989a84c5346ba9386b89f6960 Mon Sep 17 00:00:00 2001 From: Karoly Lorentey Date: Sun, 26 Jun 2005 03:19:45 +0000 Subject: [PATCH] Update Lisp code for a terminal-local `function-key-map'. * lisp/term/x-win.el (x-setup-function-keys): New function. Move function-key-map tweaks here. * lisp/faces.el (x-create-frame-with-faces): Call x-setup-function-keys. * lisp/term/iris-ansi.el: Update for terminal-local function-key-map. * lisp/term/lk201.el: Ditto. * lisp/term/news.el: Ditto. * lisp/term/rxvt.el: Ditto. * lisp/term/sun.el: Ditto. * lisp/term/xterm.el: Ditto. * lisp/startup.el: Cosmetic change. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-356 --- lisp/faces.el | 1 + lisp/startup.el | 2 +- lisp/term/iris-ansi.el | 390 +++++++++++++++++++++-------------------- lisp/term/lk201.el | 129 +++++++------- lisp/term/news.el | 2 - lisp/term/rxvt.el | 16 +- lisp/term/sun.el | 2 - lisp/term/x-win.el | 40 +++-- lisp/term/xterm.el | 138 +++++++-------- 9 files changed, 365 insertions(+), 355 deletions(-) diff --git a/lisp/faces.el b/lisp/faces.el index e284d1f9ca5..eb8fe15e1c0 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1713,6 +1713,7 @@ Value is the new frame created." success) (unwind-protect (progn + (x-setup-function-keys frame) (x-handle-reverse-video frame parameters) (frame-set-background-mode frame) (face-set-after-frame-default frame) diff --git a/lisp/startup.el b/lisp/startup.el index 9bad1262579..f1cce0325f5 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -504,7 +504,7 @@ from the returned command line.") Window-system startup files should add their own initialization function to this list. The function should take no arguments, and initialize the window system environment to prepare for -opening the first frame (e.g. open a connection to the server).") +opening the first frame (e.g. open a connection to an X server).") ;; Handle the X-like command-line arguments "-fg", "-bg", "-name", etc. (defun tty-handle-args (args) diff --git a/lisp/term/iris-ansi.el b/lisp/term/iris-ansi.el index 05c7e9a5955..9cdddaae4e4 100644 --- a/lisp/term/iris-ansi.el +++ b/lisp/term/iris-ansi.el @@ -25,304 +25,316 @@ ;;; Code: -;; XXX We need to find a way to have these define-keys be display-local. -- Lorentey +(defvar iris-function-map nil + "Function key definitions for SGI xwsh and winterm apps.") -(define-key function-key-map "\e[120q" [S-escape]) -(define-key function-key-map "\e[121q" [C-escape]) +;; Make reloads faster. +(unless iris-function-map + (setq iris-function-map (make-sparse-keymap)) -(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[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 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 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[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 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 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[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 function-key-map "\e[057q" [C-`]) -(define-key function-key-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[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 function-key-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[059q" [?\M-2]) -(define-key function-key-map "\e[051q" [?\C-4]) -(define-key function-key-map "\e[061q" [?\M-4]) + (define-key iris-function-map "\e[050q" [?\C-3]) + (define-key iris-function-map "\e[060q" [?\M-3]) -(define-key function-key-map "\e[052q" [?\C-5]) -(define-key function-key-map "\e[062q" [?\M-5]) + (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 function-key-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[063q" [?\M-6]) -(define-key function-key-map "\e[054q" [?\C-8]) -(define-key function-key-map "\e[065q" [?\M-8]) + (define-key iris-function-map "\e[053q" [?\C-7]) + (define-key iris-function-map "\e[064q" [?\M-7]) -(define-key function-key-map "\e[055q" [?\C-9]) -(define-key function-key-map "\e[066q" [?\M-9]) + (define-key iris-function-map "\e[054q" [?\C-8]) + (define-key iris-function-map "\e[065q" [?\M-8]) -(define-key function-key-map "\e[056q" [?\C-0]) -(define-key function-key-map "\e[067q" [?\M-0]) + (define-key iris-function-map "\e[055q" [?\C-9]) + (define-key iris-function-map "\e[066q" [?\M-9]) -(define-key function-key-map "\e[068q" [?\M--]) + (define-key iris-function-map "\e[056q" [?\C-0]) + (define-key iris-function-map "\e[067q" [?\M-0]) -(define-key function-key-map "\e[069q" [?\C-=]) -(define-key function-key-map "\e[070q" [?\M-=]) + (define-key iris-function-map "\e[068q" [?\M--]) -;; I don't know what to do with those. -;(define-key function-key-map "^H" []) -;(define-key function-key-map "^H" [S-]) -;(define-key function-key-map "\177" [C-]) -;(define-key function-key-map "\e[071q" [M-]) + (define-key iris-function-map "\e[069q" [?\C-=]) + (define-key iris-function-map "\e[070q" [?\M-=]) -(define-key function-key-map "\e[Z" [?\S-\t]) -(define-key function-key-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]) + ;; I don't know what to do with those. + ;(define-key iris-function-map "^H" []) + ;(define-key iris-function-map "^H" [S-]) + ;(define-key iris-function-map "\177" [C-]) + ;(define-key iris-function-map "\e[071q" [M-]) -(define-key function-key-map "\e[074q" [?\M-q]) + (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 function-key-map "\e[075q" [?\M-w]) + (define-key iris-function-map "\e[074q" [?\M-q]) -(define-key function-key-map "\e[076q" [?\M-e]) + (define-key iris-function-map "\e[075q" [?\M-w]) -(define-key function-key-map "\e[077q" [?\M-r]) + (define-key iris-function-map "\e[076q" [?\M-e]) -(define-key function-key-map "\e[078q" [?\M-t]) + (define-key iris-function-map "\e[077q" [?\M-r]) -(define-key function-key-map "\e[079q" [?\M-y]) + (define-key iris-function-map "\e[078q" [?\M-t]) -(define-key function-key-map "\e[080q" [?\M-u]) + (define-key iris-function-map "\e[079q" [?\M-y]) -(define-key function-key-map "\e[081q" [?\M-i]) + (define-key iris-function-map "\e[080q" [?\M-u]) -(define-key function-key-map "\e[082q" [?\M-o]) + (define-key iris-function-map "\e[081q" [?\M-i]) -(define-key function-key-map "\e[083q" [?\M-p]) + (define-key iris-function-map "\e[082q" [?\M-o]) -(define-key function-key-map "\e[084q" [?\M-\[]) + (define-key iris-function-map "\e[083q" [?\M-p]) -(define-key function-key-map "\e[085q" [?\M-\]]) + (define-key iris-function-map "\e[084q" [?\M-\[]) -(define-key function-key-map "\e[086q" [?\M-\\]) + (define-key iris-function-map "\e[085q" [?\M-\]]) -(define-key function-key-map "\e[087q" [?\M-a]) + (define-key iris-function-map "\e[086q" [?\M-\\]) -(define-key function-key-map "\e[088q" [?\M-s]) + (define-key iris-function-map "\e[087q" [?\M-a]) -(define-key function-key-map "\e[089q" [?\M-d]) + (define-key iris-function-map "\e[088q" [?\M-s]) -(define-key function-key-map "\e[090q" [?\M-f]) + (define-key iris-function-map "\e[089q" [?\M-d]) -(define-key function-key-map "\e[091q" [?\M-g]) + (define-key iris-function-map "\e[090q" [?\M-f]) -(define-key function-key-map "\e[092q" [?\M-h]) + (define-key iris-function-map "\e[091q" [?\M-g]) -(define-key function-key-map "\e[093q" [?\M-j]) + (define-key iris-function-map "\e[092q" [?\M-h]) -(define-key function-key-map "\e[094q" [?\M-k]) + (define-key iris-function-map "\e[093q" [?\M-j]) -(define-key function-key-map "\e[095q" [?\M-l]) + (define-key iris-function-map "\e[094q" [?\M-k]) -(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[095q" [?\M-l]) -(define-key function-key-map "\e[098q" [?\C-']) -(define-key function-key-map "\e[099q" [?\M-']) + (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[100q" [?\M-\n]) + (define-key iris-function-map "\e[098q" [?\C-']) + (define-key iris-function-map "\e[099q" [?\M-']) -(define-key function-key-map "\e[101q" [?\M-z]) + (define-key iris-function-map "\e[100q" [?\M-\n]) -(define-key function-key-map "\e[102q" [?\M-x]) + (define-key iris-function-map "\e[101q" [?\M-z]) -(define-key function-key-map "\e[103q" [?\M-c]) + (define-key iris-function-map "\e[102q" [?\M-x]) -(define-key function-key-map "\e[104q" [?\M-v]) + (define-key iris-function-map "\e[103q" [?\M-c]) -(define-key function-key-map "\e[105q" [?\M-b]) + (define-key iris-function-map "\e[104q" [?\M-v]) -(define-key function-key-map "\e[106q" [M-n]) + (define-key iris-function-map "\e[105q" [?\M-b]) -(define-key function-key-map "\e[107q" [M-m]) + (define-key iris-function-map "\e[106q" [M-n]) -(define-key function-key-map "\e[108q" [?\C-,]) -(define-key function-key-map "\e[109q" [?\M-,]) + (define-key iris-function-map "\e[107q" [M-m]) -(define-key function-key-map "\e[110q" [?\C-.]) -(define-key function-key-map "\e[111q" [?\M-.]) + (define-key iris-function-map "\e[108q" [?\C-,]) + (define-key iris-function-map "\e[109q" [?\M-,]) -(define-key function-key-map "\e[112q" [?\C-/]) -(define-key function-key-map "\e[113q" [?\M-/]) + (define-key iris-function-map "\e[110q" [?\C-.]) + (define-key iris-function-map "\e[111q" [?\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[112q" [?\C-/]) + (define-key iris-function-map "\e[113q" [?\M-/]) -(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[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 function-key-map "\e[150q" [prior]) -(define-key function-key-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[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 function-key-map "^?" [delete]) ?? something else seems to take care of this. -(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 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 "^?" [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[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[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[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 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[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[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[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[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[164q" [S-down]) + (define-key iris-function-map "\e[165q" [C-down]) + (define-key iris-function-map "\e[166q" [M-down]) -;; 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[167q" [S-right]) + (define-key iris-function-map "\e[168q" [C-right]) + (define-key iris-function-map "\e[169q" [M-right]) -(define-key function-key-map "\e[187q" [?\C-*]) -(define-key function-key-map "\e[188q" [?\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 function-key-map "\e[198q" [?\C--]) -(define-key function-key-map "\e[199q" [?\M--]) + (define-key iris-function-map "\e[187q" [?\C-*]) + (define-key iris-function-map "\e[188q" [?\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[198q" [?\C--]) + (define-key iris-function-map "\e[199q" [?\M--]) -;(define-key function-key-map "\e[A" [up]) -(define-key function-key-map "\e[182q" [C-up]) + ;; 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 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 function-key-map "\e[D" [left]) -(define-key function-key-map "\e[174q" [C-left]) + (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 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 function-key-map "\e[146q" [end]) -(define-key function-key-map "\e[176q" [C-end]) + ;(define-key iris-function-map "\e[C" [right]) + (define-key iris-function-map "\e[192q" [C-right]) -;(define-key function-key-map "\e[B" [down]) -(define-key function-key-map "\e[186q" [C-down]) + ;(define-key iris-function-map "\e[146q" [end]) + (define-key iris-function-map "\e[176q" [C-end]) -;(define-key function-key-map "\e[154q" [next]) -(define-key function-key-map "\e[194q" [C-next]) + ;(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 function-key-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[100q" [M-enter]) -(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[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])) + +;; 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 function-key-map)) + (set-keymap-parent 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 e09b176ba8f..735db12ba82 100644 --- a/lisp/term/lk201.el +++ b/lisp/term/lk201.el @@ -2,86 +2,85 @@ ;; Define function key sequences for DEC terminals. (defvar lk201-function-map nil - "Function key definitions for lk201.") + "Function key definitions for DEC terminals.") -;; Protect against reloads. +;; Make reloads faster. (unless lk201-function-map (setq lk201-function-map (make-sparse-keymap)) - ;; XXX We need to find a way to have these define-keys be display-local. -- Lorentey - ;; 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]) + ;; (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 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]) + (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 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]) + (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 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]) + ;; (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 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 "\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 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]) + (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])) - ;; 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. - (set-keymap-parent lk201-function-map (keymap-parent function-key-map)) - (set-keymap-parent function-key-map lk201-function-map)) +;; 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 function-key-map)) + (set-keymap-parent 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 1b251dae58e..a6f7481c422 100644 --- a/lisp/term/news.el +++ b/lisp/term/news.el @@ -35,8 +35,6 @@ (if (not (keymapp news-fkey-prefix)) (error "What? Your news termcap/terminfo has no keycaps in it")) - ;; XXX We need to find a way to have these define-keys be display-local. -- Lorentey - ;; Termcap or terminfo will set these ;; (define-key news-fkey-prefix "P" [f1]) ;; (define-key news-fkey-prefix "Q" [f2]) diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el index 180e0b40946..6b824ecd0b9 100644 --- a/lisp/term/rxvt.el +++ b/lisp/term/rxvt.el @@ -36,7 +36,6 @@ (setq rxvt-function-map (make-sparse-keymap)) ;; Set up function-key-map entries that termcap and terminfo don't know. - ;; XXX We need to find a way to have these define-keys be display-local. -- Lorentey (define-key rxvt-function-map "\e[A" [up]) (define-key rxvt-function-map "\e[B" [down]) (define-key rxvt-function-map "\e[C" [right]) @@ -95,13 +94,14 @@ (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]) - - ;; 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 rxvt-function-map (keymap-parent function-key-map)) - (set-keymap-parent function-key-map rxvt-function-map)) + (define-key rxvt-function-map "\e[b" [S-down])) + +;; 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 function-key-map)) + (set-keymap-parent function-key-map m)) ;; Set up colors, for those versions of rxvt that support it. diff --git a/lisp/term/sun.el b/lisp/term/sun.el index 667762e0aa7..238bb2f7212 100644 --- a/lisp/term/sun.el +++ b/lisp/term/sun.el @@ -92,8 +92,6 @@ ;; so we ignore them on the way down ;; -;; XXX We need to find a way to have these define-keys be display-local. -- Lorentey - (defvar sun-raw-prefix (make-sparse-keymap)) (define-key function-key-map "\e[" sun-raw-prefix) diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index ae36e208bff..56ee16de2ba 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -1167,24 +1167,26 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp") ;;;; Function keys -;; 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 (or frame (selected-frame)) + (define-key function-key-map [backspace] [127]) + (define-key function-key-map [delete] [127]) + (define-key function-key-map [tab] [?\t]) + (define-key function-key-map [linefeed] [?\n]) + (define-key function-key-map [clear] [?\C-l]) + (define-key function-key-map [return] [?\C-m]) + (define-key function-key-map [escape] [?\e]) + (define-key function-key-map [M-backspace] [?\M-\d]) + (define-key function-key-map [M-delete] [?\M-\d]) + (define-key function-key-map [M-tab] [?\M-\t]) + (define-key function-key-map [M-linefeed] [?\M-\n]) + (define-key function-key-map [M-clear] [?\M-\C-l]) + (define-key function-key-map [M-return] [?\M-\C-m]) + (define-key function-key-map [M-escape] [?\M-\e]) + (define-key function-key-map [iso-lefttab] [backtab]) + (define-key function-key-map [S-iso-lefttab] [backtab]))) ;; These tell read-char how to convert ;; these special chars to ASCII. @@ -2246,7 +2248,7 @@ order until succeed.") (if text (remove-text-properties 0 (length text) '(foreign-selection nil) text)) text)) - + ;;; Return the value of the current X selection. ;;; Consult the selection, and the cut buffer. Treat empty strings ;;; as if they were unset. diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index f4cdd26a438..dd3f2dadece 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -31,72 +31,10 @@ (defvar xterm-function-map nil "Function key map overrides for xterm.") -;; Protect against reloads. +;; Make reloads faster. (unless xterm-function-map (setq xterm-function-map (make-sparse-keymap)) - ;; XXX We need to find a way to make these definitions display-local. -- Lorentey - - ;; 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) - (define-key xterm-function-map "\e[A" [up]) (define-key xterm-function-map "\e[B" [down]) (define-key xterm-function-map "\e[C" [right]) @@ -245,13 +183,75 @@ (define-key xterm-function-map "\eO5C" [C-right]) (define-key xterm-function-map "\eO5D" [C-left]) (define-key xterm-function-map "\eO5F" [C-end]) - (define-key xterm-function-map "\eO5H" [C-home]) + (define-key xterm-function-map "\eO5H" [C-home])) + +;; 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 function-key-map)) + (set-keymap-parent function-key-map m)) + +;; 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) - ;; 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 xterm-function-map (keymap-parent function-key-map)) - (set-keymap-parent function-key-map xterm-function-map)) ;; Set up colors, for those versions of xterm that support it. (defvar xterm-standard-colors -- 2.39.2