[ESS-bugs] ess-mode 5.2.8; opening file with tramp mode -> error

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Wed Mar 1 00:21:21 CET 2006


David Reitter writes:
 > Hi Stephen,
 > 
 > >
 > > Debugger entered--Lisp error: (file-error "Opening directory" "no
 > > such file or directory" "/ssh:dreitter at ssh.inf.ed.ac.uk:/home/
 > > dreitter/PhD/stats/")
 > >    file-name-all-completions("R-1" "")
 > >    ess-find-exec-completions("R-1")
 > >    mapcar(ess-find-exec-completions ("R-1" "R-2"))
 > >    ess-r-versions-create()
 > >    byte-code("1!RAFGM1$fAHIM1$fAJKM1$fALMM1$frz8	
 > >
 > > I'm a bit bemused why it is calling ess-r-versions-create
 > >
 > > As far as I can see, that function is just called once, in
 > > ess-site.el, and so should be run only once, when (require 'ess-site)
 > > is executed.
 > >
 > > So, what is your set  up in .emacs?  Are you autoloading R mode or
 > > something? Do you get this error in ssh when opening all files with
 > > tramp?  what happens in you first start M-x R and then try opening a
 > > file with tramp?
 > 
 > Indeed, with an M-x R-mode beforehand, the error goes away.
 > In Aquamacs, R is loaded via site-lisp as below. Instead of running  
 > "load" from site-lisp, I autoload it. Can't see anything wrong with  
 > that (I'm sure you'll tell me).

Hmm... to be honest, I'm not sure.  This is just the way of loading
ESS.  Other members of ess-core might be able to say why ess-site.el
is set up this way, rather than autoloading.  But, given that is the
way that we currently ask users to set it up, this kind of bug might
not get high priority for fixing (sorry I can't dig deeper in this
right now).

Here is the function you mentioned:

(defun ess-find-exec-completions (ess-root-arg &optional ess-exec-dir)
"Given the root of an executable file name, find all possible completions,
if any exist, in PATH."
  (let* ((ess-exec-path
	 (if ess-exec-dir (ess-return-list ess-exec-dir) exec-path))
	(ess-tmp-exec nil)
	(ess-tmp-path-count (length ess-exec-path))
	(ess-tmp-dir nil)
	(ess-tmp-files nil)
	(ess-tmp-file nil)
	(i 0) (j 0) (k 0))


 > I don't really understand `ess-find-exec-completions', with its i, j  
 > and k, but my take is that  ess-tmp-dir is "" when it should probably  
 > be something, and that leads to the current working directory being  
 > assumed, which will probably fail with the reasonable error we're  
 > seeing when using tramp mode.  I guess the lesson is that you can't  
 > count on the working directory being accessible at all times.
 > Why would `ess-find-exec-completions' want to try a completion with  
 > the working directory anyways? Shouldn't it just look in everything  
 > in `exec-path' ?

It looks to me by this definition that ess-exec-path is set to
exec-path unless the optional arg ess-exec-dir is passed to this
function.  Your backtrace would indicate ess-find-exec-completions is
not given this optional arg.

The problem instead seems to be that 
>    file-name-all-completions("R-1" "")

is being called with empty 2nd arg, rather than a directory.

Of course, the hack around this for now would be set ess-r-versions to
nil, so that ess-r-versions-create does nothing.  Does that then
eliminate the problem also?  But if you can see what's going wrong
with a trace of the above function, that would be helpful.  

In the meantime, we need to fix the doc string of
ess-find-exec-completions since ESS-EXEC-DIR arg needs documenting...

Stephen




More information about the ESS-bugs mailing list