;;; Code:
-(defvar rxvt-function-map (make-sparse-keymap)
- "Function key overrides for rxvt.")
+(defvar rxvt-function-map
+ (let ((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 map "\e[A" [up])
+ (define-key map "\e[B" [down])
+ (define-key map "\e[C" [right])
+ (define-key map "\e[D" [left])
+ (define-key map "\e[2~" [insert])
+ (define-key map "\e[3~" [delete])
+ (define-key map "\e[4~" [select])
+ (define-key map "\e[5~" [prior])
+ (define-key map "\e[6~" [next])
+ (define-key map "\e[7~" [home])
+ (define-key map "\e[8~" [end])
+ (define-key map "\e[11~" [f1])
+ (define-key map "\e[12~" [f2])
+ (define-key map "\e[13~" [f3])
+ (define-key map "\e[14~" [f4])
+ (define-key map "\e[15~" [f5])
+ (define-key map "\e[17~" [f6])
+ (define-key map "\e[18~" [f7])
+ (define-key map "\e[19~" [f8])
+ (define-key map "\e[20~" [f9])
+ (define-key map "\e[21~" [f10])
+ ;; The strings emitted by f11 and f12 are the same as the strings
+ ;; emitted by S-f1 and S-f2, so don't define f11 and f12.
+ ;; (define-key rxvt-function-map "\e[23~" [f11])
+ ;; (define-key rxvt-function-map "\e[24~" [f12])
+ (define-key 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 map "\e[11^" [C-f1])
+ (define-key map "\e[12^" [C-f2])
+ (define-key map "\e[13^" [C-f3])
+ (define-key map "\e[14^" [C-f4])
+ (define-key map "\e[15^" [C-f5])
+ (define-key map "\e[17^" [C-f6])
+ (define-key map "\e[18^" [C-f7])
+ (define-key map "\e[19^" [C-f8])
+ (define-key map "\e[20^" [C-f9])
+ (define-key map "\e[21^" [C-f10])
-(define-key rxvt-function-map "\e[23~" [S-f1])
-(define-key rxvt-function-map "\e[24~" [S-f2])
-(define-key rxvt-function-map "\e[25~" [S-f3])
-(define-key rxvt-function-map "\e[26~" [S-f4])
-(define-key rxvt-function-map "\e[28~" [S-f5])
-(define-key rxvt-function-map "\e[29~" [S-f6])
-(define-key rxvt-function-map "\e[31~" [S-f7])
-(define-key rxvt-function-map "\e[32~" [S-f8])
-(define-key rxvt-function-map "\e[33~" [S-f9])
-(define-key rxvt-function-map "\e[34~" [S-f10])
+ (define-key map "\e[23~" [S-f1])
+ (define-key map "\e[24~" [S-f2])
+ (define-key map "\e[25~" [S-f3])
+ (define-key map "\e[26~" [S-f4])
+ (define-key map "\e[28~" [S-f5])
+ (define-key map "\e[29~" [S-f6])
+ (define-key map "\e[31~" [S-f7])
+ (define-key map "\e[32~" [S-f8])
+ (define-key map "\e[33~" [S-f9])
+ (define-key map "\e[34~" [S-f10])
-(define-key rxvt-function-map "\e[23^" [C-S-f1])
-(define-key rxvt-function-map "\e[24^" [C-S-f2])
-(define-key rxvt-function-map "\e[25^" [C-S-f3])
-(define-key rxvt-function-map "\e[26^" [C-S-f4])
-(define-key rxvt-function-map "\e[28^" [C-S-f5])
-(define-key rxvt-function-map "\e[29^" [C-S-f6])
-(define-key rxvt-function-map "\e[31^" [C-S-f7])
-(define-key rxvt-function-map "\e[32^" [C-S-f8])
-(define-key rxvt-function-map "\e[33^" [C-S-f9])
-(define-key rxvt-function-map "\e[34^" [C-S-f10])
+ (define-key map "\e[23^" [C-S-f1])
+ (define-key map "\e[24^" [C-S-f2])
+ (define-key map "\e[25^" [C-S-f3])
+ (define-key map "\e[26^" [C-S-f4])
+ (define-key map "\e[28^" [C-S-f5])
+ (define-key map "\e[29^" [C-S-f6])
+ (define-key map "\e[31^" [C-S-f7])
+ (define-key map "\e[32^" [C-S-f8])
+ (define-key map "\e[33^" [C-S-f9])
+ (define-key map "\e[34^" [C-S-f10])
-(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 map "\e[2^" [C-insert])
+ (define-key map "\e[3^" [C-delete])
+ (define-key map "\e[5^" [C-prior])
+ (define-key map "\e[6^" [C-next])
+ (define-key map "\e[7^" [C-home])
+ (define-key map "\e[8^" [C-end])
+ (define-key map "\eOd" [C-left])
+ (define-key map "\eOc" [C-right])
+ (define-key map "\eOa" [C-up])
+ (define-key map "\eOb" [C-down])
-(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 map "\e[2;2~" [S-insert])
+ (define-key map "\e[3$" [S-delete])
+ (define-key map "\e[5$" [S-prior])
+ (define-key map "\e[6$" [S-next])
+ (define-key map "\e[7$" [S-home])
+ (define-key map "\e[8$" [S-end])
+ (define-key map "\e[d" [S-left])
+ (define-key map "\e[c" [S-right])
+ (define-key map "\e[a" [S-up])
+ (define-key map "\e[b" [S-down])
+ map)
+ "Function key overrides for rxvt.")
(defun terminal-init-rxvt ()
"Terminal initialization function for rxvt."
(define-key map "\e[23;3~" [A-f11])
(define-key map "\e[24;3~" [A-f12])
+ (define-key map "\eO4P" [M-S-f1])
+ (define-key map "\eO4Q" [M-S-f2])
+ (define-key map "\eO4R" [M-S-f3])
+ (define-key map "\eO4S" [M-S-f4])
+ (define-key map "\e[15;4~" [M-S-f5])
+ (define-key map "\e[17;4~" [M-S-f6])
+ (define-key map "\e[18;4~" [M-S-f7])
+ (define-key map "\e[19;4~" [M-S-f8])
+ (define-key map "\e[20;4~" [M-S-f9])
+ (define-key map "\e[21;4~" [M-S-f10])
+ (define-key map "\e[23;4~" [M-S-f11])
+ (define-key map "\e[24;4~" [M-S-f12])
+
(define-key map "\eOA" [up])
(define-key map "\eOB" [down])
(define-key map "\eOC" [right])
(define-key map "\e[1;2F" [S-end])
(define-key map "\e[1;2H" [S-home])
+ (define-key map "\e[1;4A" [M-S-up])
+ (define-key map "\e[1;4B" [M-S-down])
+ (define-key map "\e[1;4C" [M-S-right])
+ (define-key map "\e[1;4D" [M-S-left])
+ (define-key map "\e[1;4F" [M-S-end])
+ (define-key map "\e[1;4H" [M-S-home])
+
(define-key map "\e[1;5A" [C-up])
(define-key map "\e[1;5B" [C-down])
(define-key map "\e[1;5C" [C-right])
(define-key map "\e[1;6F" [C-S-end])
(define-key map "\e[1;6H" [C-S-home])
+ (define-key map "\e[1;8A" [C-M-S-up])
+ (define-key map "\e[1;8B" [C-M-S-down])
+ (define-key map "\e[1;8C" [C-M-S-right])
+ (define-key map "\e[1;8D" [C-M-S-left])
+ (define-key map "\e[1;8F" [C-M-S-end])
+ (define-key map "\e[1;8H" [C-M-S-home])
+
(define-key map "\e[1;3A" [A-up])
(define-key map "\e[1;3B" [A-down])
(define-key map "\e[1;3C" [A-right])
(define-key map "\e[5;2~" [S-prior])
(define-key map "\e[6;2~" [S-next])
+ (define-key map "\e[2;4~" [M-S-insert])
+ (define-key map "\e[3;4~" [M-S-delete])
+ (define-key map "\e[5;4~" [M-S-prior])
+ (define-key map "\e[6;4~" [M-S-next])
+
(define-key map "\e[2;5~" [C-insert])
(define-key map "\e[3;5~" [C-delete])
(define-key map "\e[5;5~" [C-prior])
(define-key map "\e[5;6~" [C-S-prior])
(define-key map "\e[6;6~" [C-S-next])
+ (define-key map "\e[2;8~" [C-M-S-insert])
+ (define-key map "\e[3;8~" [C-M-S-delete])
+ (define-key map "\e[5;8~" [C-M-S-prior])
+ (define-key map "\e[6;8~" [C-M-S-next])
+
(define-key map "\e[2;3~" [A-insert])
(define-key map "\e[3;3~" [A-delete])
(define-key map "\e[5;3~" [A-prior])
(define-key map "\e[27;6;37~" [?\C-%])
(define-key map "\e[27;6;38~" [?\C-&])
(define-key map "\e[27;6;40~" [?\C-(])
- (define-key map "\e[27;6;41~" [?\C-)])
+ (define-key map "\e[27;6;41~" [?\C-)])
(define-key map "\e[27;6;42~" [?\C-*])
(define-key map "\e[27;6;43~" [?\C-+])
(define-key map "\e[27;6;58~" [?\C-:])