[ESS] working directory lost when R session closes

Martin Maechler m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Mon Jul 17 12:26:39 CEST 2017


>>>>> 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()
    > [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"
    >> 

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 

    (custom-set-variables
	(inferior-R-args "--no-restore-history --no-save ")
    )

 in my ~/.emacs equivalent,  so I'm never asked about saving --
 the only reasonable thing anyway!
)

and restart it ,  my  working directory *is* the same,

> getwd()
[1] "/tmp/project/R"
>


Can anyone reproduce Paul's problem?

If not, Paul, you may have set another non-default somewhere.

Best,
Martin




More information about the ESS-help mailing list