1File:  edt-user.doc  ---  EDT Emulation User Instructions
2
3                                For GNU Emacs 19
4
5Copyright (C) 1986, 1992, 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004,
6   2005, 2006, 2007  Free Software Foundation, Inc.
7
8Author: Kevin Gallagher <Kevin.Gallagher@boeing.com>
9Maintainer: Kevin Gallagher <Kevin.Gallagher@boeing.com>
10Keywords: emulations
11
12This file is part of GNU Emacs.
13
14GNU Emacs is free software; you can redistribute it and/or modify it under the
15terms of the GNU General Public License as published by the Free Software
16Foundation; either version 2, or (at your option) any later version.
17
18GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY
19WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
20PARTICULAR PURPOSE.  See the GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License along with
23GNU Emacs; see the file COPYING.  If not, write to the Free Software
24Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
26============================================================================
27
28I.    OVERVIEW:
29
30This is Version 4.0 of the EDT Emulation for Emacs 19 and above.
31It comes with special functions which replicate nearly all of EDT's
32keypad mode behavior.  It sets up default keypad and function key
33bindings which closely match those found in EDT.  Support is
34provided so that users may reconfigure most keypad and function key
35bindings to their own liking.
36
37NOTE: Version 4.0 contains several enhancements.  See the
38Enhancements section below for the details.
39
40
41Quick Start:
42
43To start the EDT Emulation, first start Emacs and then enter
44
45   M-x edt-emulation-on
46
47to begin the emulation.  After initialization is complete, the
48following message will appear below the status line informing you
49that the emulation has been enabled: "Default EDT keymap active".
50
51   You can have the EDT Emulation start up automatically, each time
52you initiate a GNU Emacs session, by adding the following line to
53your .emacs file:
54
55   (add-hook term-setup-hook 'edt-emulation-on)
56
57IMPORTANT: Be sure to read the rest of this file.  It contains very
58           useful information on how the EDT Emulation behaves and how
59           to customize it to your liking.
60
61The EDT emulation consists of the following files:
62
63edt-user.doc     - User Instructions and Sample Customization File
64edt.el           - EDT Emulation Functions and Default Configuration
65edt-lk201.el     - Built-in support for DEC LK-201 Keyboards
66edt-vt100.el     - Built-in support for DEC VT-100 (and above) terminals
67edt-pc.el        - Built-in support for PC 101 Keyboards under MS-DOS
68edt-mapper.el    - Create an EDT LK-201 Map File for Keyboards Without
69                     Built-in Support
70
71Enhancements:
72
73Version 4.0 contains the following enhancements:
74
75 1.  Scroll margins at the top and bottom of the window are now
76     supported.  (The design was copied from tpu-extras.el.)  By
77     default, this feature is enabled with the top margin set to
78     10% of the window and the bottom margin set to 15% of the
79     window.  To change these settings, you can invoke the function
80     edt-set-scroll-margins in your .emacs file.  For example, the
81     following line
82
83          (edt-set-scroll-margins "20%" "25%")
84
85     sets the top margin to 20% of the window and the bottom margin
86     to 25% of the window.  To disable this feature, set each
87     margin to 0%.  You can also invoke edt-set-scroll-margins
88     interactively while EDT Emulation is active to change the
89     settings for that session.
90
91     NOTE: Another way to set the scroll margins is to use the
92     Emacs customization feature (not available in Emacs 19) to set
93     the following two variables directly:
94
95          edt-top-scroll-margin and edt-bottom-scroll-margin
96
97     Enter the Emacs `customize' command.  First select the Editing
98     group and then select the Emulations group.  Finally, select
99     the Edt group and follow the directions.
100
101 2.  The SUBS command is now supported and bound to GOLD-Enter by
102     default.  (This design was copied from tpu-edt.el.)  Note, in
103     earlier versions of EDT Emulation, GOLD-Enter was assigned to
104     the Emacs function `query-replace'.  The binding of
105     `query-replace' has been moved to GOLD-/.  If you prefer to
106     restore `query-replace' to GOLD-Enter, then use an EDT user
107     customization file, edt-user.el, to do this.  See edt-user.doc
108     for details.
109
110 3.  EDT Emulation now also works in XEmacs, including the
111     highlighting of selected text.
112
113 4.  If you access a workstation using an X Server, observe that
114     the initialization file generated by edt-mapper.el will now
115     contain the name of the X Server vendor.  This is a
116     convenience for those who have access to their Unix account
117     from more than one type of X Server.  Since different X
118     Servers typically require different EDT emulation
119     initialization files, edt-mapper.el will now generate these
120     different initialization files and save them with different
121     names.  Then, the correct initialization file for the
122     particular X server in use is loaded correctly automatically.
123
124 5.  Also, edt-mapper.el is now capable of binding an ASCII key
125     sequence, providing the ASCII key sequence prefix is already
126     known by Emacs to be a prefix.  As a result of providing this
127     support, some terminal/keyboard/window system configurations,
128     which don't have a complete set of sensible function key
129     bindings built into Emacs in `function-key-map', can still be
130     configured for use with EDT Emulation.  (Note: In a few rare
131     circumstances this does not work properly.  In particular, it
132     does not work if a subset of the leading ASCII characters in a
133     key sequence are recognized by Emacs as having an existing
134     binding.  For example, if the keypad 7 (KP-7) key generates
135     the sequence \"<ESC>Ow\" and \"<ESC>O\" is already bound to a
136     function, pressing KP-7 when told to do so by edt-mapper.el
137     will result in edt-mapper.el incorrectly mapping \"<ESC>O\" to
138     KP-7 and \"w\" to KP-8.  If something like this happens to
139     you, it is probably a bug in the support for your keyboard
140     within Emacs OR a bug in the Unix termcap/terminfo support for
141     your terminal OR a bug in the terminal emulation software you
142     are using.)
143
144 6.  The edt-quit function (bound to GOLD-q by default) has been
145     modified to warn the user when file-related buffer
146     modifications exist.  It now cautions the user that those
147     modifications will be lost if the user quits without saving
148     those buffers.
149
150
151Goals:
152
153        1.  Emulate EDT Keypad Mode commands closely so that current EDT users
154            will find that it easy and comfortable to use GNU Emacs with a
155            small learning curve;
156
157        2.  Make it easy for a user to customize EDT emulation key bindings
158            without knowing much about Emacs Lisp;
159
160        3.  Make it easy to switch between the original EDT default bindings
161            and the user's customized EDT bindings, without having to exit
162            Emacs.
163
164        4.  Provide support for some TPU/EVE functions not supported in EDT.
165
166        5.  Provide an easy way to restore ALL original Emacs key bindings,
167            just as they existed before the EDT emulation was first invoked.
168
169        6.  Support GNU Emacs 19 and higher.  (GNU Emacs 18 and below is no
170	        longer supported.)  XEmacs 19, and above, is also supported.
171
172        7.  Supports highlighting of marked text within the EDT emulation on
173            all platforms on which Emacs supports highlighting of marked text.
174
175        8.  Handle terminal configuration interactively for most terminal
176            configurations, when the emulation is invoked for the first time.
177
178        9.  Support a PC AT keyboard under MS-DOS.
179
180
181II.   TERMINALS/KEYBOARDS SUPPORTED:
182
183Keyboards used under a Window System are supported via the edt-mapper function.
184The first time you invoke the emulation under a window system, the edt-mapper
185function is run automatically and the user is prompted to identify which keys
186the emulation is to use for the standard keypad and function keys EDT expects
187(e.g., PF1, PF2, KP0, KP1, F1, F2, etc.).  This configuration is saved to disk
188read each time the emulation is invoked.
189
190In character oriented connections not running a window manager, built-in
191support for the following terminals/keyboards is provided:
192
193  (1) DEC VT-100 series and higher.  This includes well behaved VT clones and
194      emulators.  If you are using a VT series terminal, be sure that the term
195      environment variable is set properly before invoking emacs.
196
197  (2) PC AT keyboard under MS-DOS.
198
199Be sure to read the SPECIAL NOTES FOR SOME PLATFORMS sections to see if those
200notes apply to you.
201
202
203III.  STARTING THE EDT EMULATION:
204
205Start up GNU Emacs and enter "M-x edt-emulation-on" to begin the emulation.
206After initialization is complete, the following message will appear below the
207status line informing you that the emulation has been enabled:
208
209                         Default EDT keymap active
210
211You can have the EDT Emulation start up automatically, each time you initiate
212a GNU Emacs session, by adding the following line to your .emacs file:
213
214                  (add-hook term-setup-hook 'edt-emulation-on)
215
216A reference sheet is included (later on) listing the default EDT Emulation key
217bindings.  This sheet is also accessible on line from within Emacs by pressing
218PF2, GOLD H, or HELP (when in the EDT Default Mode).
219
220It is easy to customize key bindings in the EDT Emulation.  (See CUSTOMIZING
221section, below.)  Customizations are placed in a file called edt-user.el.  (A
222sample edt-user.el file can be found in the CUSTOMIZING section.)  If
223edt-user.el is found in your GNU Emacs load path during EDT Emulation
224initialization, then the following message will appear below the status line
225indicating that the emulation has been enabled, enhanced by your own
226customizations:
227
228                       User EDT custom keymap active
229
230Once enabled, it is easy to switch back and forth between your customized EDT
231Emulation key bindings and the default EDT Emulation key bindings.  (See the
232sample edt-user.el file below.  Look at the binding to GOLD Z.)  It is also
233easy to turn off the emulation (via the command edt-emulation-off).  Doing so
234completely restores the original key bindings in effect just prior to invoking
235the emulation.
236
237Emacs binds keys to ASCII control characters and so does the real EDT.  Where
238EDT key bindings and GNU Emacs key bindings conflict, the default GNU Emacs key
239bindings are retained by the EDT emulation by default.  If you are a diehard
240EDT user you may not like this.  The CUSTOMIZING section explains how to change
241this so that the EDT bindings to ASCII control characters override the default
242Emacs bindings.
243
244
245IV.   SPECIAL NOTES FOR SOME PLATFORMS:
246
247  Sun Workstations running X:
248
249     Some earlier Sun keyboards do not have arrow keys separate from the keypad
250     keys.  It is difficult to emulate the full EDT keypad and still retain use
251     of the arrow keys on such keyboards.
252
253     The Sun Type 5 and other more recent Sun keyboards, however, do have
254     separate arrow keys.  This makes them candidates for setting up a
255     reasonable EDT keypad emulation.
256
257     Depending upon the configuration of the version of X installed on your
258     system, you may find the default X keynames for the keypad keys don't
259     permit Emacs to interpret some or all the keypad keys as something other
260     than arrow keys, numeric keys, Home, PgUP, etc.  Both Sun and HP have been
261     particularly guilty of making bizarre keysym assignments to the keypad
262     keys.
263
264     In most cases, the X Windows command, xmodmap, can be used to correct the
265     problem.  Here's a sample .xmodmaprc file which corrects this problem on
266     one Sun workstation configuration using an older SunOS release configured
267     with a Sun Type 5 keyboard:
268
269         ! File:  .xmodmaprc
270         !
271         ! Set up Sun Type 5 keypad for use with the GNU Emacs EDT Emulation
272         !
273         keycode  53 = KP_Divide
274         keycode  54 = KP_Multiply
275         keycode  57 = KP_Decimal
276         keycode  75 = KP_7
277         keycode  76 = KP_8
278         keycode  77 = KP_9
279         keycode  78 = KP_Subtract
280         keycode  97 = KP_Enter
281         keycode  98 = KP_4
282         keycode  99 = KP_5
283         keycode 100 = KP_6
284         keycode 101 = KP_0
285         keycode 105 = F24
286         keycode 119 = KP_1
287         keycode 120 = KP_2
288         keycode 121 = KP_3
289         keycode 132 = KP_Add
290
291     If edt-mapper.el does not recognize your keypad keys as unique keys, use
292     the command
293
294	 xmodmap -pke
295
296     to get a listing of the actual key codes and the keysyms mapped to them
297     and then generate you own custom .xmodmaprc similar to the one above.
298
299     Next, feed .xmodmaprc to the xmodmap command and all the Sun Type 5 keypad
300     keys will now be configurable for the emulation of an LK-201 keypad (less
301     the comma key).  In this example, the line
302
303         keycode 105 = F24
304
305     changes the X Windows name of the keypad NumLock key to be known
306     internally as the F24 key.  Doing so permits it to be configured to behave
307     as the PF1 (Gold) key.
308
309     The side effect of this change is that you will no longer have a NumLock
310     key.  If you are using other software under X which requires a NumLock
311     key, then examine your keyboard and look for one you don't use and
312     redefine it to be the NumLock key.  Basically, you need to clear the
313     NumLock key from being assigned as a modifier, assign it to the key of
314     your choice, and then add it back as a modifier.  (See the "General Notes
315     on Using NumLock for the PF1 Key on a Unix System" section below for
316     further help on how to do this.)
317
318  PC users running MS-DOS:
319
320     By default, F1 is configured to emulate the PF1 (GOLD) key.  But NumLock
321     can be used instead if you load a freeware TSR distributed with MS-Kermit,
322     call gold.com.  This was once distributed in a file called gold22.zip and
323     came with the source code as well as a loadable binary image.  (See
324     edt-pc.el in the Emacs lisp/emulation directory for more information.)
325
326  PC users running GNU/Linux:
327
328     The default X server configuration varies from distribution to
329     distribution and release to release of GNU/Linux.  If your system fails to
330     recognize the keypad keys as distinct keys, change the NumLock state,
331     turning it on or off, as the case may be, then try again.  If this doesn't
332     solve your problem, you may have to modify the X keysym mappings with
333     xmodmap.
334
335     On one distribution on an Intel PC, the following .xmodmaprc set things up
336     nicely.
337
338         ! File:  .xmodmaprc
339         !
340         ! Set up PC keypad under GNU/Linux for the GNU Emacs EDT Emulation
341         !
342	 clear  mod2
343	 keycode  77 = F12
344	 keycode  96 = Num_Lock Pointer_EnableKeys
345	 add mod2 = Num_Lock
346
347     In this example, after feeding the file to the xmodmap command, the PC
348     NumLock keypad key will be configurable for the emulation of the PF1 key.
349     The PC keypad can now emulate an LK-201 keypad (less the comma key), the
350     standard keyboard supplied with DEC terminals VT-200 and above.  This
351     .xmodmaprc file switches the role of the F12 and NumLock keys.  It has
352     been tested on RedHat GNU/Linux 5.2.  Other versions of GNU/Linux may
353     require different keycodes.  (See the "General Notes on Using NumLock for
354     the PF1 Key on a Unix System" section below for further help on how to do
355     this.)
356
357     NOTE: Remember, it may be necessary to have NumLock in one position (ON)
358     or the other (OFF) for the PC keypad to emulate the LK-201 keypad
359     properly.
360
361  General Notes on Using NumLock for the PF1 Key on a Unix System:
362
363     Making the physical NumLock key available for use in the EDT
364     Emulation requires some modification to the default X Window
365     settings.  Since the keycode assignments vary from system to
366     system, some investigation is needed to see how to do this on
367     a particular system.
368
369     You will need to look at the output generated by xmodmap invoked with the
370     "-pm" switch.  examined.  For example, on RedHat GNU/Linux 5.2 on a PC, we
371     get the following output when running xmodmap.
372
373     "xmodmap -pm"  yields:
374
375          xmodmap:  up to 2 keys per modifier, (keycodes in parentheses):
376
377          shift       Shift_L (0x32),  Shift_R (0x3e)
378          lock        Caps_Lock (0x42)
379          control     Control_L (0x25),  Control_R (0x6d)
380          mod1        Alt_L (0x40),  Alt_R (0x71)
381          mod2        Num_Lock (0x4d)
382          mod3
383          mod4
384          mod5        Scroll_Lock (0x4e)
385
386
387     Note that Num_Lock is assigned to the modifier mod2.  This is
388     what hides Num_Lock from being seen by Emacs.
389
390     Now, "xmodmap -pke" yields:
391
392             .
393             .
394             .
395          keycode  77 = Num_Lock Pointer_EnableKeys
396             .
397             .
398             .
399          keycode  96 = F12
400             .
401             .
402             .
403
404     So, in RedHat GNU/Linux 5.2 on a PC, Num_Lock generates keycode
405     77.  The following steps are taken:
406
407         1.  clear the assignment of Num_Lock to mod2;
408         2.  swap the keycodes assigned to F12 and Num_Lock;
409         3.  assign Num_Lock back to mod2.
410
411     The .xmodmaprc file looks like this:
412
413         ! File:  .xmodmaprc
414         !
415         ! Set up PC keypad under GNU/Linux for the GNU Emacs EDT Emulation
416         !
417	 clear  mod2
418	 keycode  77 = F12
419	 keycode  96 = Num_Lock Pointer_EnableKeys
420	 add mod2 = Num_Lock
421
422     So, after executing "xmodmap .xmodmaprc", a press of the physical
423     F12 key looks like a Num_Lock keypress to X.  Also, a press of the
424     physical NumLock key looks like a press of the F12 key to X.
425
426     Now, edt-mapper.el will see "f12" when the physical NumLock key
427     is pressed, allowing the NumLock key to be used as the EDT PF1
428     (Gold) key.
429
430V.    HOW DOES THIS EDT EMULATION DIFFER FROM REAL EDT?:
431
432In general, you will find that this emulation of EDT replicates most, but not
433all, of EDT's most used Keypad Mode editing functions and behavior.  It is not
434perfect, but most EDT users who have tried the emulation agree that it is
435quite good enough to make it easy for die-hard EDT users to move over to using
436GNU Emacs.
437
438Here's a list of the most important differences between EDT and this GNU Emacs
439EDT Emulation.  The list is short but you must be aware of these differences
440if you are to use the EDT Emulation effectively.
441
4421.  Entering repeat counts works a little differently than in EDT.
443
444    EDT allows users to enter a repeat count before entering a command that
445    accepts repeat counts.  For example, when using the real EDT, pressing
446    these three keys in sequence, GOLD 5 KP1, will move the cursor in the
447    current direction 5 words.  This does NOT work in Emacs!
448
449    Emacs provides two ways to enter repeat counts and neither involves using
450    the GOLD key.  First, repeat counts can be entered in Emacs by using the
451    ESC key.  For example, pressing these keys in sequence, ESC 1 0 KP1, will
452    move the cursor in the current direction 10 words.  Second, Emacs provides
453    another command called universal-argument that can be used to do the same
454    thing.  Normally, in Emacs has this bound to C-u.
455
4562.  EDT's line mode commands and nokeypad mode commands are NOT supported
457    (with one important exception; see item 8 in the Highlights section
458    below).  Although, at first, this may seem like a big omission, the set of
459    built-in Emacs commands provides a much richer set of capabilities which
460    more than make up for this omission.
461
462    To enter Emacs commands not bound to keys, you can press GOLD KP7 or the DO
463    key.  Emacs will display its own command prompt "M-x".  This stands for the
464    keypress Meta-x, where Meta is a special shift key.  The Alt key is often
465    mapped to behave as a Meta key.  So, you can also invoke this prompt by
466    pressing Meta-x.  Typing the sequence "ESC x" will also invoke the prompt.
467
4683.  Selected text is highlighted ONLY on systems where Emacs supports the
469    highlighting of text.
470
4714.  Just like in TPU/EVE, the ENTER key is NOT used to terminate input when the
472    editor prompts you for input.  The RETURN key is used, instead.  (KP4 and
473    KP5 (the direction keys) do terminate input for the FIND command, just like
474    in EDT, however.)
475
476
477
478
479VI.   SOME HIGHLIGHTS IN THIS EDT EMULATION, AND SOME COMPARISONS TO THE
480      ORIGINAL GNU EMACS EDT EMULATION:
481
4821.  The EDT define key command is supported (edt-define-key) and is bound to
483    C-k in the default EDT mode when EDT control sequence bindings are enabled
484    or one of the sample edt-user.el customization files is used.  The TPU/EVE
485    learn command is supported but not bound to a key in the default EDT mode
486    but is bound in the sample edt-user.el file.
487
488    Unlike the TPU/EVE learn command, which uses one key to begin the learn
489    sequence, C-l, and another command to remember the sequence, C-r, this
490    version of the learn command (edt-learn) serves as a toggle to both begin
491    and to remember the learn sequence.
492
493    Many users who change the meaning of a key with the define key and the
494    learn commands, would like to be able to restore the original key binding
495    without having to quit and restart emacs.  So a restore key command is
496    provided to do just that.  When invoked, it prompts you to press the key
497    to which you wish the last replaced key definition restored.  It is bound
498    to GOLD C-k in the default EDT mode when EDT control sequence bindings are
499    enabled or one of the sample edt-user.el customization files is used.
500
5012.  Direction support is fully supported.
502
5033.  All original Emacs bindings are fully restored when EDT emulation is turned
504    off.  So, if a fellow worker comes over to your terminal to help you with a
505    software problem, for example, and is completely confused by your EDT
506    emulation bindings, just enter the command, edt-emulation-off, at the M-x
507    prompt and the original Emacs bindings will be restored.  To resume the EDT
508    emulation, just enter edt-emulation-on.
509
5104.  User custom EDT bindings are kept separate from the default EDT bindings.
511    One can toggle back and forth between the custom EDT bindings and default
512    EDT bindings.
513
5145.  The Emacs functions in edt.el attempt to emulate, where practical, the
515    exact behavior of the corresponding EDT keypad mode commands.  In a few
516    cases, the emulation is not exact, but we hope you will agree it is close
517    enough.  In a very few cases, we chose to use the Emacs way of handling
518    things.  As mentioned earlier, we do not emulate the EDT SUBS command.
519    Instead, we chose to use the Emacs query-replace function, which we find
520    to be easier to use.
521
5226.  Emacs uses the regexp assigned to page-delimiter to determine what marks a
523    page break.  This is normally "^\f", which causes the edt-page command to
524    ignore form feeds not located at the beginning of a line.  To emulate the
525    EDT PAGE command exactly, page-delimiter is set to "\f" when EDT emulation
526    is turned on, and restored to "^\f" when EDT emulation is turned off.
527    But, since some users prefer the Emacs definition of a page break, or may
528    wish to preserve a customized definition of page break, one can override
529    the EDT definition by placing
530
531            (setq edt-keep-current-page-delimiter t)
532
533    in your .emacs file.  Or, you can used the Emacs customize command
534    to change its setting.
535
5367.  The EDT definition of a section of a terminal window is hardwired to be 16
537    lines of its one-and-only 24-line window (the EDT SECT command bound to
538    KP8).  That's two-thirds of the window at a time.  Since Emacs, like
539    TPU/EVE, can handle multiple windows of sizes of other than 24 lines, the
540    definition of section used here has been modified to two-thirds of the
541    current window.  (There is also an edt-scroll-window function which you
542    may prefer over the SECT emulation.)
543
5448.  Cursor movement and deletion involving word entities is identical to EDT.
545    This, above all else, gives the die-hard EDT user a sense of being at
546    home.  Also, an emulation of EDT's SET ENTITY WORD command is provided,
547    for those users who like to customize movement by a word at a time to
548    their own liking.
549
5509.  EDT's FIND and FNDNXT are supported.
551
55210. EDT's APPEND, REPLACE, and SUBS commands are supported.
553
55411. CHNGCASE is supported.  It works on individual characters or selected
555    text, if SELECT is active.  In addition, two new commands are provided:
556    edt-lowercase and edt-uppercase.  They work on individual WORDS or
557    selected text, if SELECT is active.
558
55912. Form feed and tab insert commands are supported.
560
56113. A new command, edt-duplicate-word, is provided.  If you experiment with
562    it, you might find it to be surprisingly useful and may wonder how you
563    ever got along without it!  It is assigned to C-j in the sample
564    edt-user.el customization files.
565
56614. TPU/EVE's Rectangular Cut and Paste functions (originally from the EVE-Plus
567    package) are supported.  But unlike the TPU/EVE versions, these here
568    support both insert and overwrite modes.  The seven rectangular functions
569    are bound to F7, F8, GOLD-F8, F9, GOLD-F9, F10, and GOLD-F10 in the
570    default EDT mode.
571
57215. The original EDT emulation package set up many default regular and GOLD
573    bindings.  We tried to preserve most (but not all!) of these, so users of
574    the original emulation package will feel more at home.
575
576    Nevertheless, there are still many GOLD key sequences which are not bound
577    to any functions.  These are prime candidates to use for your own
578    customizations.
579
580    Also, there are several commands in edt.el not bound to any key.  So, you
581    will find it worthwhile to look through edt.el for functions you may wish
582    to add to your personal customized bindings.
583
58416. The VT200/VT300 series terminals steal the function keys F1 to F5 for
585    their own use.  These do not generate signals which are sent to the host.
586    So, edt.el does not assign any default bindings to F1 through F5.
587
588    In addition, our VT220 terminals generate an interrupt when the F6 key is
589    pressed (^C or ^Y, can't remember which) and not the character sequence
590    documented in the manual.  So, binding emacs commands to F6 will not work
591    if your terminal behaves the same way.
592
59317. The VT220 terminal has no ESC, BS, nor LF keys, as does a VT100.  So the
594    default EDT bindings adopt the standard DEC convention of having the F11,
595    F12, and F13 keys, on a VT200 series (and above) terminal, assigned to the
596    same EDT functions that are bound to ESC, BS, and LF on a VT100 terminal.
597
59818. Each user, through the use of a private edt-user.el file, can customize,
599    very easily, personal EDT emulation bindings.
600
60119. The EDT SELECT and RESET functions are supported.  However, unlike EDT,
602    pressing RESET to cancel text selection does NOT reset the existing
603    setting of the current direction.
604
605    We also provide a TPU/EVE like version of the single SELECT/RESET
606    function, called edt-toggle-select, which makes the EDT SELECT function
607    into a toggle on/off switch.  That is, if selection is ON, pressing SELECT
608    again turns selection off (cancels selection).  This function is used in
609    the sample edt-user.el customization files.
610
61120. EDT scroll margins are supported, but are disabled by default.  (See
612    CUSTOMIZING section below for instructions on how to enable them.)
613
614
615VII.  CUSTOMIZING:
616
617Most EDT users, at one time or another, make some custom key bindings, or
618use someone else's custom key bindings, which they come to depend upon just as
619if they were built-in bindings.  This EDT Emulation for GNU Emacs is designed
620to make it easy to customize bindings.
621
622If you wish to customize the EDT Emulation to use some of your own key
623bindings, you need to make a private version of edt-user.el in your own
624private lisp directory.  There are two sample files edt-user.el1 and
625edt-user.el2 for you to use as templates and for ideas.  Look at
626edt-user.el1 first.  Unless you will be using two or more very different
627types of terminals on the same system, you need not look at edt-user.el2.
628
629First, you need to have your own private lisp directory, say ~/lisp, and
630you should add it to the GNU Emacs load path.
631
632NOTE:  A few sites have different load-path requirements, so the above
633       directions may need some modification if your site has such special
634       needs.
635
636
637Creating your own edt-user.el file:
638
639A sample edt-user.el file is attached to the end of this user documentation.
640You should use it as a guide to learn how you can customize EDT emulation
641bindings to your own liking.  Names used to identify the set of LK-201
642keypad and function keys are:
643
644Keypad Keys:
645                PF1 PF2 PF3 PF4
646                KP7 KP8 KP9 KP-
647                KP4 KP5 KP6 KP,
648                KP1 KP2 KP3
649                KP0     KPP KPE
650
651Arrow Keys:
652                LEFT RIGHT DOWN UP
653
654Function Keys:
655                F1 F2 F3 F4 F5  F6 F7 F8 F9 F10  F11 F12 F13 F14
656                HELP DO  F17 F18 F19 F20
657
658                FIND   INSERT   REMOVE
659                SELECT PREVIOUS NEXT
660
661Note:
662                Many VT-200 terminals, and above, steal function keys F1 thru
663                F5 for terminal setup control and don't send anything to the
664                host if pressed.  So customizing bindings to these keys may
665                not work for you.
666
667There are three basic functions that do the EDT emulation custom bindings:
668edt-bind-key, edt-bind-gold-key, and edt-bind-function-key.
669
670The first two are for binding functions to keys which are standard across most
671keyboards.  This makes them keyboard independent, making it possible to define
672these key bindings for all terminals in the file edt.el.
673
674The first, edt-bind-key, is used typically to bind emacs commands to
675control keys, although some people use it to bind commands to other keys, as
676well.  (For example, some people use it to bind the VT200 seldom used
677back-tick key (`) to the function "ESC-prefix" so it will behave like an ESC
678key.)  The second function, edt-bind-gold-key, is used to bind emacs commands
679to gold key sequences involving alpha-numeric keys, special character keys,
680and control keys.
681
682The third function, edt-bind-function-key, is terminal dependent and is defined
683in a terminal specific file (see edt-vt100.el for example).  It is used to bind
684emacs commands to LK-201 function keys, to keypad keys, and to gold sequences
685of those keys.
686
687
688SPECIFYING WORD ENTITIES:
689
690The variable edt-word-entities is used to emulate EDT's SET ENTITY WORD
691command.  It contains a list of characters to be treated as words in
692themselves.  If the user does not define edt-word-entities in his/her .emacs
693file, then it is set up with the EDT default containing only TAB.
694
695The characters are stored in the list by their numerical values, not as
696strings.  Emacs supports several ways to specify the numerical value of a
697character.  One method is to use the question mark: ?A means the numerical
698value for A, ?/ means the numerical value for /, and so on.  Several
699unprintable characters have special representations:
700
701            ?\b  specifies  BS, C-h
702            ?\t  specifies  TAB, C-i
703            ?\n  specifies  LFD, C-j
704            ?\v  specifies  VTAB, C-k
705            ?\f  specifies  FF, C-l
706            ?\r  specifies  CR, C-m
707            ?\e  specifies  ESC, C-[
708            ?\\  specifies  \
709
710Here are some examples:
711
712     (setq edt-word-entities '(?\t ?- ?/)) ;; Specifies TAB, - , and /
713     (setq edt-word-entities '(?\t)        ;; Specifies TAB, the default
714
715You can also specify characters by their decimal ascii values:
716
717     (setq edt-word-entities '(9 45 47))   ;; Specifies TAB, - , and /
718
719
720ENABLING EDT CONTROL KEY SEQUENCE BINDINGS:
721
722Where EDT key bindings and GNU Emacs key bindings conflict, the default GNU
723Emacs key bindings are retained by default.  Some diehard EDT users may not
724like this.  So, if the variable edt-use-EDT-control-key-bindings is set to
725true in a user's .emacs file, then the default EDT Emulation mode will enable
726most of the original EDT control key sequence bindings.  If you wish to do
727this, add the following line to your .emacs file:
728
729        (setq edt-use-EDT-control-key-bindings t)
730
731
732SETTING SCROLL MARGINS:
733
734Scroll margins at the top and bottom of the window are now supported.  (The
735design was copied from tpu-extras.el.)  By default, this feature is enabled
736with the top margin set to 10% of the window and the bottom margin set to 15%
737of the window.  To change these settings, you can invoke the function
738edt-set-scroll-margins in your .emacs file.  For example, the following line
739
740          (edt-set-scroll-margins "20%" "25%")
741
742sets the top margin to 20% of the window and the bottom margin to 25% of the
743window.  To disable this feature, set each margin to 0%.  You can also invoke
744edt-set-scroll-margins interactively while EDT Emulation is active to change
745the settings for that session.
746
747NOTE: Another way to set the scroll margins is to use the Emacs customization
748feature (not available in Emacs 19) to set the following two variables
749directly:
750
751          edt-top-scroll-margin and edt-bottom-scroll-margin
752
753Enter the Emacs `customize' command.  First select the Editing group and then
754select the Emulations group.  Finally, select the Edt group and follow the
755directions.
756
757                              DEFAULT EDT Keypad
758
759   F7: Copy Rectangle             +----------+----------+----------+----------+
760   F8: Cut Rect Overstrike        |Prev Line |Next Line |Bkwd Char |Frwd Char |
761 G-F8: Paste Rect Overstrike      |   (UP)   |  (DOWN)  |  (LEFT)  | (RIGHT)  |
762   F9: Cut Rect Insert            |Window Top|Window Bot|Bkwd Sent |Frwd Sent |
763 G-F9: Paste Rect Insert          +----------+----------+----------+----------+
764  F10: Cut Rectangle
765G-F10: Paste Rectangle
766  F11: ESC
767  F12: Beginning of Line          +----------+----------+----------+----------+
768G-F12: Delete Other Windows       |   GOLD   |   HELP   |  FNDNXT  |  DEL L   |
769  F13: Delete to Begin of Word    |   (PF1)  |   (PF2)  |   (PF3)  |  (PF4)   |
770 HELP: Keypad Help                |Mark Wisel|Desc Funct|   FIND   |  UND L   |
771G-HELP: Emacs Help                +----------+----------+----------+----------+
772   DO: Execute extended command   |   PAGE   |   SECT   |  APPEND  |  DEL W   |
773  C-g: Keyboard Quit              |    (7)   |    (8)   |    (9)   |   (-)    |
774G-C-g: Keyboard Quit              |Ex Ext Cmd|Fill Regio| REPLACE  |  UND W   |
775  C-h: Beginning of Line          +----------+----------+----------+----------+
776G-C-h: Emacs Help                 |  ADVANCE |  BACKUP  |   CUT    |  DEL C   |
777  C-i: Tab Insert                 |    (4)   |    (5)   |    (6)   |   (,)    |
778  C-j: Delete to Begin of Word    |   BOTTOM |    TOP   |   Yank   |  UND C   |
779  C-k: Define Key                 +----------+----------+----------+----------+
780G-C-k: Restore Key                |   WORD   |    EOL   |   CHAR   |   Next   |
781  C-l: Form Feed Insert           |    (1)   |    (2)   |    (3)   |  Window  |
782  C-n: Set Screen Width 80        | CHNGCASE |  DEL EOL |Quoted Ins|          !
783  C-r: Isearch Backward           +---------------------+----------+  (ENTER) |
784  C-s: Isearch Forward            |         LINE        |  SELECT  |          !
785  C-t: Display the Time           |         (0)         |    (.)   |   Query  |
786  C-u: Delete to Begin of Line    |      Open Line      |  RESET   |  Replace |
787  C-v: Redraw Display             +---------------------+----------+----------+
788  C-w: Set Screen Width 132
789  C-z: Suspend Emacs                    +----------+----------+----------+
790G-C-\: Split Window                     |  FNDNXT  |   Yank   |   CUT    |
791                                        |  (FIND)  | (INSERT) | (REMOVE) |
792  G-b: Buffer Menu                      |   FIND   |          |   COPY   |
793  G-c: Compile                          +----------+----------+----------+
794  G-d: Delete Window                    |SELECT/RES|SECT BACKW|SECT FORWA|
795  G-e: Exit                             | (SELECT) |(PREVIOUS)|  (NEXT)  |
796  G-f: Find File                        |          |          |          |
797  G-g: Find File Other Window           +----------+----------+----------+
798  G-h: Keypad Help
799  G-i: Insert File
800  G-k: Toggle Capitalization Word
801  G-l: Lowercase Word or Region
802  G-m: Save Some Buffers
803  G-n: Next Error
804  G-o: Switch to Next Window
805  G-q: Quit
806  G-r: Revert File
807  G-s: Save Buffer
808  G-u: Uppercase Word or Region
809  G-v: Find File Other Window
810  G-w: Write file
811  G-y: EDT Emulation OFF
812  G-z: Switch to User EDT Key Bindings
813  G-1: Delete Other Windows
814  G-2: Split Window
815  G-%: Go to Percentage
816  G- : Undo  (GOLD Spacebar)
817  G-=: Go to Line
818  G-`: What line
819  G-/: Query-Replace
820
821;;; File:  edt-user.el   ---  Sample User Customizations for the Enhanced
822;;;                             EDT Keypad Mode Emulation
823;;;
824;;;                      For GNU Emacs 19 and Above
825;;;
826;; Copyright (C) 1986, 1992, 1993, 2000, 2001, 2002, 2003, 2004, 2005,
827;;   2006, 2007  Free Software Foundation, Inc.
828
829;; Author: Kevin Gallagher <kgallagh@spd.dsccc.com>
830;; Maintainer: Kevin Gallagher <kgallagh@spd.dsccc.com>
831;; Keywords: emulations
832
833;; GNU Emacs is free software; you can redistribute it and/or modify
834;; it under the terms of the GNU General Public License as published by
835;; the Free Software Foundation; either version 2, or (at your option)
836;; any later version.
837
838;; GNU Emacs is distributed in the hope that it will be useful,
839;; but WITHOUT ANY WARRANTY; without even the implied warranty of
840;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
841;; GNU General Public License for more details.
842
843;; You should have received a copy of the GNU General Public License
844;; along with GNU Emacs; see the file COPYING.  If not, write to the
845;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
846;; Boston, MA 02110-1301, USA.
847
848;;; Commentary:
849
850;; This file contains GNU Emacs User Custom EDT bindings and functions.
851
852;;; Usage:
853
854;;  See edt-user.doc in the emacs etc directory.
855
856;; ====================================================================
857
858;;;;
859;;;; Setup user custom EDT key bindings.
860;;;;
861
862(defun edt-setup-user-bindings ()
863  "Assigns user custom EDT Emulation keyboard bindings."
864
865  ;; PF1 (GOLD), PF2, PF3, PF4
866  ;;
867  ;; This file MUST contain a binding of PF1 to edt-user-gold-map.  So
868  ;; DON'T CHANGE OR DELETE THE REGULAR KEY BINDING OF PF1 BELOW!
869  ;; (However, you may change the GOLD-PF1 binding, if you wish.)
870  (edt-bind-function-key "PF1" 'edt-user-gold-map 'edt-mark-section-wisely)
871  (edt-bind-function-key "PF2" 'query-replace 'other-window)
872  (edt-bind-function-key "PF4" 'edt-delete-entire-line 'edt-undelete-line)
873
874  ;; EDT Keypad Keys
875  (edt-bind-function-key "KP1" 'edt-word-forward 'edt-change-case)
876  (edt-bind-function-key "KP3" 'edt-word-backward 'edt-copy)
877  (edt-bind-function-key "KP6" 'edt-cut-or-copy 'yank)
878  (edt-bind-function-key "KP8" 'edt-scroll-window 'fill-paragraph)
879  (edt-bind-function-key "KP9" 'open-line 'edt-eliminate-all-tabs)
880  (edt-bind-function-key "KPP"
881			 'edt-toggle-select 'edt-line-to-middle-of-window)
882  (edt-bind-function-key "KPE" 'edt-change-direction 'overwrite-mode)
883
884  ;; GOLD bindings for regular keys.
885  (edt-bind-gold-key "a" 'edt-append)
886  (edt-bind-gold-key "A" 'edt-append)
887  (edt-bind-gold-key "h" 'edt-electric-user-keypad-help)
888  (edt-bind-gold-key "H" 'edt-electric-user-keypad-help)
889
890  ;; Control bindings for regular keys.
891  ;;; Leave binding of C-c as original prefix key.
892  (edt-bind-key "\C-j" 'edt-duplicate-word)
893  (edt-bind-key "\C-k" 'edt-define-key)
894  (edt-bind-gold-key  "\C-k" 'edt-restore-key)
895  (edt-bind-key "\C-l" 'edt-learn)
896  ;;; Leave binding of C-m to newline.
897  (edt-bind-key "\C-n" 'edt-set-screen-width-80)
898  (edt-bind-key "\C-o" 'open-line)
899  (edt-bind-key "\C-p" 'fill-paragraph)
900  ;;; Leave binding of C-r to isearch-backward.
901  ;;; Leave binding of C-s to isearch-forward.
902  (edt-bind-key "\C-t" 'edt-display-the-time)
903  (edt-bind-key "\C-v" 'redraw-display)
904  (edt-bind-key "\C-w" 'edt-set-screen-width-132)
905  ;;; Leave binding of C-x as original prefix key.
906)
907
908;;;
909;;; LK-201 KEYBOARD USER EDT KEYPAD HELP
910;;;
911
912(defun edt-user-keypad-help ()
913  "
914                                USER EDT Keypad Active
915
916                                  +----------+----------+----------+----------+
917   F7: Copy Rectangle             |Prev Line |Next Line |Bkwd Char |Frwd Char |
918   F8: Cut Rect Overstrike        |   (UP)   |  (DOWN)  |  (LEFT)  | (RIGHT)  |
919 G-F8: Paste Rect Overstrike      |Window Top|Window Bot|Bkwd Sent |Frwd Sent |
920   F9: Cut Rect Insert            +----------+----------+----------+----------+
921 G-F9: Paste Rect Insert
922  F10: Cut Rectangle
923G-F10: Paste Rectangle
924  F11: ESC                        +----------+----------+----------+----------+
925  F12: Beginning of Line          |   GOLD   |Query Repl|  FNDNXT  |Del Ent L |
926G-F12: Delete Other Windows       |   (PF1)  |   (PF2)  |   (PF3)  |   (PF4)  |
927  F13: Delete to Begin of Word    |Mark Wisel|Other Wind|   FIND   |  UND L   |
928 HELP: Keypad Help                +----------+----------+----------+----------+
929G-HELP: Emacs Help                |   PAGE   |Scroll Win|Open Line |  DEL W   |
930   DO: Execute extended command   |    (7)   |    (8)   |    (9)   |   (-)    |
931  C-a: Beginning of Line          |Ex Ext Cmd|Fill Parag|Elim Tabs |  UND W   |
932  C-b: Backward Character         +----------+----------+----------+----------+
933  C-d: Delete Character           |  ADVANCE |  BACKUP  | CUT/COPY |  DEL C   |
934  C-e: End of Line                |    (4)   |    (5)   |    (6)   |   (,)    |
935  C-f: Forward Character          |   BOTTOM |    TOP   |   Yank   |  UND C   |
936  C-g: Keyboard Quit              +----------+----------+----------+----------+
937G-C-g: Keyboard Quit              | Fwd Word |    EOL   | Bwd Word |  Change  |
938  C-h: Electric Emacs Help        |    (1)   |    (2)   |    (3)   | Direction|
939G-C-h: Emacs Help                 | CHNGCASE |  DEL EOL |   COPY   |          |
940  C-i: Indent for Tab             +---------------------+----------+  (ENTER) |
941  C-j: Duplicate Word             |         LINE        |SELECT/RES|          |
942  C-k: Define Key                 |         (0)         |    (.)   |  Toggle  |
943G-C-k: Restore Key                |      Open Line      |Center Lin|Insrt/Over|
944  C-l: Learn                      +---------------------+----------+----------+
945  C-n: Set Screen Width 80
946  C-o: Open Line                       +----------+----------+----------+
947  C-p: Fill Paragraph                  |  FNDNXT  |   Yank   |    CUT   |
948  C-q: Quoted Insert                   |  (FIND)) | (INSERT) | (REMOVE) |
949  C-r: Isearch Backward                |   FIND   |          |   COPY   |
950  C-s: Isearch Forward                 +----------+----------+----------+
951  C-t: Display the Time                |SELECT/RES|SECT BACKW|SECT FORWA|
952  C-u: Universal Argument              | (SELECT) |(PREVIOUS)|  (NEXT)  |
953  C-v: Redraw Display                  |          |          |          |
954  C-w: Set Screen Width 132            +----------+----------+----------+
955  C-z: Suspend Emacs
956G-C-\\: Split Window
957
958  G-a: Append to Kill Buffer
959  G-b: Buffer Menu
960  G-c: Compile
961  G-d: Delete Window
962  G-e: Exit
963  G-f: Find File
964  G-g: Find File Other Window
965  G-h: Keypad Help
966  G-i: Insert File
967  G-k: Toggle Capitalization Word
968  G-l: Lowercase Word or Region
969  G-m: Save Some Buffers
970  G-n: Next Error
971  G-o: Switch Windows
972  G-q: Quit
973  G-r: Revert File
974  G-s: Save Buffer
975  G-u: Uppercase Word or Region
976  G-v: Find File Other Window
977  G-w: Write file
978  G-y: EDT Emulation OFF
979  G-z: Switch to Default EDT Key Bindings
980  G-2: Split Window
981  G-%: Go to Percentage
982  G- : Undo  (GOLD Spacebar)
983  G-=: Go to Line
984  G-`: What line
985  G-/: Query-Replace"
986
987  (interactive)
988  (describe-function 'edt-user-keypad-help))
989