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