.BG
.VE $Header: /usr3/s/current/s/.help/RCS/edit,v 1.2 83/12/30 19:28:01 rab Exp $
.FN edit
.FN again
.TL
edit again: Edit Dumped Expressions or Character Vectors
.CS
edit( )    #for editing the dumped expression
again( )   #to re-evaluate dumped expression

edit(x, pos=)   #for character vector
.PP
.AG x
optional character vector to be edited.  If `x' is omitted,
`edit' operates on the last expression dumped because of a
syntax or an execution error.
.AG pos=
optional data directory position (on search list)
where the edited vector should be stored.
Default 1, the working directory.
.SH EFFECT
If `x' is given, the edited data is assigned, with the same name,
on the working directory. Note that this implies that it is
impossible to edit an expression (as opposed to a dataset),
since this has no name for the assignment:
`edit(encode(1:5))' will not work.
.PP
After `edit' is invoked, the data from the dumped expression or
character vector is written to a hidden file, one element of the
vector per line of the file.  A text editor (the default is `ed')
is invoked and the file is read.
.PP
At this point, editor commands can be used to modify the text.  When
a suitable version of the text is produced, execute
commands to write the edited text back to the file, and
to exit from the editor (`w' and `q' in `ed').
.PP
After exiting from the editor, the file is read by `edit'.  If the data was
a dumped expression, a hidden call to `source' causes the edited
expression to be executed. Notice that this edited version stays
around, for another call to `edit' to make further changes.  If `x'
was given, the edited expression is stored on the working directory.
.PP
To suppress execution of the edited expression, DO NOT just leave the editor
without writing (this leaves the expression as before). Instead, use
a command to delete everything and then write the file
(the `ed' command `1,$s/.*//', then `w'); this leaves nothing to
execute.
.PP
The function `again' is useful to re-execute expressions that 
were dumped because of execution errors that have been remedied, e.g., when
a graphic device has been activated, when a missing dataset
has been created, or when a prefix has been specified.
.PP
Use the function `medit' to edit macros.
.PP
The user can specify which editor should be invoked by setting a Unix shell
variable prior to invoking S.  For example, the line
`EDITOR=vi; export EDITOR'
will cause the `edit' to use the `vi' screen editor rather than `ed'.
.EX
edit(state.name) #edit the vector of state names.
.KW basic*
.KW editing
.KW error
.KW manip
.WR
