diff options
| author | Stefan Monnier | 2007-10-09 05:16:20 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-10-09 05:16:20 +0000 |
| commit | 8e33712945830b427e05732391ad9072f5279543 (patch) | |
| tree | 0443ef03b1492ab85b68f48f89cd7ee7133b1658 | |
| parent | 3c33ac0785b5d6ba3d6af37c9bb318a5336e353d (diff) | |
| download | emacs-8e33712945830b427e05732391ad9072f5279543.tar.gz emacs-8e33712945830b427e05732391ad9072f5279543.zip | |
(rxvt-alternatives-map): New map.
(terminal-init-rxvt): Use it.
Bind rxvt-function-map in input-decode-map.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/term/rxvt.el | 94 |
2 files changed, 55 insertions, 43 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index aa2a8235c32..823ecb77788 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2007-10-09 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2007-10-09 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * term/rxvt.el (rxvt-alternatives-map): New map. | ||
| 4 | (terminal-init-rxvt): Use it. | ||
| 5 | Bind rxvt-function-map in input-decode-map. | ||
| 6 | |||
| 3 | * term/xterm.el (xterm-alternatives-map): New map. | 7 | * term/xterm.el (xterm-alternatives-map): New map. |
| 4 | (terminal-init-xterm): Use it. | 8 | (terminal-init-xterm): Use it. |
| 5 | Bind xterm-function-map in input-decode-map. | 9 | Bind xterm-function-map in input-decode-map. |
diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el index 7eb175c7c98..c96c8a6e290 100644 --- a/lisp/term/rxvt.el +++ b/lisp/term/rxvt.el | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | (defvar rxvt-function-map | 29 | (defvar rxvt-function-map |
| 30 | (let ((map (make-sparse-keymap))) | 30 | (let ((map (make-sparse-keymap))) |
| 31 | 31 | ||
| 32 | ;; Set up function-key-map entries that termcap and terminfo don't know. | 32 | ;; Set up input-decode-map entries that termcap and terminfo don't know. |
| 33 | (define-key map "\e[A" [up]) | 33 | (define-key map "\e[A" [up]) |
| 34 | (define-key map "\e[B" [down]) | 34 | (define-key map "\e[B" [down]) |
| 35 | (define-key map "\e[C" [right]) | 35 | (define-key map "\e[C" [right]) |
| @@ -114,56 +114,64 @@ | |||
| 114 | map) | 114 | map) |
| 115 | "Function key overrides for rxvt.") | 115 | "Function key overrides for rxvt.") |
| 116 | 116 | ||
| 117 | (defun terminal-init-rxvt () | 117 | (defvar rxvt-alternatives-map |
| 118 | "Terminal initialization function for rxvt." | 118 | (let ((map (make-sparse-keymap))) |
| 119 | ;; The terminal intialization C code file might have initialized | ||
| 120 | ;; function keys F11->F42 from the termcap/terminfo information. On | ||
| 121 | ;; a PC-style keyboard these keys correspond to | ||
| 122 | ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C-, C-S-. The | ||
| 123 | ;; code here subsitutes the corresponding defintions in | ||
| 124 | ;; function-key-map. This substitution is needed because if a key | ||
| 125 | ;; definition if found in function-key-map, there are no further | ||
| 126 | ;; lookups in other keymaps. | ||
| 127 | (define-key map [f11] [S-f1]) | ||
| 128 | (define-key map [f12] [S-f2]) | ||
| 129 | (define-key map [f13] [S-f3]) | ||
| 130 | (define-key map [f14] [S-f4]) | ||
| 131 | (define-key map [f15] [S-f5]) | ||
| 132 | (define-key map [f16] [S-f6]) | ||
| 133 | (define-key map [f17] [S-f7]) | ||
| 134 | (define-key map [f18] [S-f8]) | ||
| 135 | (define-key map [f19] [S-f9]) | ||
| 136 | (define-key map [f20] [S-f10]) | ||
| 119 | 137 | ||
| 120 | ;; The terminal intialization C code file might have initialized | 138 | (define-key map [f23] [C-f1]) |
| 121 | ;; function keys F11->F42 from the termcap/terminfo information. On | 139 | (define-key map [f24] [C-f2]) |
| 122 | ;; a PC-style keyboard these keys correspond to | 140 | (define-key map [f25] [C-f3]) |
| 123 | ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C-, C-S-. The | 141 | (define-key map [f26] [C-f4]) |
| 124 | ;; code here subsitutes the corresponding defintions in | 142 | (define-key map [f27] [C-f5]) |
| 125 | ;; function-key-map. This substitution is needed because if a key | 143 | (define-key map [f28] [C-f6]) |
| 126 | ;; definition if found in function-key-map, there are no further | 144 | (define-key map [f29] [C-f7]) |
| 127 | ;; lookups in other keymaps. | 145 | (define-key map [f30] [C-f8]) |
| 128 | (substitute-key-definition [f11] [S-f1] local-function-key-map) | 146 | (define-key map [f31] [C-f9]) |
| 129 | (substitute-key-definition [f12] [S-f2] local-function-key-map) | 147 | (define-key map [f32] [C-f10]) |
| 130 | (substitute-key-definition [f13] [S-f3] local-function-key-map) | ||
| 131 | (substitute-key-definition [f14] [S-f4] local-function-key-map) | ||
| 132 | (substitute-key-definition [f15] [S-f5] local-function-key-map) | ||
| 133 | (substitute-key-definition [f16] [S-f6] local-function-key-map) | ||
| 134 | (substitute-key-definition [f17] [S-f7] local-function-key-map) | ||
| 135 | (substitute-key-definition [f18] [S-f8] local-function-key-map) | ||
| 136 | (substitute-key-definition [f19] [S-f9] local-function-key-map) | ||
| 137 | (substitute-key-definition [f20] [S-f10] local-function-key-map) | ||
| 138 | 148 | ||
| 139 | (substitute-key-definition [f23] [C-f1] local-function-key-map) | 149 | (define-key map [f33] [C-S-f1]) |
| 140 | (substitute-key-definition [f24] [C-f2] local-function-key-map) | 150 | (define-key map [f34] [C-S-f2]) |
| 141 | (substitute-key-definition [f25] [C-f3] local-function-key-map) | 151 | (define-key map [f35] [C-S-f3]) |
| 142 | (substitute-key-definition [f26] [C-f4] local-function-key-map) | 152 | (define-key map [f36] [C-S-f4]) |
| 143 | (substitute-key-definition [f27] [C-f5] local-function-key-map) | 153 | (define-key map [f37] [C-S-f5]) |
| 144 | (substitute-key-definition [f28] [C-f6] local-function-key-map) | 154 | (define-key map [f38] [C-S-f6]) |
| 145 | (substitute-key-definition [f29] [C-f7] local-function-key-map) | 155 | (define-key map [f39] [C-S-f7]) |
| 146 | (substitute-key-definition [f30] [C-f8] local-function-key-map) | 156 | (define-key map [f40] [C-S-f8]) |
| 147 | (substitute-key-definition [f31] [C-f9] local-function-key-map) | 157 | (define-key map [f41] [C-S-f9]) |
| 148 | (substitute-key-definition [f32] [C-f10] local-function-key-map) | 158 | (define-key map [f42] [C-S-f10]) |
| 159 | map) | ||
| 160 | "Keymap of possible alternative meanings for some keys.") | ||
| 161 | |||
| 162 | (defun terminal-init-rxvt () | ||
| 163 | "Terminal initialization function for rxvt." | ||
| 149 | 164 | ||
| 150 | (substitute-key-definition [f33] [C-S-f1] local-function-key-map) | 165 | (let ((map (copy-keymap rxvt-alternatives-map))) |
| 151 | (substitute-key-definition [f34] [C-S-f2] local-function-key-map) | 166 | (set-keymap-parent map (keymap-parent local-function-key-map)) |
| 152 | (substitute-key-definition [f35] [C-S-f3] local-function-key-map) | 167 | (set-keymap-parent local-function-key-map map)) |
| 153 | (substitute-key-definition [f36] [C-S-f4] local-function-key-map) | ||
| 154 | (substitute-key-definition [f37] [C-S-f5] local-function-key-map) | ||
| 155 | (substitute-key-definition [f38] [C-S-f6] local-function-key-map) | ||
| 156 | (substitute-key-definition [f39] [C-S-f7] local-function-key-map) | ||
| 157 | (substitute-key-definition [f40] [C-S-f8] local-function-key-map) | ||
| 158 | (substitute-key-definition [f41] [C-S-f9] local-function-key-map) | ||
| 159 | (substitute-key-definition [f42] [C-S-f10] local-function-key-map) | ||
| 160 | 168 | ||
| 161 | ;; Use inheritance to let the main keymap override those defaults. | 169 | ;; Use inheritance to let the main keymap override those defaults. |
| 162 | ;; This way we don't override terminfo-derived settings or settings | 170 | ;; This way we don't override terminfo-derived settings or settings |
| 163 | ;; made in the .emacs file. | 171 | ;; made in the .emacs file. |
| 164 | (let ((m (copy-keymap rxvt-function-map))) | 172 | (let ((m (copy-keymap rxvt-function-map))) |
| 165 | (set-keymap-parent m (keymap-parent local-function-key-map)) | 173 | (set-keymap-parent m (keymap-parent input-decode-map)) |
| 166 | (set-keymap-parent local-function-key-map m)) | 174 | (set-keymap-parent input-decode-map m)) |
| 167 | 175 | ||
| 168 | ;; Initialize colors and background mode. | 176 | ;; Initialize colors and background mode. |
| 169 | (rxvt-register-default-colors) | 177 | (rxvt-register-default-colors) |