[R-SIG-Mac] Start R with --save?

Simon Urbanek simon.urbanek at r-project.org
Fri Jul 14 05:42:26 CEST 2006


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

> I am not sure if the command line arg --save is supposed to be  
> supported
> by R.app,

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.

> 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
>

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).


> 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?
>


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



More information about the R-SIG-Mac mailing list