[ESS] working directory lost when R session closes
p@u|john32 @end|ng |rom gm@||@com
Mon Jul 17 18:53:45 CEST 2017
On Mon, Jul 17, 2017 at 5:26 AM, Martin Maechler
<maechler using stat.math.ethz.ch> wrote:
>>>>>> Paul Johnson <pauljohn32 using gmail.com>
>>>>>> on Fri, 14 Jul 2017 09:31:31 -0500 writes:
> > Do you notice this:
> > cd into a folder, say "~/tmp/project/R" and start emacs with a file in
> > there. The working directory correctly shows "~/tmp/project/R".
> > Then launch an R session. When you quit the R session, and start a new
> > R session, the working directory changed, it becomes "~/tmp/project".
> > This is just a little inconvenient if you get an R session with some
> > crap in it and you close it down to start fresh, but the WD is no
> > longer correct. Its necessary to close emacs and re-open the file.
> > I'll paste in the Emacs session transcript to show what I mean. The
> > only thing I do after the q() is hit the big blue R button:
> >> getwd()
> >  "/home/pauljohn/GIT/rockchalk/package/rockchalk/R"
> >> q()
> > Save workspace image? [y/n/c]: n
> > Process R finished at Fri Jul 14 09:30:04 2017
> > R version 3.4.1 (2017-06-30) -- "Single Candle"
> > Copyright (C) 2017 The R Foundation for Statistical Computing
> > Platform: x86_64-pc-linux-gnu (64-bit)
> > R is free software and comes with ABSOLUTELY NO WARRANTY.
> > You are welcome to redistribute it under certain conditions.
> > Type 'license()' or 'licence()' for distribution details.
> > Natural language support but running in an English locale
> > R is a collaborative project with many contributors.
> > Type 'contributors()' for more information and
> > 'citation()' on how to cite R or R packages in publications.
> > Type 'demo()' for some demos, 'help()' for on-line help, or
> > 'help.start()' for an HTML browser interface to help.
> > Type 'q()' to quit R.
> >> > if(identical(getOption('pager'), file.path(R.home('bin'), 'pager'))) # rather take the ESS one
> > + options(pager='cat')
> >> options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', show.error.locations=TRUE)
> >> getwd()
> >  "/home/pauljohn/GIT/rockchalk/package/rockchalk"
> This is strange.
> I tried this, with /tmp/project/R/foo.R
> but when I quit R (using C-c C-q; and having set
> (inferior-R-args "--no-restore-history --no-save ")
> in my ~/.emacs equivalent, so I'm never asked about saving --
> the only reasonable thing anyway!
Thanks. I think you solved this. I used the menu to insert
customization and the working directory now stays same on Ubuntu Linux
'(inferior-R-args "--no-restore-history --no-save")
The problem is solved.
I also confirmed your (and Vitalie's) other contention. If I move my
init.el file out, then the R wd stays same between R sessions. So that
means I had something that caused the working directory to change to
one directory above.
My init file is a jumble of settings while I try to use various
versions of org mode, python, stata, sas, and who knows what else, I
wonder how do your init file in order? Look at all this crap in here.
There must be some better way than keeping one gigantic laundry bag
full of settings.
Some of these settings are truly necessary, but some are corrections
for old versions of Emacs, or Windows users, or bugs in particular
Got advice about how you keep your act together?
> and restart it , my working directory *is* the same,
>  "/tmp/project/R"
> Can anyone reproduce Paul's problem?
> If not, Paul, you may have set another non-default somewhere.
Paul E. Johnson http://pj.freefaculty.org
Director, Center for Research Methods and Data Analysis http://crmda.ku.edu
To write to me directly, please address me at pauljohn at ku.edu.
More information about the ESS-help