Trailing-Edge - PDP-10 Archives - mit_emacs_170_teco_1220 - info/ambassador.doc
There are no other files named ambassador.doc in the archive.
AMBASSADOR keypad library
David Purves, 4-21-84    ; added the shiftable red keys on 5-6-84

The Ambassador library assigns EMACS ^R functions to the function keys
in both the keypad and at the top of the keyboard.  In addition, the
library makes the 'PAUSE' key a real meta- key.  Loading the library
puts the keypad in shifted mode, so that escape sequences are sent
unless the shift key is held down.  The library also assigns some keys
escape sequences which in the form <esc> [ <letter>, so that they can
be used.  (Their default settings are not useful, the new escape
sequences can be used.)  See the source code for exact details, but
the keys that are reloaded with new sequences are as follows:

SEND (in simultaneous mode only, see the manual...)
shift-MOVE UP
PERIOD (on the keypad)
0 (on the keypad)
ENTER (on the keypad)

Note that this means that the scrolling is effectively disabled
(unless you want to send the sequences yourself).  However, the
'zooming' feature (control-MOVE UP and DOWN) remain, so there 
is little need for the reverse-scrolling.  

Also note that the ESC key is no longer assigned the function ^R
Prefix Meta (this means that ESC no longer equals meta).  Instead, you
have a 'real,' bit-shift meta key.  It is no  longer a prefix
character, but, like the control and shift keys, must be held down
while the key is typed.  This means that you can repeat meta
commands, unlike before.  However, note that anywhere EXCEPT as a
command, you still want to use ordinary Escape; e.g. to terminate an
Isearch, or to execute minibuffers (remember:  to start a minibuffer,
you use meta-Altmode; to execute it, you use Altmode Altmode).  So
anywhere that you want to type Altmode (which is the same as Escape
[well, almost]) you still use Escape.  Anywhere you want a meta, use
the PAUSE key.  It is located right below the CTRL key, right where
you want it.  

The default assignments are made as follows (see below, on how to
change them):


|T-CLR	      |^	    |T-SET	  |
| Begin Line  |   Up Line   | End of Line |
|7	      |8	    |9		  |
|<-	      |HOME	    |->		  |
| Back Char   | Fwrd Window |  Fwrd Char  |
|4	      |5	    |6		  |
|SSA	      |V	    |ESA	  |
| Top Screen  |  Down Line  | Bottom Scr  |
|1	      |2	    |3		  |
|    Goto     |	   Back	    |	 Goto	  |
|  Beginning  |   Window    |    End      |
|.	      |0	    |Enter	  |

Keys along Top:

  RESET   SETUP    PF1     PF2     PF3
|       |       |       |       |       |
| (NOT  | (NOT  |       |       |       |    PF3 through PF9 all have no
|       |       |       |       |       |    default.  Mode dependant functions
| AVAIL)| AVAIL)|       |  no   |       |    are nice to put here.  For
|       |       | Info  |default| Push  |    example, see Info, Emacs, Pascal,
|       |       |       |       |       |    Statements for details on some...

[RESET and SETUP are not available to put functions on.  PF2 is
 available, it simply has no default assignment. ] 

| Back  |       | Zap to|  no   |       |  no   |  no   |       |       |
| Zap   |       | Char  |  def  |       |  def  |  def  |       |       |
| ----  |       | ----  | ----  |       | ----  | ----  |       |       |
|       | Repeat| Skip  | Kill  | Other | Auto  | Ovwrt |  no   |  no   |
| Back  | Skip/ | to    | Region| Window| Fill  | Mode  |default|default|
| Skip  |  Zap  | Char  |       |       | Mode  |       |       |       |

On the Keyboard:

+-------+       +-------+-------+
|       |       | Kill  | Kill  |
|       |       | Back  | Fwrd  |
|       |       | Word  | Word  |
|       |       | ----  | ----  |
| Meta  |       | Back  | Fwrd  |
|       |       | Word  | Word  |
+-------+       +-------+-------+

The key assignments were arbitrary, except for the arrow keys, which
were obvious.  Keypad 5 seemed like a good place for Forward Screen,
and it is compatible with Heath.  Insert seemed to be the natural
place for Overwrite Mode (which toggles for greater convenience).
Erase had a similar reason.  Edit seemed the best place for Other
Window, which gets used a lot, since you have up to 60 lines to play
with.  The Skip/Zap functions are defined in the library, and are
stolen from Heath.  They are placed in similar places here, for
compatibility.  ^R Info and Push were placed on PF1 and PF3 for
compatibility with XEDIT, if anybody cares.  Note that all the keys
labeled PFn are shiftable, though I only load two of them.  The other
keys, generally are not shiftable (most notably the keypad).  However,
the MOVE UP and MOVE DOWN keys *are* shiftable, and the default
functions come in very handy thanks to the location of the MOVE keys.


Set Ambassador Key

This function assigns a function to an Ambassador special key.

You can invoke this interactively by using ^R Instant Extended Command
(C-M-X) to run it.  It takes a String Argument which is the name of
the function, and will prompt you to hit the key on which you want to
place the function.  Alternatively, you can pass the function
definition in as a pre-comma arg.  For example, to put Global
Pascal Comment on PF2, enter C-M-X Set Ambassador Key$<cr>.
It will prompt you with 'Function:', then type in Global Pascal
comment, and hit <cr>.  It will ask you for the key.  Just hit PF2.
(Note that this particular function is only defined in Pascal Mode.)

You can also run this in an init file, by passing the key as a numeric
arg.  There is a psuedo-random mapping of numbers to keys which is
listed below:

1-12   ==> PF1 thru PF12
13-24  ==> shift-PF1 thru shift-PF12
25-30  ==> ERASE thru SEND (along top row)
31-39  ==> keypad 1 thru keypad 9
40-42  ==> keypad . thru keypad ENTER (bottom row of keypad)
43     ==> MOVE UP
44     ==> MOVE DOWN
45     ==> shift MOVE UP
46     ==> shift MOVE DOWN
47-49  ==> shift ERASE, shift DELETE (red), shift INSERT respectively

Then pass the function name as the argument.  If you have defined the
variable $AMBASSADOR Setup Hook$, it will be run when the Ambassador
library is loaded, but after the default definitions have been made,
so that you can adjust the assignments to suit your own taste.  The
function Set Ambassador Key will (probably) be in qreg S, so you can
access it via MS.  It is probably better to reload qreg S each time,
for extra caution.  Hence, to redefine keys in an Ambassador Mode
Hook, use something like this in your init file:

@:i*| m.mSet Ambassador Key$[S        ! reload qreg S with the definition !
        2MS^R Transpose Characters$   ! stick that functin on PF2 !
       32MS^R bottom of Screen$       ! if you want that on keypad 2 !
    |m.v Ambassador Mode Hook$        ! define the hook, give it this value !