return to first page linux journal archive
keywordscontents

Listing 1. xterm.el/con80x25.el

; xterm.el/con80x25.el
; Copyright 1996 John F. Bunch
;
; Defines function keys for an xterm
; or for a Linux virtual console
; with an IBM PC-compatible 101-key keyboard.

; Clear the function-key-map.
(setq function-key-map (make-sparse-keymap))

; Main function keys:
(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 function-key-map "\e[23~" [f11])
(define-key function-key-map "\e[24~" [f12])

; Editing keypad:
(define-key function-key-map "\e[2~" [insert])
(define-key function-key-map "\e[1~" [home])
(define-key function-key-map "\e[4~" [end])
(define-key function-key-map "\e[5~" [prior]) ;page-up
(define-key function-key-map "\e[6~" [next])  ;page-down

; Arrow keys (Reset or Normal mode):
(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 function-key-map "\e\e[A" [M-up])
(define-key function-key-map "\e\e[B" [M-down])
(define-key function-key-map "\e\e[C" [M-right])
(define-key function-key-map "\e\e[D" [M-left])

; Arrow keys (Set or Application mode):
(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 function-key-map "\e\eOA" [M-up])
(define-key function-key-map "\e\eOB" [M-down])
(define-key function-key-map "\e\eOC" [M-right])
(define-key function-key-map "\e\eOD" [M-left])

; Numeric keypad:
(define-key function-key-map "\eOP" [kp-f1])
(define-key function-key-map "\eOo" [kp-divide])
(define-key function-key-map "\eOj" [kp-multiply])
(define-key function-key-map "\eOm" [kp-subtract])
(define-key function-key-map "\eOk" [kp-add])
(define-key function-key-map "\eOM" [kp-enter])
(define-key function-key-map "\eOn" [kp-decimal])
(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])