[ESS] [ESS-bugs] ess-mode 5.9.1; autocompletion of file path always uses initial working directory

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Fri Jun 4 11:29:14 CEST 2010


François Michonneau <francois.michonneau at gmail.com> wrote:


> 1. Start ESS for R (M-x R)
> 2. Enter the working directory (e.g. /home/francois)
> 3. Use a function that takes a file name as argument: (e.g. read.table)
> and say that I want to read the file named "someData.data" in the
> directory "/home/francois". So, at the prompt, I type
> 'read.table(file="s' and hit TAB to autocomplete, then everything works
> well and I get: 'read.table(file="/home/francois/someData.data'
> 4. Change the working directory using setwd() to
> "/home/francois/myProject/"
> 5. Let's say that I want to read the file someOtherData.data that is in
> "/home/francois/myProject", so at the prompt I type 'read.table(file="s'
> and hit TAB to autocomplete, then I get
> 'read.table(file="/home/francois/someData.data' where I should get
> 'read.table(file="/home/francois/myProject/someOtherData.data'

Dear Francois,
I've now put in a fix to ESS SVN, so that whenever Emacs gets confused
about which directory you are in, just hit M-RET to get Emacs
up-to-date.  It turns out also that I'd forgotten I'd also previously
made another solution.  This is now in the ESS documention:

This should be part of the next release of ESS.

Stephen
----------------------------------------------------------------------

   4. When you change directory within a *R* or *S* session using the
setwd() command, emacs does not recognise that you have changed the
current directory.

   Solution: Use `M-x ess-change-directory'.  This will prompt you for
the directory to change to.  It will then change directory within the
*S* buffer, and also update the emacs variable `default-directory'.
Alternatively, if you have already executed setwd(), press `M-RET'
within the *S* buffer so that Emacs can update `default-directory'.



More information about the ESS-help mailing list