Article View: gnu.emacs.bug
Article #98472ESCape key on vt220
From: sd
Date: Wed, 19 Jun 1991 13:36
Date: Wed, 19 Jun 1991 13:36
118 lines
4227 bytes
4227 bytes
This is the code I use to get the ESCape key (F11) working on my DEC vt220
(VT200 mode). In this mode the ESC key sends the sequence "[23~".
I hope you can find some ideas to put in the future releases of GNU
Emacs. (I'm not sure I didn't send this code to GNU a couple of years
ago. In any case .....)
************* /usr/local/lib/emacs/lisp/default.el ********************
;;;
;;; The following has been added to have a nice behavior under
;;; incremental search with the long escape sequence sent by the
;;; ESC (F11) key
;;;
;;; S. Diomedi - TECSIEL SpA
;;;
(if (or (string-equal (setq default-term (getenv "TERM")) "vt200")
(string-equal default-term "vt220"))
(progn
(if term-setup-hook
(progn
(setq user-term-setup-hook term-setup-hook)
(fset 'vt200-ESC-term-setup-hook
'(lambda ()
(if (boundp 'CSI-map)
(progn
(setq ESC-pf
(where-is-internal 'ESC-prefix CSI-map t))
(setq ESC-pf-length (length ESC-pf))))
(funcall user-term-setup-hook)))
)
(fset 'vt200-ESC-term-setup-hook
'(lambda ()
(if (boundp 'CSI-map)
(progn
(setq ESC-pf
(where-is-internal 'ESC-prefix CSI-map t))
(setq ESC-pf-length (length ESC-pf))))
(setq ESC-pf-length (length ESC-pf)))))
(setq term-setup-hook 'vt200-ESC-term-setup-hook)))
************* /usr/local/lib/emacs/lisp/isearch.el ********************
....
*** isearch.el Tue Jun 18 16:52:40 1991
--- isearch.el.org Wed Jan 9 23:01:00 1991
***************
*** 113,143 ****
(setq unread-command-char char)
(throw 'search-done t))
((eq char search-exit-char)
- ;;;
- ;;; The following has been added to have a nice behavior under
- ;;; incremental search with the long escape sequence sent by the
- ;;; ESC (F11) key
- ;;;
- ;;; S. Diomedi - TECSIEL SpA
- ;;;
- (if (and (boundp 'ESC-pf) ESC-pf)
- (if (eq (setq char (read-char)) 91)
- (let ((index 0))
- (while (< index ESC-pf-length)
- (if (eq (setq char (read-char))
- (aref ESC-pf index))
- (setq index (1+ index))
- (let ((i 0))
- (insert-char 91 1)
- (while (< i index)
- (progn
- (insert-char (aref ESC-pf i) 1)
- (setq i (1+ i))))
- (insert-char char 1)
- (throw 'search-done t)))))
- (progn
- (insert-char char 1)
- (throw 'search-done t))))
;; Esc means exit search normally.
;; Except, if first thing typed, it means do nonincremental
(if (= 0 (length search-string))
--- 113,118 ----
************* ~/.emacs ********************
....
;;;
;;; Management of the ESC and keypad keys on a vt220
;;;
(defun vt220-setup ()
(enable-arrow-keys)
; in vt220 mode the ESC key produces a different sequence
(global-unset-key "\e[23~\e")
(define-key esc-map "\e[23~" 'eval-expression)
(global-unset-key "\C-x\e")
(define-key ctl-x-map "\e[23~" 'repeat-complex-command)
(define-key repeat-complex-command-map "\e[23~p" 'previous-complex-command)
(define-key repeat-complex-command-map "\e[23~n" 'next-complex-command)
)
(let ((term (getenv "TERM")))
(if (or (string-equal term "vt220")
(and (eq system-type 'vax-vms)
(string-equal term "vt200")))
(setq term-setup-hook 'vt220-setup)))
.....
_________________________________________________________
Stefano Diomedi
Tecsiel S.p.A. phone: +39 (50) 512511
Via Santa Maria 19 fax: +39 (50) 589015
I-56126 Pisa - ITALY e-mail: sdiomedi@tecsiel.it
Technical Details
Message-ID:
<9106191336.AA06269@tecsiel.it>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cis.ohio-state.edu!tut.cis.ohio-state.edu!unreplyable!garbageShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,4135620939ac1542,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1991-06-19 06:36:43 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cis.ohio-state.edu!tut.cis.ohio-state.edu!unreplyable!garbage From: sd@teculx.tecsiel.it Newsgroups: gnu.emacs.bug Subject: ESCape key on vt220 Message-ID: <9106191336.AA06269@tecsiel.it> Date: 19 Jun 91 13:36:43 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 118 Approved: bug-gnu-emacs@prep.ai.mit.edu