[comp.unix.sysv386] Emacs term def -- Message Summary

geoff@vax1.mankato.msus.edu (04/30/91)

(MESSAGE SUMMARY) topic: Emacs AT386 keyboard definition files


	First I would like to thank all of the people that so promptly sent me
information on this subject.

	Ths information I recieved includes a terminal definition script
writtem in the emacs lisp code that needs to be edited to taste and placed into
the directory .../emacs/lisp/term.  I also recieved a neat fix to cure the
backspace problem(backspace is ctrl-h -- which usually brings up help in
emacs).   These files are appended to the end of this posting.  Again thankyou.

--------------------------------------------------------------------------------
  **				Geoff Kuchera 
*   *			
*     			     A-427 Crawford Hall 
*  ** **    **		      Mankato, MN 56001
  **   *  *		       (507) 389-1691
       ***                            
       *   *                                          
      **    **	    Internet: Geoff@Vax1.Mankato.MSUS.EDU            
--------------------------------------------------------------------------------

Thankyou to David Kessner for the following information:

--------------------------------------------------------------------------------

Take the file located at the end of this message, and place it in
..emacs/lisp/term/at386.el.  When EMACS starts up, it looks at the terminal
type, then looks in that directory for a lisp file to run (to set up for that
terminal).  Normally, the at386 is not included with EMACS.  That same file
may be _copied_ to xterm.el (after making a backup of the old xterm.el file)
so that you can have EMACS in an xterm window.

I have tried this under ESIX, and the documentation (for at386.el) says it
was for ISC.  It should also work under SCO...

In addition, I have found a nice little tip recently.  Put this in your 
.emacs file:

	(global-unset-key "\C-h")
	(global-set-key "\C-h" 'delete-backward-char)
	(global-unset-key "\M-/");
	(global-set-key "\M-/" 'help-for-help)

It maked the backspace work like a backspace key should work, rather than
calling up the help menu.  To bring up help, press M-/ (a.k.a. Alt-?).  The
DEL key is unchanged-- I never did figure out how to make it behave like a
DEL key...


---------------------------- Cut Here ----------------------------------------
;;From: apple!scenic.wa.com!pauld (Paul Barton-Davis)
;;Sender: apple!ai.mit.edu!gnulists
;;To: bram!joe@verdix.verdix.com
;;Cc: info-gnu-emacs@prep.ai.mit.edu
;;Subject: M- and Keypad keys for ISC 386/ix
;;Date: Mon, 17 Dec 90 09:09:03 PST
;;
;;Joe - here's my AT386.el, used with ISC 386/ix. Put this in a directory
;;called term, a subdirectory of your load path ....
;;
;;Paul Barton-Davis			<pauld@scenic.wa.com>
;;ScenicSoft, Inc.	
;;(206) 776-7760		"Stand down Margaret, stand down please ..."
;;			
;;

;; Function key bindings for AT386 (actually, a poor NCR emulation)
;; Paul Davis <scenic!pauld@uunet.uu.net> Nov 1989

;; Modified by Kayvan Sylvan - Tue Dec 18 15:45:25 1990
;; Made Alt-keys be the equivalent of Meta keys.

(defvar at386-esc-O-map (make-sparse-keymap)
  "Keymap for AT386 ESC-O encoded function keys")

(defvar at386-esc-b-map (make-sparse-keymap)
  "Keymap for AT386 ESC-[ encoded function keys")

(defvar at386-alt-map (copy-keymap esc-map)
  "Keymap for ALTered keys (which are preceded by ESC-N)")

(define-key esc-map "O" at386-esc-O-map)
(define-key esc-map "[" at386-esc-b-map)
(define-key esc-map "N" at386-alt-map)

(define-key at386-esc-O-map "P" 'vm)				; F1
(define-key at386-esc-O-map "Q" 'gnus)				; F2
(define-key at386-esc-O-map "R" 'cmushell)			; F3
(define-key at386-esc-O-map "S" 'dired)				; F4

(define-key at386-esc-O-map "T" 'find-file)			; F5
(define-key at386-esc-O-map "U" 'find-file-other-window)	; F6
(define-key at386-esc-O-map "V" 'other-window)			; F7
(define-key at386-esc-O-map "W" 'switch-to-buffer)		; F8

(define-key at386-esc-O-map "X" 'save-buffer)			; F9
(define-key at386-esc-O-map "Y" 'delete-other-windows)		; F10
(define-key at386-esc-O-map "Z" 'compile)			; F11
(define-key at386-esc-O-map "A" 'replace-regexp)		; F12

(define-key at386-esc-b-map "@" 'yank)				; Insert
(define-key at386-esc-b-map "H" 'beginning-of-buffer)		; Home
(define-key at386-esc-b-map "V" 'scroll-down)			; Page Up
(define-key at386-esc-b-map "Y" 'end-of-buffer)			; End
(define-key at386-esc-b-map "U" 'scroll-up)			; Page Down

;; ANSI cursor arrows

(define-key at386-esc-b-map "A" 'previous-line)		; up
(define-key at386-esc-b-map "B" 'next-line)		; down
(define-key at386-esc-b-map "C" 'forward-char)		; right
(define-key at386-esc-b-map "D" 'backward-char)		; left

;; Numeric keypad (without Number Lock)

(define-key at386-esc-b-map "S" 'eval-expression)		; -
(define-key at386-esc-b-map "T" 'execute-extended-command)	; +

;; ALT-ered keys are preceded by the escape sequence ESC-N

(defun ignore-key ()
  (interactive)
  (ignore))

;(define-key at386-alt-map "a" 'beginning-of-defun)
;(define-key at386-alt-map "b" 'backward-word)
;(define-key at386-alt-map "c" 'shell-command)
;(define-key at386-alt-map "d" 'beginning-of-defun)
;(define-key at386-alt-map "e" 'end-of-defun)
;(define-key at386-alt-map "f" 'forward-word)
;(define-key at386-alt-map "g" 'grep)
;(define-key at386-alt-map "h" 'help-command)
;(define-key at386-alt-map "i" 'indent-region)
;(define-key at386-alt-map "j" 'ignore-key)
;(define-key at386-alt-map "k" 'kill-rectangle)
;(define-key at386-alt-map "l" 'goto-line)
;(define-key at386-alt-map "m" 'delete-matching-lines)
;(define-key at386-alt-map "n" 'delete-non-matching-lines)
;(define-key at386-alt-map "o" 'occur)
;(define-key at386-alt-map "p" 'lpr-buffer)
;(define-key at386-alt-map "q" 'ignore-key)
;(define-key at386-alt-map "r" 'isearch-backward-regexp)
;(define-key at386-alt-map "s" 'shell-command-on-region)
;(define-key at386-alt-map "t" 'transpose-sexps)
;(define-key at386-alt-map "u" 'ignore-key)
;(define-key at386-alt-map "v" 'ignore-key)
;(define-key at386-alt-map "w" 'forward-word)
;(define-key at386-alt-map "x" 'forward-sexp)
;(define-key at386-alt-map "y" 'yank-rectangle)
;(define-key at386-alt-map "z" 'backward-sexp)
;(define-key at386-alt-map "/" 'dabbrev-expand)
;(define-key at386-alt-map "[" 'forward-paragraph)
;
;(define-key global-map "\C-h" 'backward-delete-char-untabify) ; BACKSPACE

leo@aai.com (05/03/91)

geoff@vax1.mankato.msus.edu writes:

>(MESSAGE SUMMARY) topic: Emacs AT386 keyboard definition files
>In addition, I have found a nice little tip recently.  Put this in your 
>.emacs file:

>	(global-unset-key "\C-h")
>	(global-set-key "\C-h" 'delete-backward-char)
>	(global-unset-key "\M-/");
>	(global-set-key "\M-/" 'help-for-help)

>It maked the backspace work like a backspace key should work, rather than
>calling up the help menu.  To bring up help, press M-/ (a.k.a. Alt-?).  The
>DEL key is unchanged-- I never did figure out how to make it behave like a
>DEL key...

This is not the best way to swap the keys because they will not be swapped
in all cases.  Emacs uses different keymaps for certain modes and buffers.
For the delete and backspace keys to ALWAYS be swapped, use the following:

(let ((the-table (make-string 128 0)))
  (let ((i 0))
    (while (< i 128)
      (aset the-table i i)
      (setq i (1+ i))))
  ;; Swap ^H and DEL
  (aset the-table ?\177 ?\^h)
  (aset the-table ?\^h ?\177)
  (setq keyboard-translate-table the-table))

If you like, you can also swap the escape and backtick key if the escape
isn't next to the '1' key where GOD intended it to be, by adding:

    (aset the-table ?\e ?`)
    (aset the-table ?` ?\e)

just above the
  (setq keyboard-translate-table the-table))
above.

You can add this function to your .emacs file.
-- 
Leo	leo@aai.com   leo%aai@uunet.uu.net   ...uunet!aai!leo