[ESS] working directory lost when R session closes

Paul Johnson pauljohn32 at gmail.com
Fri Jul 14 16:31:31 CEST 2017

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()
[1] "/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()
[1] "/home/pauljohn/GIT/rockchalk/package/rockchalk"

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