So you want to set ess-history-file to nil in some directories but not
others? I think you can put

((nil . ((ess-history-file . nil))))

in a .dir-locals.el file as described in
https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html
and then add

(add-hook 'inferior-ess-mode-hook 'hack-dir-local-variables-non-file-buffer)

to your emacs init file. It seemed to work for me though I didn't do
much testing.

Best,
Ista

On Tue, Aug 23, 2016 at 4:38 PM, Kevin Coombes
<kevin.r.coom...@gmail.com> wrote:
> Almost. (Not sure why I couldn't find that in the documentation, so thanks
> for pointing it out.)
>
> If I use (setq ess-history-file nil) in the .emacs, file, then it does
> indeed prevent the .Rhistory file from being written. But then, of course,
> for the >99% of the time when I'm not updating clinical data files, it
> prevents all other .Rhistoery files from being written.
>
> So, I tried editing the script file so the first line starts with
>
> -*- inferior-R-args: "--no-save" ess-history-file: nil -*-
>
> And I confirmed that the value of the variable in the buffer containing the
> script is indeed 'nil'. (Some of you can already see where this is
> heading....) But, starting the inferior R process with M-x R from that
> buffer, the variable is NOT inherited.  So, the *R* buffer still has
> ess-history-file set to the default value ".Rhistory" and it goes ahead and
> saves it anyway.
>
> Is there anything I can put in the R script that will convince ESS to keep
> the ess-history-file set to 'nil' in the other (*R*) buffer?
>
> Thanks again,
>   Kevin
>
>
> On 8/23/2016 2:45 PM, Enrico Schumann wrote:
>>
>> On Tue, 23 Aug 2016, Kevin Coombes <kevin.r.coom...@gmail.com> writes:
>>
>>> Hi,
>>>
>>> My question: Is it possible to prevent ESS from saving a ".Rhistory"
>>> file?
>>>
>>> While I know this question has appeared in ess-help before (in
>>> September 2009), I'd like to resurrect it.  Briefly, the previous
>>> discussion pointed out that running R from the command line with
>>>      R --no-save
>>> will prevent R itself from even asking about writing a workspace
>>> ".RData" file, and will prevent it from creating a .Rhistory
>>> file. However, using
>>>      (setq inferior-R-args "--no-save")
>>> prevents the RData file but *not* the Rhistory file. The explanation
>>> had something to do with the (comint-write-input-ring).
>>>
>>> I'd like to request that the behavior be changed, by explaining the
>>> use-case that got me to this point.
>>>
>>> The application is that I am the "honest broker" who holds the keys to
>>> update a clinical data file. That is, I have a password-protected
>>> Excel file that contains the keys mapping between HIPPA-safe
>>> identifiers (like Sample013) to the protected health information of
>>> either the medical record number or patient name. Then there is a
>>> second password-protected Excel file that contains the updated
>>> clinical information using unsafe identifiers. I have to open both
>>> files, put the HIPAA-safe identifiers on the updated clinical
>>> information, remove the protected information, and write the results.
>>>
>>> For obvious reasons, I don't want to hard-code the password into the
>>> R-script running in ESS.  So, I use the following lines to get the
>>> password
>>>
>>> cat("Password? ")
>>> pwd <- readLines(file("stdin"), 1)
>>>
>>> and go merrily on my way, reading the data, deleting traces that might
>>> have existed in temporary files, and all should be good.
>>>
>>> But it isn't.  Because ESS saves the .Rhistory file at the end, AND
>>> the .Rhistory file contains the password that I typed. So now there is
>>> a record of the password in a file left on my machine, and I have to
>>> manually track down that file and delete it.
>>>
>>> Oh, and I'd like a solution that works by using a local file variable
>>> to set inferior-R-args (or something similar) in the script so that it
>>> automatically prevents the history file from being written.
>>>
>>> So, is my use case strong enough to inspire someone to figure out if
>>> the current behavior of ESS can be modified? I would be very happy to
>>> help test things....
>>>
>>> Best,
>>>    Kevin
>>>
>>>
>> Hi Kevin,
>>
>> does setting
>>
>>    (setq-default inferior-R-args "--no-restore-history --no-save -q")
>>    (setq ess-history-file nil)
>>
>> in your .emacs file help?
>>
>> See also http://ess.r-project.org/Manual/ess.html#Saving-History .
>>
>>
>> Kind regards
>>       Enrico
>>
>>
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
> ______________________________________________
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

______________________________________________
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Reply via email to