[comp.emacs] MicroEmacs 3.9e VT100 Key Mapping?

sam@ncsuvx.ncsu.edu (Mr. Sam Moore) (12/01/87)

I have MicroEmacs version 3.9e running on a MicroVax(Ultrix) and on a
VAX(VMS). On both I want to use the function keys and cursor keys. I 
compiled in the VT100 define. And I tried to map some keys in the
autoload script file. I was unsuccessful. Does anyone know how to do
this? Does anyone have any script files other than those in the distribution?
If so, I would like to see them.

Also, the VT100 define caused a compiler error in the input.c file in the
function getcmd(). Unless I have compiled with the wrong options, it seems
that there is a missing brace, {. If this is old news and there are fixes
out there somewhere, please let me know. 

Fron file input.c in function getcmd():

	/* process META prefix */
#if	VT100
	/* if ESC must be recognized.... change this to a 1 */
	if (c == metac || c == (CTRL | '[')) <-----------|
#else                                                    |
	if (c == metac) {                                |-- No brace.
#endif
	
Thanks,

Sam Moore 
NCSU Computing Center - Raleigh, NC
sam@ncsuvx (internet) 
sam@ncsuvax (bitnet)
samm@ncsuvm (bitnet)             

windley@iris.ucdavis.edu (Phil Windley) (12/01/87)

In article <1280@ncsuvx.ncsu.edu> sam@ncsuvx.ncsu.edu (Mr. Sam Moore) writes:
>
>I have MicroEmacs version 3.9e running on a MicroVax(Ultrix) and on a
>VAX(VMS). On both I want to use the function keys and cursor keys. I 
>compiled in the VT100 define. And I tried to map some keys in the
>autoload script file. I was unsuccessful. Does anyone know how to do
>this? Does anyone have any script files other than those in the distribution?
>If so, I would like to see them.

I will add my vt100.cmd file to the end of this.  Its not perfect yet,
but it does work.

>
> Unless I have compiled with the wrong options, it seems
>that there is a missing brace, {. If this is old news and there are fixes
>out there somewhere, please let me know. 
>

Yes there is a missing brace.  Just add it and everything will work
fine.  One more point.  The command file that follows has a line which
says 'write-message "~e="'.  This sends an escape-= to the terminal to
turn on the alternate keypad.  The ~e is not standard memacs.  I had
to modify the function token() in the file exec.c so that ~e output an
escape character.  This allows you to program the vt100 from within
a command file.  I'm not sure if this will cause other problems.  It
seems to me that there must be a goos reason for leaving it out, but
maybe not.


Phil Windley
Robotics Research Lab
University of California, Davis


----------------------- vt100.cmd -----------------------------------
;;; for vt100.
;;; alternate keypad mode.
       write-message "~e="
;;; bind alternate keypad.
;   bind-to-key                FNp                 ; 0	
      bind-to-key end-of-line           FNq	   ; 1
      bind-to-key  next-line            FNr	   ; 2
      bind-to-key next-page             FNs           ; 3
      bind-to-key backward-character    FNt           ; 4
;   bind-to-key                FNu	           ; 5
      bind-to-key forward-character     FNv	   ; 6
      bind-to-key beginning-of-line     FNw	   ; 7
      bind-to-key previous-line         FNx	   ; 8
      bind-to-key previous-page         FNy	   ; 9
      bind-to-key end-of-file           FNl	   ; ,
      bind-to-key beginning-of-file     FNm	   ; -
      bind-to-key delete-next-character FNn	   ; .
;   bind-to-key                FNM	           ;  enter


;;; function keys
     bind-to-key set-mark                FNP	   ;  pf1 (default)
     bind-to-key copy-region             FNQ	   ;  pf2 (default)
     bind-to-key kill-region             FNR	   ;  pf3 (default)
     bind-to-key yank                    FNS	   ;  pf4 (default)



 

Phil Windley
Robotics Research Lab
University of California, Davis

mcdonald@uxe.cso.uiuc.edu (12/02/87)

Here is an EMACS.RC file for VT-100 use. You should have the ANSI and VT100
bits set in your estruct.h file before compiling. This works on VAX/VMS
and on a friend's virulently non-IBM-compatible MSDOS machine. The bindings
to the functions keys can be changed according to taste.

Doug McDonald




;	EMACS.RC:	Startup file for MicroEMACS 3.8
;
;			This file is executed everytime the
;			editor is entered

set $discmd "FALSE"
write-message "[Setting up....]"
; the following line has to transmit the sequence <ESC>=  i.e. 27, 61
; in decimal. Input it in Emacs as "ctrl-q" then "esc" then "="
; This put the VT100 in application keymad mode as opposed to numeric keypad
write-message "="

;	***** Rebind the Function key group
bind-to-key next-line                   FNB
bind-to-key previous-line               FNA
bind-to-key backward-character          FND
bind-to-key forward-character           FNC


bind-to-key search-forward		FNP
bind-to-key search-reverse		FNQ
bind-to-key hunt-forward		FNR
bind-to-key hunt-backward		FNS
bind-to-key next-window			FNw
bind-to-key describe-bindings		FNx
bind-to-key find-file			FNy
bind-to-key execute-file		FNm
bind-to-key save-file			FNv
bind-to-key exit-emacs			FNl
bind-to-key next-page                   FNt
bind-to-key previous-page               FNu
bind-to-key execute-macro-10            FNM
bind-to-key end-of-line                 FNq
bind-to-key execute-macro-11            FNr
bind-to-key beginning-of-line           FNs
bind-to-key execute-macro-12            FNp
bind-to-key help                        FNn

;	Toggle function key window display

10	store-macro
	!if %rcfkeys
		!goto rcfoff
	!endif

;	toggle function key window on
	save-window
	1 next-window
	!if &not &sequal $cbufname "Function Keys"
		1 split-current-window
		select-buffer "Function Keys"
		!force 5 resize-window
		1 goto-line
	!endif
	set %rcfkeys TRUE
	!force restore-window
	!if &sequal $cbufname "Function Keys"
		next-window
	!endif
	write-message "[Function key window ON]"
	!return

	;Toggle the function key window off
*rcfoff
	save-window
	1 next-window
	!if &sequal "Function Keys" $cbufname
		delete-window
	!endif
	!force restore-window
	write-message "[Function key window OFF]"
	set %rcfkeys FALSE
!endm

11      store-macro
        beginning-of-line
        kill-to-end-of-line
        delete-next-character
!endm

12      store-macro
        yank
        insert-string "~n"
!endm

;	bring up the function key window

	1 split-current-window
	select-buffer "Function Keys"
	5 resize-window
	insert-string "f1 search      f2 search back    f3 hunt        f4 hunt back   ~n"
	insert-string "k7 next window k8 dscrbe-bndgs   k9 find file   k- exec file   ~n"
	insert-string "k4 next page   k5 previous page  k6 save file   k, exit emacs  ~n"
        insert-string "k1 jmp eol     k2 delete to eol  k3 jmp bol     ke toggle this~n"
        insert-string "      k0 restore kill buffer     k. help ~n "         
	beginning-of-file
	unmark-buffer
	next-window
	set %rcfkeys TRUE
	set $discmd "TRUE"
	write-message "[Emacs is READY]"

phil@sci.UUCP (Phil Kaufman) (12/02/87)

In article <1280@ncsuvx.ncsu.edu>, sam@ncsuvx.ncsu.edu (Mr. Sam Moore) writes:
> 
> 
> I have MicroEmacs version 3.9e running on a MicroVax(Ultrix) and on a
> VAX(VMS). On both I want to use the function keys and cursor keys. I 
> compiled in the VT100 define. And I tried to map some keys in the
> autoload script file. I was unsuccessful. Does anyone know how to do
> this? Does anyone have any script files other than those in the distribution?
> If so, I would like to see them.


See the command file at the end of this message. It handles the setup
for applications keypad mode and function and cursor key bindings. (If you
do not know the codes for each key you want to add, just do 'describe-
key' after running this macro.

> 
> Also, the VT100 define caused a compiler error in the input.c file in the
> function getcmd(). Unless I have compiled with the wrong options, it seems
> that there is a missing brace, {. If this is old news and there are fixes
> out there somewhere, please let me know. 
> 

Yes, there is a missing left brace. This bug was previously reported. Just
add it as you suggest and all is fine.


HERE IS ANSIIKEYS.CMD


;	SETUP COMMAND FILE FOR ANSII STYLE KEYBOARDS

;	ARROW KEY BINDINGS WORK ON UNMODIFIED MICROEMACS 3.9

;	USE OF FUNCTION KEYS AND APPLICATIONS MODE KEYPAD FUNCTION KEYS
;       WORKS ON UNMODIFIED 3.9e BUT ORIGINAL 3.9 RELEASE
;	REQUIRES A ONE LINE CHANGE TO input.c TO ADD O (that is upper
;	case Oh) TO THE FN KEY SCAN ALONG WITH [.

set	$discmd	0
;       BIND ANSI ARROW KEYS 
bind-to-key next-line FNB
bind-to-key previous-line FNA
bind-to-key backward-character FND
bind-to-key forward-character FNC

;       ENABLE APPLICATIONS KEYPAD MODE ON ENTRY
;       That's "ESC =" in the following write-message
write-message   "="

;       RESTORE NUMERIC KEYPAD ON EXIT
	That's "ESC >" in the following write-messages
bind-to-key execute-macro-39	M-Z
39	store-macro
	write-message   ">"
	quick-exit
!endm
bind-to-key execute-macro-38    ^X^C
38	store-macro
	write-message   ">"
	exit-emacs
!endm
bind-to-key execute-macro-37    ^X!
37	store-macro
	write-message   ">"
	shell-command
!endm


;	SOME PERSONAL PREFERENCE THINGS: 

;	BIND THE BS KEY TO DELETE IN PLACE (DEL deletes previous character)
bind-to-key delete-next-character ^H

;	US UNIX FOLK LIKE ^Z TO DO "BACKGROUND"
bind-to-key suspend-emacs	^Z

;	SOME DEFAULT USE OF PF KEYS
bind-to-key beginning-of-file   FNP	;PF1
bind-to-key previous-page	FNQ	;PF2
bind-to-key next-page		FNR	;PF3
bind-to-key end-of-file		FNS	;PF4

set	$discmd	1