SEDT advanced guide, Version 3.0 Introduction Introduction This document is a sequel to "Sedt primer" which should be studied first. It completes the description of SEDT's built-in functions and explains how to customize the editor by changing the definitions of the keys. This guide has been written for Digital keyboards. If you have an IBM PC or IBM AT keyboard refer to appendix A for a translation from Digital to IBM keys. SEDT advanced guide, Version 3.0 Command-line arguments Command-line arguments When you activated SEDT, you can give it certain extra instructions by adding to the command line. If you supply a second file specification, thus: SEDT B:FROGS.TXT B:NEWFROGS.TXT SEDT loads up the editing buffer from the first-named file, but makes the second-named file the default output file. There are also some hyphen-plus-single-letter switches, any or all of which can be appended at the end of the SEDT command: -J disables the generation of a journal file (thus making SEDT faster but less reliable); -E causes a control-Z character to be appended to a file when it is written out to a disk; -B disables the generation of a .BAK file when an edited file is written out with the same name as an existing file (beware -- if you disable backup and you don't have enough disk space to hold the new version, you wind up with no version). -R ensures that the last line of any file saved from SEDT is terminated with a . -D informs SEDT that it is being run on an IBM PC or compatible using a Digital LK250 keyboard. It is also possible to invoke SEDT with no arguments, in which case you will have to select an output file once you get into the program, using the command. SEDT advanced guide, Version 3.0 Initialization files and journal files Initialization files and journal files When SEDT is activated, it looks for a file SEDTCOM.TXT, first in SEDT's master directory, or SEDT$COMMANDS under VAX/VMS, containing a script of SEDT command sequences. If the file is found, the basic commands are executed during initialization. (See below for an explanation of SEDT's basic commands.) SEDT also looks for a file with the same filename proper as the one being edited, but the filetype .JOU. If this file is found, SEDT will submit the keystrokes it records as if they came from the keyboard, thus reconstructing the editing session that was interrupted. (One important limitation: Journal files do not record movements of data from one window to another; windowing operations are ignored during recovery.) The entire sequence of initialization operations that SEDT goes through can be summarized as follows: 1. Load the input file into buffer 0; if the specified input file is not found in the current directory, display a warning message and start with buffer 0 empty. 2. Recover the key definitions from System Keyboard File VMS Any Sedt$Keys: Rainbow LK201 RBKEY.TXT IBM PC IBM PCKEY.TXT IBM PC/XT IBM XTKEY.TXT IBM PC/AT IBM ATKEY.TXT VAXmate IBM ATKEY.TXT IBM PC LK250 LKKEY.TXT IBM PC/XT LK250 LKKEY.TXT IBM PC/AT LK250 LKKEY.TXT VAXmate LK250 LKKEY.TXT abort if this file is not found. 3. Recover the ruler from MS/DOS, CP/M: RULER0.TXT in SEDT's master directory; VMS: SEDT$DIR:RULER0.TXT; if this file is not found, display a warning message and set up a default ruler. 4. If the user has supplied a line number in the MS-DOS command that activates SEDT, move the cursor to that line. 5. Look for a script in CP/M, MS/DOS: SEDTCOM.TXT in SEDT's master directory; VMS: SEDT$COMMANDS and execute the instructions in it if it is found. 6. Look for a .JOU file with the same filename as the input file and reproduce the effect of the keystrokes recorded in it if it is found. SEDT advanced guide, Version 3.0 Command structure Command structure As noted in the introductory document, a command can be preceded by a repetition factor, indicating how many times it is to be done. In addition, with any direction-dependent command, it is possible to override the default direction of motion by typing <+> or <>> (for forward motion), or <-> or <<> (for backward motion), before the command. Such a prefix should precede the repetition-factor prefix if both are used. When you are responding to a prompt from SEDT, you can edit your response by pressing the boxed X key to delete the previous character, the left and right arrow keys to move the cursor back and forth so that additional characters can be inserted, and to discard the entire response. SEDT advanced guide, Version 3.0 Additional cursor movement commands Additional cursor movement commands On the 23'd display line, at the start, SEDT indicates a direction of cursor movement (either "Forward" or "Reverse"). This directional indication applies to a group of cursor movement commands that were not mentioned in the introductory guide: Move one character. Keypad key <3> shifts the cursor one character in the current direction of cursor movement. (It is therefore equivalent to the right arrow if the current direction is "Forward," to the left arrow if it is "Reverse.") Move to next beginning of word. Keypad key <1> shifts the cursor to the next point in the current direction of cursor movement at which a word begins. Move to next beginning of line. Keypad key <0> shifts the cursor to the next point in the current direction of cursor movement at which a line begins. Move to next end of line. Keypad key <2> shifts the cursor to the next point in the current direction of cursor movement at which a line ends. Move to next beginning of paragraph. Keypad key <8> shifts the cursor to the next point in the current direction of cursor movement at which a paragraph begins. Move to next page break. Keypad key <7> shifts the cursor to the next page break in the current direction of cursor movement, or to the beginning or end of the file if no page break is encountered. (The way to insert a page break into a text you are editing is to press

.) SEDT advanced guide, Version 3.0 Additional cursor movement commands The direction of motion also affects the behavior of the "Search for specific string" operation described in the introductory guide. If the current direction is Forward, the "Search for specific string" operation searches from the current cursor position towards the end of the buffer; if it is Reverse, however, the search proceeds from the current cursor position backwards towards the beginning of the file. When SEDT is initially entered, the default direction of motion is Forward. The "Back up" command (keypad key <5>) switches it to Reverse; the "Advance" command (keypad key <4>) restores the Forward direction of motion. Many experienced users always preserve the Forward direction, moving backwards when necessary by pressing <5>, giving the necessary cursor-movement commands, and then pressing <4>. Two other cursor-movement operations are independent of the direction of motion: Move to previous beginning of line. The key, also marked , the second from the left in the third group of gray keys across the top of the keyboard, moves the cursor to the beginning of the line on which it is placed, or, if it is already at the beginning of a line, to the beginning of the previous line. (Thus it works like the Reverse version of the "Move to next beginning of line" command, but does not presuppose the Reverse direction of motion.) Mark position. ("Mark") causes SEDT to remember the position in the text that is occupied by the cursor at the time the command is entered. Subsequently one can return to that position by pressing , followed by the <.> key on the ordinary typewriter keyboard (NOTE: NOT THE NUMERIC KEYPAD). Actually up to ten positions in the text can be marked independently; the sequence , number, , , where "number" is any decimal number from 1 to 10, will set a mark, and the sequence , number, , <.> will go to that mark. The mark that is used by default in the plain vanilla is mark #1. Finally, SEDT recognizes certain synonyms for familiar commands. and are synonyms for <4>; either of them moves the cursor to the end of the buffer. Similarly, and are synonyms for <5>. SEDT advanced guide, Version 3.0 File-management and buffer-management commands File-management and buffer-management commands SEDT permits the user to manipulate several files of text simultaneously and to switch from one file to another without exiting from the program. Specifically, SEDT maintains four independent "main" text buffers, numbered from 0 to 3. When the program is initially activated, the user is placed in buffer 0; however, one can move into any of the four buffers by pressing the correct function key in the rightmost group of gray keys at the top of the keyboard: -- buffer 0 -- buffer 1 -- buffer 2 -- buffer 3 When any of these keys are pressed the screen contents change to show the newly selected buffer. If the screen was split into two parts the upper will display the newly selected buffer and the lower the previously selected buffer. If, when the screen is split, you select the same buffer the screen will show two identical views into the same buffer - but changes and movement will only be displayed in the upper window. SEDT supplies the following commands for managing files, buffers, and windows: Load current file into buffer. If you have just entered a new, empty buffer, allows you to load a file into it or to name the file that you want to create from it. (SEDT prompts you at the bottom of the screen to enter the name of the file.) If you issue this command when the current buffer contains text that has not yet been saved in a file, you will receive the message Save changes to current file? (Y/N): If you respond affirmatively, a save operation will be performed; otherwise, the contents of the current buffer will be discarded. In either case, the subsequent effect is like entering SEDT on the file whose name you provide. SEDT advanced guide, Version 3.0 File-management and buffer-management commands Zap buffer. causes SEDT to discard the contents of the current buffer and to forget the file name formerly associated with it, giving you a clean slate to work on. If the current buffer contains text that has not been saved at the time you enter this command, SEDT gives you one last chance: Unsaved changes to this buffer. Are you sure? : A negative response cancels the ZAP operation. Include file into buffer. causes SEDT to copy the contents of a file that you specify (in response to a further prompt) into the current buffer immediately before the current cursor position. Print current buffer. transmits the contents of the current buffer to the LST: device. A prompt allows you to specify a file name, if that is appropriate. Load file into paste buffer. prompts you for the name of a file and copies that file into the (invisible) paste buffer, from which it can be inserted into the text with . Toggle number of windows displayed. If the current display consists of two windows, eliminates the lower one and extends the upper one so that more of the file being edited can be seen. If the current display consists of one window, divides the screen, shrinking the current buffer into the upper window and displaying the most recently edited alternative buffer in the lower window. (If no other buffer has been edited, the lower window is empty.) Switch to previous buffer. Gold X will switch the currently selected buffer and the previously selected buffer. This command is useful when you have a program in one buffer and a compiler error listing in another. If you have not switched buffers before SEDT will switch to buffer number 1. SEDT advanced guide, Version 3.0 File-management and buffer-management commands Toggle screen width. changes the display from 80 columns to 132 columns or from 132 columns to 80 columns. Refresh screen. blanks the entire screen momentarily. This command is used when you have two windows into the same buffer. Normally, any editing changes that are made in the upper window are not reflected in the lower one; updates both windows so that their contents are consistent. The key is a synonym for ; the key is a synonym for ; and the key is a synonym for . activates the help facility, so it is a synonym for and . Inside the help facility, you can press either or to advance to the next screen, either or to go back a screen, and either or the space bar to return to the editing session. The contents of the help facility are drawn from the help file; if this file is not in the master directory, SEDT displays an error message. The help file is named as follows: System Keyboard File VMS Any Sedt$Help: Rainbow LK201 RBHLP.TXT IBM PC IBM PCHLP.TXT IBM PC/XT IBM XTHLP.TXT IBM PC/AT IBM ATHLP.TXT VAXmate IBM ATHLP.TXT IBM PC LK250 LKHLP.TXT IBM PC/XT LK250 LKHLP.TXT IBM PC/AT LK250 LKHLP.TXT VAXmate LK250 LKHLP.TXT SEDT advanced guide, Version 3.0 File-management and buffer-management commands Finally, three notes concerning the screen display: A star (*) is placed to the left of the file name on line 1 of the display whenever an editing operation that changes the contents of the buffer has taken place since the file was last saved. If a line displayed on the screen extends beyond the physical screen margin, a reverse-video > appears at the right edge. SEDT advanced guide, Version 3.0 Miscellaneous editing commands Miscellaneous editing commands Change case. Pressing , then keypad key <1>, usually causes the character on which the cursor is positioned, if it is a letter, to change from lower case to upper case or vice versa. The cursor then advances to the next character. It is possible to reverse the case of a lot of letters at once by using operation is active, SEDT will check whether the most recent operation was a search command, in which case it will reverse the case of the string that matched the search string. The one-character "Change case" operation is the default if neither of these prior conditions holds. Transpose characters. swaps the character on which the cursor is positioned with the one immediately following it. Insert control character. To insert an ASCII control character or an extended ASCII character that the keyboard cannot normally generate, press , type the ASCII code for the character as a decimal integer, press , and finally press keypad key <3>. (In one particular case -- the escape character, ASCII 27 -- there is a shorter way; just press the key twice on a Rainbow or just once on an IBM PC.) Search and substitute. Pressing and then keypad key <9> causes SEDT to request two strings, the first a string to be sought, the second a string that is to replace the first if it is found. SEDT starts at the current cursor position and searches in the current direction of motion; when it finds the string it is looking for, it replaces it with the new string and positions the cursor on that new string. Subsequently, pressing keypad key <9> (without ) repeats the operation with the same strings. , if entered immediately after a substitution, reverses its effect. SEDT advanced guide, Version 3.0 Miscellaneous editing commands Append to paste buffer. You can cut out an arbitrary chunk of text and have it appended to the previous contents of the paste buffer (instead of displacing them) by using @V Same position in adjacent line @W Start of word The delimiter that figures in the definition of the @F entity, may be any visible graphic character, presumably one that does not occur in the string sought. The same delimiter must be used at each end of the string. Inside a non-movement command, a mention of an "entity" usually refers to the swatch of text between the current cursor position and the position with which the entity is equated in the preceding table. Instead of moving the cursor to that other point, SEDT performs some transformation on the intervening text. SEDT advanced guide, Version 3.0 SEDT basic commands Non-movement commands have the structure [sign] [count] command Here the sign field, as above, indicates the direction of motion or of entity-definition for the command. Except as indicated in the list, the count field again gives a repetition factor and may be omitted if the command is to be done only once. (Note, however, that the :CH, :M, and :WI commands, like the @M entity, pre-empt the count field for their own use.) :A Set default direction of motion to Forward :B Set default direction of motion to Reverse :CCentity Change case within entity :CDentity Lower-case all letters within entity :CE Change case in EDT style: throughout F025 -- F026 -- F027 -- F028 -- F029 -- F030 -- F031 -- keypad <0> F032 -- keypad <1> F033 -- keypad <2> F034 -- keypad <3> F035 -- keypad <4> SEDT advanced guide, Version 3.0 SEDT basic commands F036 -- keypad <5> F037 -- keypad <6> F038 -- keypad <7> F039 -- keypad <8> F040 -- keypad <9> F041 -- keypad <,> F042 -- keypad <-> F043 -- keypad <.> F044 -- F045 -- F046 -- F047 -- F048 -- The prefix 'G' differentiates the cases in which is pressed before the indicated typewriter or function key. To indicate that a sequence of commands is to be repeated as a unit, one can enclose the entire sequence in parentheses and prefix a count (a decimal integer) to it to indicate the number of repetitions. A count of 0, in this context, indicates that the sequence is to be repeated indefinitely, until an error occurs or until the :TI operation detects that a key has been pressed. (For instance, the definition of the operation is 0(-@L:TI). -- that is, "move in reverse to successive beginnings of lines until an error occurs or a key is pressed." A sequence of commands can be execute only if the current buffer has been modified by enclosing the enclosing the commands with ^C( and ). This contruct is useful for saving a modified file before spawning to a postprocessor. A variation of this contruct is to have two sequences of commands separated by | within the parentheses which causes the first sequence to be executed if the buffer is modified and the second if not modified. SEDT advanced guide, Version 3.0 SEDT basic commands It is also possible to program error handling into a key definition with the construct: ^E(command1)(command2) The string of commands in command1 is executed. If an error occurs anywhere in these the rest of command1 is skipped and the sequence command2 will be executed. If no error occurs command2 will be skipped. A slightly more complex variant is: ^E(command1)(command2|command3) Command1 is executed and if any error occurs the rest of command1 will be skipped and the sequence command2 executed. If no error occurs command3 will be executed after completion of command1. You can force SEDT to ignore errors in a command by enclosing it in the following construct: ^E(command)() The key-definition file is read by Sedt during initialization every time it is activated. Therefore, all you need to do in order to customize SEDT is to modify this file, which is a text (non-binary) file containing lines of the form Substitute the commands you prefer, or add new key definitions at the end of the file. In the key-definition file it is possible to specify that a particular command should display a prompt and wait for input, which it then incorporates into the basic command. A key definition containing an exclamation point followed by a delimited string (any visible character may be used as a delimiter), when executed, prints out the specified string as a prompt and waits for a keystroke, optionally preceded by . The name of the key thus detected is edited into the command. Similarly, a key definition containing a question mark followed by a delimited string prints out the specified string as a prompt and waits for a string input, terminated by , , or . The input string is then incorporated into the instruction. SEDT advanced guide, Version 3.0 SEDT basic commands The construction %F is a key definition is replaced by the name of the current default output file, including the filetype; %N is replaced by the filename proper of the current default output file (excluding the filetype). Question marks, exclamation points, or percentage signs that appear in key definitions for any other purpose must be doubled. SEDT advanced guide, Version 3.0 Defining and redefining keys Defining and redefining keys If you have some sequence of commands that needs to be repeated many times during an editing session, you can define a key to designate the entire sequence: Define (or redefine) any key. Causes SEDT to issue two prompts. The first, 'Key:', asks the user to press the key or combination of keys to be defined; the second, 'As:', asks the user to press the sequence of keys that the defined key is to abbreviate. As the keys are pressed, the basic commands that they stand for appear at the bottom of the screen. (It is also possible to reply to the 'As:' prompt by typing in the sequence of basic commands to be executed, in the format described in the previous section. This will be necessary if the command to be abbreviated includes any key that is used for editing the command line itself, such as the left arrow or the boxed X.) Saving keystrokes for later execution. After , any sequence of keystrokes that you supply is stored in memory while of being executed. The sequence is to be terminated by . It may not include , since this would lead to an infinite loop on execution (see the next command). Executing stored keystrokes. A sequence of keystrokes that has been stored with the preceding command can be activated by pressing . Display a key definition. You can examine the current definition of a key, as follows: Press , and reply to the prompt "Key:" by pressing the key that you wish to redefine; the current definition, spelled out in terms of SEDT's basic commands, will appear in the buffer at the current cursor position. SEDT advanced guide, Version 3.0 Defining and redefining keys Load key definition from buffer. will load the contents of the current buffer into a key definition. Reply to the prompt "Key:" by pressing the key to be defined. This command is usually used in conjunction with the "Display a key definition" command to edit a key definition. SEDT advanced guide, Version 3.0 Appendix A Appendix A IBM to Digital keyboard translation Digital key PC key F1 ALT 1 F2 ALT 2 F3,Setup ALT 3 F4 ALT 4 F5,Break ALT 5 F6,Interrupt ALT 6 F7,Resume ALT 7 F8,Cancel ALT 7 F9,Main Screen ALT 8 F10,Exit ALT 9 F11,ESC ALT Q F12,BS ALT W F13,LF ALT E F14,Additional Options ALT R F15,Help ALT T F16,Do ALT Y F17 ALT U F18 ALT I F19 ALT O F20 ALT P Find F1 Insert Here F3 Remove F4 Select F2 Prev Screen F5 Next Screen F6 Up Arrow F7 Left Arrow F9 Down Arrow F8 Right Arrow F10 Keypad 0 Keypad 0 Keypad 1 Keypad 1 Keypad 2 Keypad 2 Keypad 3 Keypad 3 Keypad 4 Keypad 4 Keypad 5 Keypad 5 Keypad 6 Keypad 6 Keypad 7 Keypad 7 Keypad 8 Keypad 8 Keypad 9 Keypad 9 Keypad , AT: Keypad - Keypad - PC: Keypad -; AT: Prt Sc Keypad . Keypad . Keypad PF1 PC: Num Lock; AT: Esc Keypad PF2 AT: Num Lock Keypad PF3 AT: Scroll Lock Keypad PF4 PC: Num Lock; AT: Sys Keypad Enter Keypad +