[ESS] starting directory not detected correctly anymore

Susumu Tanimura @rum|n@t @end|ng |rom gm@||@com
Tue Dec 12 06:29:30 CET 2017

Hi there,

Similar trouble happens to me.

$ pwd
$ emacs test.R &

then, after starting R session,
> getwd()
[1] "/"

ESS always starts in the parent directory of current directory. Nothing
to do with "R" directory. 

Any help?

$ lsb_release -d
Description:	Ubuntu 16.04.3 LTS
$ emacs --version |head -1
GNU Emacs 24.5.1
$ dpkg -l ess |tail -1
ii  ess            17.11-2xenial0 all          Emacs mode for statistical programming and data analysis


On Thu, 30 Nov 2017 18:59:46 -0600
Paul Johnson <pauljohn32 using gmail.com> wrote:

> Greetings.
> I want to have ESS know the working directory from shell pwd, I don't
> want it to ask me.
> I have a setting in my init.el that used to work that way:
> ;; start R in current working directory, don't let R ask user:
> (setq ess-ask-for-ess-directory nil)
> Recently, it has stopped working. The symptom of the problem is that
> the R session working directory trims off the last element in the
> path. This is in Ubuntu 17.04 with emacs 24.5.1 and ess 17.11.
> When I open a file from command line, say in
> $ cd ~/tmp/R/
> $ emacs testme.R
> and then I hit the bug blue icon to start R, then getwd() shows
> "~/tmp". The last element in the path is lost.  Same happens if I
> start R with "Alt-x R", so don't hate me for liking your pretty blue R
> button.
> I notice that M-x eshell gets it right, it opens a shell in the /R
> directory (the correct one). Also Emacs File "Open Directory" also
> gets it right. Its just the inferior ESS *R* session that doesn't get
> it right.
> If I remove that line from init.el, then the ESS process stops and
> asks me what directory what I want and it always guesses correctly.
> I never saw this happen before today when opening a pre-existing R
> file from the shell.  I have seem similar in past if I have an Emacs
> session open and close the R session and re-start a new R session
> without closing Emacs.  That second instance almost always has lost
> the "R" from the file path, and shows the parent directory.
> Would somebody try it and tell me if I've just gone all the way off
> the cliff toward crazy?
> Suggestions welcome (except concerning cliffs), thanks as usual.
> pj

More information about the ESS-help mailing list