bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9793: 24.0.90; Unwanted tramp connection on eshell completion.


From: Stefan Monnier
Subject: bug#9793: 24.0.90; Unwanted tramp connection on eshell completion.
Date: Mon, 24 Oct 2011 10:20:36 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux)

>> This looks like a workaround rather than a fix.  Also, I notice that in
>> `shell' (rather than `eshell') the problem does not occur.  So I'd like
>> to better understand what's going on.
> In shell just the local file names are taken for completion.  I don't
> know how this is implemented, maybe via pcompletion tables?

Both use pretty much the same pcomplete code.

I think I finally figured out what is the difference between the two
cases:  if you set pcomplete-file-ignore and pcomplete-dir-ignore
in shell-mode like it is set in eshell, the same problem shows up.

So what happens is:
- in eshell-mode
  - file-name-all-completions returns '("tic:" "tequila:" "tmp/")
  - completion-file-name-table then checks the predicate (which combines
    file-directory-p with regexp matching to avoid CVS and a few other
    directories).
  - this calls (file-directory-p "tequila:") in the "/" dir, which
    triggers Tramp.
- in shell-mode
  - file-name-all-completions returns '("tic:" "tequila:" "tmp/")
  - completion-file-name-table then checks the predicate (file-directory-p)
  - file-directory-p is *not* called because completion-file-name-table
    handles it specially (just checks the presence of a terminating "/").

I still don't understand why in eshell, tramp-maybe-open-connection is
called within the following backtrace:
  tramp-completion-file-name-handler(file-directory-p "/tequila:")
  file-directory-p("tequila:")
whereas when I manually call
  (let ((default-directory "/")) (file-directory-p "tequila:"))
tramp-maybe-open-connection is called within the following backtrace:
  tramp-completion-file-name-handler(expand-file-name "tequila:" "/")
  file-directory-p("tequila:")
  
> In eshell, all file names are good for completion, also remote
> ones. This is valid, because "cd /sudo::" is a valid command in
> eshell.

In shell-mode completion also understands Tramp file names (yup, that's
a bug, we should probably default comint-file-name-prefix to "/:/"), so
that's not the problem.

> But this makes the trouble with the completion predicate
> `file-directory-p'.

Yup, I think we should somehow make it so Tramp can say
(file-directory-p "/tequila:") => t
without trying to connect to tequila (after all, even if we can't
connect to tequila, this is still a "directory", just one we currently
can't access).


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]