fix(x, file=tempfile("fix"), window=F, display=getenv("DISPLAY"), geometry="80x24", diff=F, fix=T, save.options=T)
x
is omitted,
fix
attempts
to determine what was last fixed, and uses that. This applies whether or
not there was an error last time.
TRUE
, the editor will be started in its own window.
This option is currently implemented only for X11-based window systems.
For it to work, either
display
must be specified or the environment
variable DISPLAY must be set, and the window system must be
running.
window
must be
TRUE
for this to have any effect. If
window=TRUE
and
display
is omitted, the DISPLAY environment
variable is examined.
window=TRUE
. See the UNIX xterm manual page
for syntax.
x
should be produced
at the end of the edit session.
If
diff
is a character string, it should name a UNIX program, optionally
with flags, which takes two file names as arguments and writes on standard
output. If
diff=TRUE
, the program defaults to UNIX diff.
FALSE
, nothing is edited. Used to change the option
values without modifying anything else. See the OPTIONS section below.
TRUE
, the current option values will be saved.
See the OPTIONS section.
fix=TRUE
, the new version of the edited object is invisibly returned.
It is not usually necessary to capture this, because it will also be
automatically assigned under the name passed in
x
. If
fix=FALSE
,
a list containing the previous values of the saved options is invisibly
returned.
The basic functionality of
fix
is
like f <- vi(f). Whereas
vi
,
ed
,
and
data.ed
accept any expression and return
the edited version of the
data, assigning nothing,
fix
expects a name and will assign the new
version of the object under that name.
The arguments
window
,
display
,
geometry
, and
The editor program
and the pager program (to page the diff) are global S-PLUS options.
See the
options
helpfile.
If the file cannot be read back in, most typically because of a syntax
error, the message "Errors occurred; Use fix() to re-edit this object."
will appear on the screen. Typing
fix()
with no
x
argument will then
start the editor on the same file, whose contents will reflect the
previous edit session. When the file can be read back into S-PLUS, the
object will be assigned as usual.
It is important that such errors be corrected as described before any
other use of the
fix
function, and before exiting the S-PLUS session.
Otherwise it may be difficult to locate the file containing one's work.
fix
will be most useful with S-PLUS functions.
fix(my.fun) # edit and re-assign my.fun fix() # edit my.fun again fix(new.fun) # new.fun doesn't exist yet fix(f) # we will leave a syntax error in the file # Syntax error: Unbalanced parentheses, expected "}", before ")" # at line 4, file /tmp/fix17056 # Dumped Errors occurred; Use fix() to re-edit this object. fix() # get back into same file; omit x argument fix(f, diff=T) # show me what I changed fix(f, diff="diff -c") # print a context diff fix(f, window=T, geometry="80x24+50+50") # make X11 window 80 characters wide and 24 lines long, # and [always] place it at coordinates (50,50) fix(f, window=T, geometry="80x50", save.options=F) # long window, this time only fix(window=T, diff=T, fix=F) # set new defaults; no editing args(fix) # show function argument defaults, ignoring saved overrides print(fix(fix=F)) # show saved override values