On 28 Nov 2013, at 14:38 , John Fox <[email protected]> wrote:

> Dear Peter,
> 
> On Thu, 28 Nov 2013 12:00:31 +0100
> peter dalgaard <[email protected]> wrote:
>> 
>> On 28 Nov 2013, at 01:46 , John Fox <[email protected]> wrote:
>> 
>>> Hi Rob,
>>> 
>>> I had some time today and so I started to implement this solution in the
>>> Rcmdr. I first tested whether setting
>>> 
>>> system("defaults write org.R-project.R NSAppSleepDisabled -bool yes")
>>> 
>>> fixes the problem; I verified via 
>>> 
>>> system("defaults read org.R-project.R NSAppSleepDisabled")
>>> 
>>> that the key was in fact set properly. 
>>> 
>>> I'm afraid that even with NSAppSleepDisabled set, the Rcmdr still freezes
>>> periodically. Whatever is going on is probably more complicated than
>>> power-saving.
>>> 
>> 
>> Hmm. The tkfaq issue seems to have gone away for me. You did remember to 
>> restart R.app after setting the key?
>> 
> 
> I didn't "remember" to restart R.app because I didn't know that it was 
> necessary to do so. In fact, the code that I wrote, but didn't commit, for 
> the Rcmdr carefully resets the key to its previous state or deletes it if it 
> didn't previously exist when the Commander is closed.
> 
> I think that you've almost surely identified my problem, but the solution 
> also raises a question about what to do. I'm reluctant to have the Rcmdr make 
> a permanent change to users' OS settings. I guess that I could detect whether 
> the NSAppSleepDisabled key is set and pop up a dialog box if it isn't, 
> offering to make the change, and suggesting that the user restart R.app. 
> (BTW, is there an easy way to check whether R is running in R.app or a 
> terminal?) Wouldn't it be better to handle this issue in R.app or even in 
> tcltk, however?

I suspect that this particular option also affects people running simulations 
from R.app, so that the natural state really should be "disabled" and you need 
not have qualms about tampering with it. Presumably, we could do the disabling 
on install. If people have strong reasons to aggressively preserve battery 
power, they could just turn it back on. 

I think Rob put on his todo list to figure out whether/how you change the 
setting in an active process, which would open up other possibilities.

-pd 

> 
> If restarting R.app after setting the NSAppSleepDisabled key doesn't work for 
> me, I'll then pursue Rob's suggestions.
> 
> Thanks for this,
> John
-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: [email protected]  Priv: [email protected]

_______________________________________________
R-SIG-Mac mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to