Interactive Editing
Date: 2020-10-07 18:10:00

Up | Next | Prev | PrevTail | Tail

### 13.2 Interactive Editing

It is possible when working interactively to edit any REDUCE input that comes from the user’s terminal, and also some user-deﬁned procedure deﬁnitions. At the top level, one can access any previous command string by the command ed(n), where n is the desired command number as prompted by the system in interactive mode. ED; (i.e. no argument) accesses the previous command.

After ED has been called, you can now edit the displayed string using a string editor with the following commands:

B | move pointer to beginning
C⟨character⟩ | replace next character by ⟨character⟩
D | delete next character
E | end editing and reread text
F⟨character⟩ | move pointer to next occurrence of ⟨character⟩
I⟨string⟩⟨escape⟩ | insert ⟨string⟩ in front of pointer
K⟨character⟩ | delete all characters until ⟨character⟩
P | print string from current pointer
Q | give up with error exit
S⟨string⟩⟨escape⟩ | search for ﬁrst occurrence of ⟨string⟩, positioning pointer just before it
space or X | move pointer right one character.

The above table can be displayed online by typing a question mark followed by a carriage return to the editor. The editor prompts with an angle bracket. Commands can be combined on a single line, and all command sequences must be followed by a carriage return to become eﬀective.

Thus, to change the command x := a+1; to x := a+2; and cause it to be executed, the following edit command sequence could be used:

f1c2e<return>.

The interactive editor may also be used to edit a user-deﬁned procedure that has not been compiled. To do this, one says:

editdef ⟨id⟩;

where ⟨id⟩ is the name of the procedure. The procedure deﬁnition will then be displayed in editing mode, and may then be edited and redeﬁned on exiting from the editor.

Some versions of REDUCE now include input editing that uses the capabilities of modern window systems. Please consult your system dependent documentation to see if this is possible. Such editing techniques are usually much easier to use then ED or EDITDEF.

Up | Next | Prev | PrevTail | Front