From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#9793: 24.0.90; Unwanted tramp connection on eshell completion. Date: Tue, 25 Oct 2011 12:41:01 +0200 Message-ID: <87fwihgxqa.fsf@gmx.de> References: <87r529a8g2.fsf@gmail.com> <871uu7lcv7.fsf@gmail.com> <87wrbxjrfi.fsf@gmx.de> <87y5wamva0.fsf@gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1319540218 26359 80.91.229.12 (25 Oct 2011 10:56:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 25 Oct 2011 10:56:58 +0000 (UTC) Cc: 9793@debbugs.gnu.org, Thierry Volpiatto To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 25 12:56:54 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RIegd-0000Hm-Pz for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Oct 2011 12:56:52 +0200 Original-Received: from localhost ([::1]:39990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIegd-00075N-1R for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Oct 2011 06:56:51 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:55697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIeRv-0000lu-G5 for bug-gnu-emacs@gnu.org; Tue, 25 Oct 2011 06:41:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RIeRj-0006Rf-Rw for bug-gnu-emacs@gnu.org; Tue, 25 Oct 2011 06:41:38 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40600) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIeRj-0006RA-0H for bug-gnu-emacs@gnu.org; Tue, 25 Oct 2011 06:41:27 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RIeTG-00080C-IQ for bug-gnu-emacs@gnu.org; Tue, 25 Oct 2011 06:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Oct 2011 10:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9793 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9793-submit@debbugs.gnu.org id=B9793.131953937930748 (code B ref 9793); Tue, 25 Oct 2011 10:43:02 +0000 Original-Received: (at 9793) by debbugs.gnu.org; 25 Oct 2011 10:42:59 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RIeTB-0007zr-Gs for submit@debbugs.gnu.org; Tue, 25 Oct 2011 06:42:58 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.23]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1RIeT4-0007zY-R4 for 9793@debbugs.gnu.org; Tue, 25 Oct 2011 06:42:52 -0400 Original-Received: (qmail invoked by alias); 25 Oct 2011 10:41:05 -0000 Original-Received: from p57BB99F3.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.153.243] by mail.gmx.net (mp011) with SMTP; 25 Oct 2011 12:41:05 +0200 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/uLyVM1Evufz7pdVG9s6jITzccoiR3NQIq4OHtRu rpjQM2/CpSp/az In-Reply-To: (Stefan Monnier's message of "Mon, 24 Oct 2011 10:20:36 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux) X-Y-GMX-Trusted: 0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 25 Oct 2011 06:43:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:53112 Archived-At: Stefan Monnier writes: > 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 "/"). Thanks for the explanation. I start to understand (honestly, all this programmable completion is out of my understanding). > 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:") Tramp has some code to guess whether it is in completion mode. Check of `non-essential' is one proof, checking the last keyboard input (being TAB, or not) is another one. If Tramp finds out that it is in completion mode, it suppresses some remote actions, like expand-file-name. Since your code (let ((default-directory "/")) (file-directory-p "tequila:")) does not show an evidence of the completion mode, all remote actions are performed. The actions for `file-directory-p' are never been suppressed, that's why Tramp performs them also when being in completion mode. >> 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. Better not. There are still needed checks in shell.el, which are applied to remote files. `comint-file-name-prefix keeps the remote part of those files. See for example Bug#6764. >> 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). That was the intention of my patch :-) Return t in case of remote files. Inside Tramp it could be behave such a way when it detects it is in completion mode. That means, when `non-essential' is set to t. Shall I do it this way? > Stefan Best regards, Michael.