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

Deepayan Sarkar deepayan.sarkar at gmail.com
Fri Jun 4 15:02:10 CEST 2010


On Fri, Jun 4, 2010 at 2:29 AM, Stephen Eglen <S.J.Eglen at damtp.cam.ac.uk> wrote:
> 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:

I'm not sure of the pros and cons w.r.t. Emacs' built-in filename
completion, but note that the completion facilities in R also support
filename completion natively in R (disabled by default except on
Windows), and this will not get confused here. This does not prepend
the full path of the current directory (which I think is a good thing,
but YMMV). To test it, do

> rc.settings(files = TRUE)

and then assuming you have a file foo.txt in the current directory

> "foo

M-x ess-complete-object-name

should complete the filename. (This also works using C-c C-TAB in .R
file buffers.)

-Deepayan



More information about the ESS-help mailing list