From:	CRDGW2::CRDGW2::MRGATE::"SMTP::PREP.AI.MIT.EDU::HELP-GNU-EMACS-REQUEST"  2-MAR-1992 14:36:27.85
To:	ARISIA::EVERHART
CC:	
Subj:	Emacs 18.58 enhancement: X key rebinding

From:	help-gnu-emacs-request@prep.ai.mit.edu@SMTP@CRDGW2
To:	Everhart@Arisia@MRGATE

Received:  by crdgw1.ge.com (5.57/GE 1.123)
	 id AA29675; Mon, 2 Mar 92 14:07:35 EST
Received: by life.ai.mit.edu (4.1/AI-4.10) id AA10619; Mon, 2 Mar 92 09:31:34 EST
Return-Path: <help-gnu-emacs-request@prep.ai.mit.edu>
Received: from news.cis.ohio-state.edu by life.ai.mit.edu (4.1/AI-4.10) id AA10604; Mon, 2 Mar 92 09:30:55 EST
Received: by news.cis.ohio-state.edu (5.61-kk/5.911008)
	id AA10160; Mon, 2 Mar 92 09:01:27 -0500
Received: from USENET by news.cis.ohio-state.edu with netnews
	for help-gnu-emacs@prep.ai.mit.edu (help-gnu-emacs@prep.ai.mit.edu);
	contact usenet@news.cis.ohio-state.edu if you have questions.
To: help-gnu-emacs@prep.ai.mit.edu
Date: 2 Mar 92 12:35:06 GMT
Message-Id: <1992Mar2.123506.12942@pronto.mh.nl>
Organization: Multihouse Automation, the Netherlands
From: jv@mh.nl (Johan Vromans)
Sender: help-gnu-emacs-request@prep.ai.mit.edu
Subject: Emacs 18.58 enhancement: X key rebinding


# FP-Xfun -- Add some more X fun to GNU Emacs 18.58
# Author          : Johan Vromans
# Created On      : ***
# Last Modified By: Johan Vromans
# Last Modified On: Mon Mar  2 10:39:57 1992
# Update Count    : 2
# Status          : Use at your own risk.
# Patch Version   : 18.58.1

===== These are local mods to GNU Emacs 18.58 =====

  1. Additional x-funcs (x-lower-window, x-raise-window,
     x-iconify-window)
     [x11fns.c]

  2. Rebinding keys (copied from epoch: x-rebind-key)
     [x11fns.c x11term.c]

  3. With this patch the following files are added:

     - vt320rbind.el: rebind keyboard keys to send true DEC VT320
       sequences.

     - vt200kp.el: sample keys bindings for DEC VT200/VT300.

     Usage (in your .emacs):

       (if string= window-system "x")
          (load "vt320rbind"))
       ; Now X-display and VT320 behave (almost) identical.
       (load "vt200kp")

*** x11fns.c.orig	Sat Oct  5 19:01:14 1991
--- x11fns.c	Mon Feb 24 19:56:15 1992
***************
*** 866,871 ****
--- 866,926 ----
  
  #endif foobar
  
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+ /* Re-written version of x-rebind-key [AMC] Copied from Epoch. */
+ static KeySym modtable[] =
+     { XK_Shift_Lock, XK_Shift_L, XK_Shift_R, XK_Meta_L, XK_Meta_R,
+       XK_Control_L, XK_Control_R, XK_Alt_L, XK_Alt_R, XK_Caps_Lock,
+       XK_Super_L, XK_Super_R, XK_Hyper_L, XK_Hyper_R };
+ #define MODTABLESIZE (sizeof(modtable)/sizeof(KeySym))
+ 
+ DEFUN ("x-rebind-key", Fx_rebind_key, Sx_rebind_key, 3, 3, 0,
+   "Rebind KEYCODE, with modifier bits MOD-MASK, to new string NEWSTRING.\n\
+ KEYCODE should be the string name of an X KeySym\n\
+ MOD-MASK should be a number representing the mod mask.\n\
+ NEWSTRING is an arbitrary string of keystrokes.\n\
+ \n\
+ Values for the modifier mask (add to combine):
+     Shift Lock      1                   Caps Lock   512\n\
+     Shift   Left    2, Right    4       Meta  Left    8, Right   16
+     Control Left   32, Right   64       Alt   Left  128, Right  256
+     Super   Left 1024, Right 2048       Hyper Left 4096, Right 8192
+ ")
+ 
+ 	(keycode, shift_mask, newstring)
+ 	register Lisp_Object keycode;
+ 	register Lisp_Object shift_mask;
+ 	register Lisp_Object newstring;
+     {
+     KeySym xkey,modlist[15];
+     int imod = 0;
+     int modrequest;
+     int i,mask;
+ 
+     /* check arguments */
+     CHECK_STRING(keycode,0);
+     CHECK_NUMBER(shift_mask,1);
+     CHECK_STRING(newstring,2);
+ 
+     xkey = XStringToKeysym(XSTRING(keycode)->data);
+     if (xkey == NoSymbol) error("Invalid X-key name");
+ 
+     modrequest = XFASTINT(shift_mask);
+ 
+     /* build the mod list */
+     for ( i=0 , mask=1 ; i < MODTABLESIZE ; ++i, mask <<= 1 )
+ 	{
+ 	if (modrequest & mask)
+ 	    modlist[imod++] = modtable[i];
+ 	}
+ 
+     XRebindKeysym(XXdisplay,xkey,modlist,imod,
+ 		  XSTRING(newstring)->data,
+ 		  strlen(XSTRING(newstring)->data));
+     return Qt;
+     }
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+ 
  XExitWithCoreDump ()
  {
  	XCleanUp ();
***************
*** 906,911 ****
--- 961,1025 ----
  #endif				/* subprocesses */
  }
  
+ DEFUN ("x-remap-window", Fx_remap_window, Sx_remap_window,
+   0, 0, 0,
+   "Maps / raises the X window such that is now visible.")
+   ()
+ {
+ 
+   if (WindowMapped)
+     XRaiseWindow(XXdisplay,XXwindow);
+   else
+     XMapRaised(XXdisplay,XXwindow);
+ 
+   XFlush(XXdisplay);
+   return Qnil;
+ }
+ 
+ DEFUN ("x-lower-window", Fx_lower_window, Sx_lower_window,
+   0, 0, 0,
+   "Lowers the X window such that is now in the back.")
+   ()
+ {
+ 
+   if (WindowMapped) {
+     XLowerWindow(XXdisplay,XXwindow);
+     XFlush(XXdisplay);
+   }
+   return Qnil;
+ }
+ 
+ DEFUN ("x-iconify-window", Fx_iconify_window, Sx_iconify_window,
+   0, 0, 0,
+   "Iconifies the X window.")
+   ()
+ {
+   if (WindowMapped) {
+     /* this is from thoth@shark.cis.ufl.edu (Robert Forsman) */
+     XClientMessageEvent     xev;
+ 
+     BLOCK_INPUT_DECLARE ();
+     check_xterm();
+ 
+     xev.type = ClientMessage;
+     xev.send_event = True;
+     xev.window = XXwindow;
+     xev.format = 32;
+     xev.data.l[0] = IconicState;
+ 
+     BLOCK_INPUT ();
+ 
+     xev.message_type = XInternAtom(XXdisplay,"WM_CHANGE_STATE",False);
+     XSendEvent(XXdisplay, DefaultRootWindow(XXdisplay), False,
+ 	       SubstructureRedirectMask|SubstructureNotifyMask, &xev);
+ 
+     UNBLOCK_INPUT ();
+     
+     XFlush(XXdisplay);
+   }
+   return Qnil;
+ }
+ 
  syms_of_xfns ()
  {
    /* If not dumping, init_display ran before us, so don't override it.  */
***************
*** 955,961 ****
--- 1069,1079 ----
    defsubr (&Sx_rebind_key);
    defsubr (&Sx_rebind_keys);
  #endif notdef
+   defsubr (&Sx_rebind_key);
    defsubr (&Sx_debug);
+   defsubr (&Sx_remap_window);
+   defsubr (&Sx_lower_window);
+   defsubr (&Sx_iconify_window);
  }
  
  #endif /* HAVE_X_WINDOWS */
*** x11term.c.orig	Sun Feb 16 06:40:44 1992
--- x11term.c	Sun Feb 23 22:17:20 1992
***************
*** 1446,1451 ****
--- 1446,1452 ----
        /* Someday this will be unnecessary as we will
  	 be able to use XRebindKeysym so XLookupString
  	 will have already given us the string we want. */
+       if (nbytes == 0) {
        if (IsFunctionKey(keysym)
  	  || IsMiscFunctionKey(keysym)
  	  || keysym == XK_Prior
***************
*** 1481,1491 ****
  	}
  #ifndef AIX
        }
  #endif  /* not AIX */
        if (nbytes) {
! 	if ((nbytes == 1) && (event.xkey.state & Mod1Mask))
  	  *mapping_buf |= METABIT;
! 	if ((nbytes == 1) && (event.xkey.state & ControlMask))
  	  *mapping_buf &= 0x9F;		/* mask off bits 1 and 2 */
  	if (numchars-nbytes > 0) {
  	  bcopy (mapping_buf, bufp, nbytes);
--- 1482,1493 ----
  	}
  #ifndef AIX
        }
+       }
  #endif  /* not AIX */
        if (nbytes) {
! 	if ((event.xkey.state & Mod1Mask))
  	  *mapping_buf |= METABIT;
! 	if ((event.xkey.state & ControlMask))
  	  *mapping_buf &= 0x9F;		/* mask off bits 1 and 2 */
  	if (numchars-nbytes > 0) {
  	  bcopy (mapping_buf, bufp, nbytes);
*** /dev/null	Mon Mar  2 08:38:04 1992
--- vt320rbind.el	Mon Mar  2 09:17:11 1992
***************
*** 0 ****
--- 1,109 ----
+ ;; vt320rbind.el -- Binding LK201 keys for vt320 emulation
+ ;; SCCS Status     : @(#)@ vt320rbind.el	1.3
+ ;; Author          : Johan Vromans
+ ;; Created On      : Thu Mar 21 11:10:00 1991 (import)
+ ;; Last Modified By: Johan Vromans
+ ;; Last Modified On: Tue Feb 25 11:42:57 1992
+ ;; Update Count    : 2
+ ;; Status          : OK
+ ;;
+ ;; This file can be loaded in non-X and non-Epoch versions as well
+ ;;
+ (if (string= window-system "x")
+     (progn
+ 
+       ;; Yes, we can handle ISO characters
+       (setq ISO-capable t)
+ 
+       ;; Use epoch function if possible
+       (if (boundp 'epoch::version)
+ 	  (fset 'x-rebind-key 'epoch::rebind-key))
+ 
+       ;; Keypad keys
+       (x-rebind-key "KP_F1"        0 "\033OP")
+       (x-rebind-key "KP_F2"        0 "\033OQ")
+       (x-rebind-key "KP_F3"        0 "\033OR")
+       (x-rebind-key "KP_F4"        0 "\033OS")
+       (x-rebind-key "KP_Enter"     0 "\033OM")
+       (x-rebind-key "KP_Separator" 0 "\033Ol")
+       (x-rebind-key "KP_Subtract"  0 "\033Om")
+       (x-rebind-key "KP_Decimal"   0 "\033On")
+       (x-rebind-key "KP_0"         0 "\033Op")
+       (x-rebind-key "KP_1"         0 "\033Oq")
+       (x-rebind-key "KP_2"         0 "\033Or")
+       (x-rebind-key "KP_3"         0 "\033Os")
+       (x-rebind-key "KP_4"         0 "\033Ot")
+       (x-rebind-key "KP_5"         0 "\033Ou")
+       (x-rebind-key "KP_6"         0 "\033Ov")
+       (x-rebind-key "KP_7"         0 "\033Ow")
+       (x-rebind-key "KP_8"         0 "\033Ox")
+       (x-rebind-key "KP_9"         0 "\033Oy")
+ 
+       ;; Arrow keys
+       (x-rebind-key "Up"           0 "\033OA")
+       (x-rebind-key "Down"         0 "\033OB")
+       (x-rebind-key "Right"        0 "\033OC")
+       (x-rebind-key "Left"         0 "\033OD")
+ 
+       ;; Arrow keys - more primitive
+       (x-rebind-key "Up"           0 "\020")
+       (x-rebind-key "Down"         0 "\016")
+       (x-rebind-key "Right"        0 "\006")
+       (x-rebind-key "Left"         0 "\002")
+ 
+       ;; Edit keys
+       (x-rebind-key "Find"         0 "\033[1~")
+       (x-rebind-key "Insert"       0 "\033[2~")
+       (x-rebind-key "_Remove"      0 "\033[3~")	; DEC special Remove
+       (x-rebind-key "Select"       0 "\033[4~")
+       (x-rebind-key "Prior"        0 "\033[5~")
+       (x-rebind-key "Next"         0 "\033[6~")
+ 
+       ;; Function keys
+       (x-rebind-key "F1"           0 "\033[11~")
+       (x-rebind-key "F2"           0 "\033[12~")
+       (x-rebind-key "F3"           0 "\033[13~")
+       (x-rebind-key "F4"           0 "\033[14~")
+       (x-rebind-key "F5"           0 "\033[15~")
+       (x-rebind-key "F6"           0 "\033[17~")
+       (x-rebind-key "F7"           0 "\033[18~")
+       (x-rebind-key "F8"           0 "\033[19~")
+       (x-rebind-key "F9"           0 "\033[20~")
+       (x-rebind-key "F10"          0 "\033[21~")
+       (x-rebind-key "F11"          0 "\033[23~")
+       (x-rebind-key "F12"          0 "\033[24~")
+       (x-rebind-key "F13"          0 "\033[25~")
+       (x-rebind-key "F14"          0 "\033[26~")
+       (x-rebind-key "F15"          0 "\033[28~")
+       (x-rebind-key "Help"         0 "\033[28~")
+       (x-rebind-key "F16"          0 "\033[29~")
+       (x-rebind-key "Menu"         0 "\033[29~")
+       (x-rebind-key "F17"          0 "\033[31~")
+       (x-rebind-key "F18"          0 "\033[32~")
+       (x-rebind-key "F19"          0 "\033[33~")
+       (x-rebind-key "F20"          0 "\033[34~")
+ 
+       ;; Shifted function keys. Modifier '2' is left shift.
+       (x-rebind-key "F1"           2 "\033[41~")
+       (x-rebind-key "F2"           2 "\033[42~")
+       (x-rebind-key "F3"           2 "\033[43~")
+       (x-rebind-key "F4"           2 "\033[44~")
+       (x-rebind-key "F5"           2 "\033[45~")
+       (x-rebind-key "F6"           2 "\033[47~")
+       (x-rebind-key "F7"           2 "\033[48~")
+       (x-rebind-key "F8"           2 "\033[49~")
+       (x-rebind-key "F9"           2 "\033[50~")
+       (x-rebind-key "F10"          2 "\033[51~")
+       (x-rebind-key "F11"          2 "\033[53~")
+       (x-rebind-key "F12"          2 "\033[54~")
+       (x-rebind-key "F13"          2 "\033[55~")
+       (x-rebind-key "F14"          2 "\033[56~")
+       (x-rebind-key "F15"          2 "\033[58~")
+       (x-rebind-key "Help"         2 "\033[58~")
+       (x-rebind-key "F16"          2 "\033[59~")
+       (x-rebind-key "Menu"         2 "\033[59~")
+       (x-rebind-key "F17"          2 "\033[61~")
+       (x-rebind-key "F18"          2 "\033[62~")
+       (x-rebind-key "F19"          2 "\033[63~")
+       (x-rebind-key "F20"          2 "\033[64~")
+       ))
*** /dev/null	Mon Mar  2 08:38:04 1992
--- vt200kp.el	Mon Mar  2 09:17:20 1992
***************
*** 0 ****
--- 1,245 ----
+ ;; vt200kp.el -- VT200/vt300 keys for Scame
+ ;; SCCS Status     : @(#)@ vt200kp.el	1.9
+ ;; Author          : Johan Vromans
+ ;; Created On      : Wed Mar 20 12:27:51 1991 (import)
+ ;; Last Modified By: Johan Vromans
+ ;; Last Modified On: Tue Feb 25 14:33:11 1992
+ ;; Update Count    : 7
+ ;; Status          : OK
+ ;;
+ (defconst scame-keys-version "V4.1.9" "Version of Scame keypad defs")
+ ;;
+ (defun scame-vt200-init ()
+   (interactive)
+   (scame-vt200-application-keypad)
+   (if (string-match "^vt[2345]" emacs-term)
+       (progn
+ 	(setq ISO-capable t)		; used by iso.el
+ 	;; Loading the UDK sometimes hangs some terminals. Don't.
+ 	(or (string-match "^vt2" emacs-term)
+ 	    (scame-vt200-load-F-keys))
+ 	))
+   (scame-vt200-bind-F-keys)
+   (scame-vt200-define-key scame-vt200-key-defs)
+   ;; why does this make the keys so slow??? 
+   ;;(scame-vt200-hack-some-keys)
+   (if (boundp 'scame-vt200-local-mods)
+     (scame-vt200-local-mods))
+ )
+ 
+ ;; Function key definitions for VT220 function keys.
+ ;; A key label like "S4" means "Shift F4"
+ 
+ (defconst scame-vt200-key-defs '(
+   ("[1~"    Find            isearch-forward)
+   ("\e[1~"  M-Find          re-search-forward)
+   ("[2~"    Insert          yank)
+   ("\e[2~"  M-Insert        insert-buffer)
+   ("[3~"    Remove          kill-region)
+   ("\e[3~"  M-Remove        delete-window)
+   ("[4~"    Select          set-mark-command)
+   ("\e[4~"  M-Select        buffer-menu)
+   ("[5~"    Prev            scroll-down)
+   ("\e[5~"  M-Prev          beginning-of-buffer)
+   ("[6~"    Next            scroll-up)
+   ("\e[6~"  M-Next          end-of-buffer)
+ 
+   ("OA"     Up              previous-line)
+   ("\eOA"   M-Up            top-of-screen)
+   ("OB"     Down            next-line)
+   ("\eOB"   M-Down          bot-of-screen)
+   ("OC"     Right           forward-char)
+   ("\eOC"   M-Right         end-of-line)
+   ("OD"     Left            backward-char)
+   ("\eOD"   M-Left          beginning-of-line)
+ 
+ ; ("OP"     PF1             ESC-prefix)
+ ; ("\eOP"   M-PF1           none)
+ ; ("OQ"     PF2             none)
+ ; ("\eOQ"   M-PF2           none)
+   ("OR"     PF3             re-search-forward)
+ ; ("\eOR"   M-PF3           none)
+   ("OS"     PF4             delete-line)
+   ("\eOS"   M-PF4           yank)
+ 
+   ("Om"     Minus           kill-word)
+   ("\eOm"   M-Minus         yank)
+   ("Ol"     Comma           delete-char)
+ ; ("\eOl"   M-Comma         undo)
+   ("OM"     Enter           compile)
+ ; ("\eOM"   M-Enter         none)
+ 
+   ("Ow"     7               scroll-down)
+   ("Ox"     8               scroll-up)
+   ("Oy"     9               copy-region-as-kill)
+   ("Ot"     4               beginning-of-buffer)
+ ; ("\eOt"   M-4             none)
+   ("Ou"     5               end-of-buffer)
+ ; ("\eOu"   M-5             none)
+   ("Ov"     6               yank)
+   ("Oq"     1               beginning-of-line)
+ ; ("\eOq"   M-1             none)
+   ("Or"     2               end-of-line)
+ ; ("\eOr"   M-2             none)
+   ("Os"     3               kill-region)
+   ("Op"     0               forward-line)
+ ; ("\eOp"   M-0             none)
+   ("On"     Dot             set-mark-command)
+ ; ("\eOn"   M-Dot           none)
+ 
+ ; ("[17~"   F6              none)
+ ; ("[47~"   S6              none)
+ ; ("[18~"   F7              none)
+ ; ("[48~"   S7              none)
+ ; ("[19~"   F8              none)
+ ; ("[49~"   S8              none)
+ ; ("[20~"   F9              none)
+ ; ("[50~"   S9              none)
+ ; ("[21~"   F10             none)
+ ; ("[51~"   S10             none)
+ 
+   ("[23~"   F11             other-or-make-window)
+   ("[53~"   S11             delete-other-windows)
+   ("[24~"   F12             scroll-other-window)
+   ("[54~"   S12             scroll-other-window-back)
+   ("[25~"   F13             enlarge-window)
+   ("[55~"   S13             enlarge-other-window)
+   ("[26~"   F14             find-file-other-window)
+   ("\e[26~" M-S14           toggle-read-only)
+   ("[56~"   S14             switch-to-buffer-other-window)
+ 
+ 
+   ("[28~"   F15             help-for-help)
+   ("[58~"   S15             help-key-help)
+   ("[29~"   F16             execute-extended-command)
+   ("[59~"   S16             undo)
+   ("\e[29~" M-F16           repeat-complex-command)
+   ("\e[59~" M-S16           eval-expression)
+ 
+   ("[31~"   F17             find-file)
+   ("[61~"   S17             find-alternate-file)
+   ("[32~"   F18             save-buffer)
+   ("[62~"   S18             save-buffers-kill-emacs)
+   ("[33~"   F19             resume-from-server)
+   ("[34~"   F20             insert-file)
+   ("[64~"   S20             write-region)
+ ) "Scame VT220 special keys and bindings")
+ 
+ (defun scame-vt200-application-keypad ()
+   (or (string= window-system "x")
+       (send-string-to-terminal "\033[?1h\033=")))  ; Force App cursor and keypad
+ 
+ (defun scame-vt200-redefine-function-key (pair) 
+   ; Make F-keys generate consistent escape sequences (NOT command names)
+   ; See terminal reference manual under DECUDK
+   (or (string= window-system "x")
+       (send-string-to-terminal
+        (format "\033P1;1|%s/1B5B%x%x7E\033\\"
+ 	       (car pair) (elt (cdr pair) 0) (elt (cdr pair) 1)))))
+ 
+   ;; note that the first number in each of these pairs is the value
+   ;; used to identify a particular function key to be programmed
+   ;; (17 refers to shifted function key 6 which we call S6) and the
+   ;; second number in the pair is the variable part of what we want
+   ;; the function key to send (S6 will send \e[47~).  this procedure
+   ;; of actually programming what you want the function keys to send
+   ;; may be particular to our esprit terminals and not generic to
+   ;; VT220's.  i'm not sure.
+ 
+ (defun scame-vt200-load-F-keys ()
+   (mapcar 'scame-vt200-redefine-function-key
+     '( ("12" . "42")  ("13" . "43") ("14" . "44")  ("15" . "45")  ; S1-S4
+        ("16" . "46")  ("17" . "47")                               ; S5-S6
+        ("18" . "48")  ("19" . "49") ("20" . "50")  ("21" . "51")  ; S7-S10
+        ("23" . "53")  ("24" . "54") ("25" . "55")  ("26" . "56")  ; S11-S14
+        ("28" . "58")  ("29" . "59") ("31" . "61")  ("32" . "62")  ; S15-S18
+        ("33" . "63")  ("34" . "64")                               ; S19-S20
+      )))
+ 
+ (defun scame-vt200-bind-F-keys ()
+   ;; Bind all Function Keys to default function none().
+   (global-unset-key "\e\e")		;allow using this as a prefix!
+   (global-unset-key "\e[")		;ditto!
+   (global-set-key "\e\e\e" 'dabbrev-expand)
+ 
+   ;; this use of mapcar is calling global-set-key for the function key
+   ;; and the function key preceeded with ESC (to make meta function key).
+   ;; note that a function name is not used as the first parameter to mapcar;
+   ;; lambda is used to "define a function on the fly".  it creates a function
+   ;; which takes one parameter, but the function has no name and can not be
+   ;; referenced from elsewhere.
+   (mapcar
+     '(lambda (x)
+        (global-set-key (concat "\e["   x "~") 'none)
+        (global-set-key (concat "\e\e[" x "~") 'none))
+     '( "1"  "2"  "3"  "4"  "5"  "6"
+        "12" "42" "13" "43" "14" "44" "15" "45" "16" "46"
+        "17" "47" "18" "48" "19" "49" "20" "50" "21" "51"
+        "23" "53" "24" "54" "25" "55" "26" "56"
+        "28" "58" "29" "59"
+        "31" "61" "32" "62" "33" "63" "34" "64")))
+ 
+ (defun scame-vt200-define-key (arg-defs)
+    ;; Set global bindings for Function Keys.
+    (mapcar
+      '(lambda (x)
+         (global-set-key (concat "\e" (elt x 0)) (elt x 2)))
+      arg-defs))
+ 
+ ;; Dummies for keyboard macro binding
+ (mapcar '(lambda (x) (fset x "\007")) '(F7 S7 F8 S8 F9 S9 F10 S10))
+ 
+ (defun scame-vt200-hack-some-keys ()
+   "Hack some vt200 keys to be identical to their control keys couterpart."
+   (global-set-key "\M-OA" "\C-p")
+   (global-set-key "\M-OB" "\C-n")
+   (global-set-key "\M-OC" "\C-f")
+   (global-set-key "\M-OD" "\C-b")
+   (global-set-key "\M-[6~" "\C-v")
+   (global-set-key "\M-[5~" "\M-v")
+   )
+ 
+ ;;; keybind hooks
+ 
+ (defun scame-vt200-edit-picture-hooker ()
+   (mapcar '(lambda (x) (define-key picture-mode-map (car x) (cdr x)))
+                   ; In picture-mode            ; Normally
+     '(("\eOA"     . picture-move-up)           ; previous-line
+       ("\eOB"     . picture-move-down)         ; next-line
+       ("\eOC"     . picture-forward-column)    ; forward-char
+       ("\eOD"     . picture-backward-column)   ; backward-char
+       ("\eOm"     . picture-clear-line)        ; kill-line
+       ("\eOn"     . picture-clear-column)      ; delete-char
+       ("\e\eOC"   . picture-end-of-line)       ; end-of-line
+       ("\e\eOA"   . picture-motion-reverse)    ; top-of-screen
+       ("\e\eOB"   . picture-motion)            ; bot-of-screen
+       )))
+ 
+ (defun scroll-other-window-back ()
+   "Scroll other window backwards."
+   (interactive)
+   (if (one-window-p)
+       (beep)
+     (scroll-other-window 
+      (- 3
+ 	(save-window-excursion
+ 	  (window-height (other-window 1)))))))
+ 
+ (defun other-or-make-window ()
+   "Switch to other window, creating one if needed."
+   (interactive)
+   (if (one-window-p)
+       (split-window-vertically))
+   (other-window 1))
+ 
+ (defun enlarge-other-window ()
+   "Grow other window by one line."
+   (interactive)
+   (enlarge-window -1))
+ 
+ (scame-vt200-init)
+ ;;
+ ;; prevent override by possible ../lisp/term/vt...el
+ ;;
+ (setq term-file-prefix nil)
+ ;;

-- 
Johan Vromans				       jv@mh.nl via internet backbones
Multihouse Automatisering bv		       uucp:..!{uunet,sun4nl}!mh.nl!jv
Doesburgweg 7, 2803 PL Gouda, The Netherlands  phone/fax: +31 1820 62911/62500
------------------------ "Arms are made for hugging" -------------------------
