savehistory directories and quitting R (PR#2038)
Because I work in different directories, but always want to save my .Rhistory in the same place, I have changed the system function savehistory to this: function (file = "D:/R50/.Rhistory") invisible(.Internal(savehistory(file))) When I use q() to quit R, and it asks me whether I want to "save current workspace", a response of YES means that the .Rhistory is saved in the current working directory, rather than D:/R50/.Rhistory. I take this to mean that the quit-on-prompt sequence makes a direct call to .Internal( savehistory...) rather than going via the actual savehistory() function. It would be nicer if prompt-on-quit would honour the user's definition of savehistory.
What happens on shutdown is specific to the platform you're working on, but in both Windows and Unix versions, the filename is taken from the R_HISTFILE environment variable. I don't know if this works on the Mac. This would be more obvious if the R savehistory() function were changed to check the R_HISTFILE environment variable too. The problem with using the user's savehistory() function is that this violates the idea of namespaces that we're working towards: users should be able to create their own function named "savehistory" without worrying about changing important internal behaviour. Duncan Murdoch -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._