Skip to content

Start R with --save?

4 messages · Duncan Murdoch, Simon Urbanek, Byron Ellis

#
I am not sure if the command line arg --save is supposed to be supported 
by R.app, but it doesn't
work.  When I start R from a Terminal command line with command line 
option  --save:

/Applications/R.app/Contents/MacOS/R --save

instead of a silent save, I get the Unix-style prompt in the console:

Save workspace image? [y/n/c]:

If this isn't the way to specify that I want an automatic save, what is?

Duncan Murdoch
#
On Jul 13, 2006, at 7:10 PM, Duncan Murdoch wrote:

            
No, it's not supposed to be supported. R.app ignores all command line  
arguments, because it assumes that it was started using LS (which  
supply their own special arguments). The command-line R of course  
supports all arguments as documented, but it has nothing to do with  
R.app.

As a matter of fact R.app starts R with --no-save --gui=cocoa, but  
R.app sets SaveAction to SA_SAVEASK during initialization but after  
parsing of arguments. The quit dialog is handled via  
windowShouldClose: message instead.

This is not set in stone - just the status-quo.
This is not the way to start R from the command line - for the GUI it's
open R.app
also note that LS send "arguments" such as files to open via Apple  
Events and not via command line (e.g. open -a R.app fool.R does not  
result in .../MacOS/R foo.R)
For the console version it's
R
(or more precisely /Library/Frameworks/R.framework/Resources/bin/R if  
the user removed the convenience softlink for some reason).
The GUI has currently no way to specify automatic save. One option  
would be to add a preferences setting (probably the most native way),  
others include environment option or command-line arguments. As I was  
saying earlier, the problem with command-line arguments is that they  
cannot be used with LS, and manual startup without LS is not a  
supported way (it works for now, but at times there were problems  
with it, because the system settings are entirely different for an  
application started w/o LS).

I guess the reason why this didn't come up in practice is that the  
GUI has an integrated editor, so there is no such thing as --save,  
because you still need to specify filenames for unsaved untitled  
files, decide what to do with unsaved changes etc., so --save may be  
potentially confusing.

Nevertheless, I'm open to any requests - a modification it pretty  
easy to implement.

Cheers,
Simon
#
I would vote for a preference option, because I actually like the  
opposite behavior (--no-save) by default :-)
On Jul 13, 2006, at 8:42 PM, Simon Urbanek wrote:

            
---
Byron Ellis (ellis at stat.harvard.edu)
"Oook" -- The Librarian
#
On Jul 14, 2006, at 1:19 AM, Byron Ellis wrote:

            
Ok, now implemented in 3317. For now there is no UI for it, so you  
can set it only from the shell, e.g.:

defaults write org.R-project.R save.on.exit -string no

Possible values are (strings, case-sensitive): yes/no/ask. Anything  
other than yes/no is treated as "ask". The setting applies only to  
the console, it has no effect on editor windows.

Cheers,
Simon