GNU bug report logs - #41423
27.0.91; eshell file completion in tramp dir is slow (3 minutes) [regression on pretest]

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: rrandresf@HIDDEN; dated Wed, 20 May 2020 16:23:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 1 Sep 2020 13:30:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 01 09:30:19 2020
Received: from localhost ([127.0.0.1]:55373 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kD6Md-0007ZJ-5R
	for submit <at> debbugs.gnu.org; Tue, 01 Sep 2020 09:30:19 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:50947)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1kD6Ma-0007Z3-No
 for 41423 <at> debbugs.gnu.org; Tue, 01 Sep 2020 09:30:17 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 53A9A80922;
 Tue,  1 Sep 2020 09:30:11 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 88A888066B;
 Tue,  1 Sep 2020 09:30:09 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1598967009;
 bh=K8GjzoEmo5w227a05xSqZiYIGE5acpsxJ8jBkrtzU+4=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=fRx4gUhPkFSsB0ul0Fsiw37jZxUG+l/TlIVZZyK2dgAigKU66T9dwvxnq3kpqAlRg
 C5RGYPXl8Q/kWrGl3dq7Qjw2A75QS/UDihzZ2RVKi6QjLG8lBlmOHWv8L0alBpGSsP
 m2K4ZIr48/MrcpCQWACcETP7xaOTmHzrDSCpXe7JspQcJ/vYabWmEhBe4er+qzGJsL
 jz5+9Rw1OfMe56F8RmMsdkUxCSXNWqYrNXOLFd+ni1qLpzHovudwsFgk4ZWzRV3t8T
 JnhEoq0dLIAsWT69D4RyKAULhY2s+YtOVOu8QuIm+WilW5gqDve/qBRiRvVQU4X48G
 NumVhrioYo0Tg==
Received: from alfajor (unknown [45.72.232.131])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4235C1202F4;
 Tue,  1 Sep 2020 09:30:09 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Gregory Heytings <ghe@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
Message-ID: <jwvzh69r5ki.fsf-monnier+emacs@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
 <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
 <87mu2d7hka.fsf@HIDDEN> <jwvv9h11mtb.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008291808310453.23004@HIDDEN>
 <jwveeno23j8.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008302320550453.28913@HIDDEN>
 <jwvh7sirwcu.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2009011003160453.3798@HIDDEN>
 <B552D4AE-EC7A-4841-98BF-88C1C6EE8762@HIDDEN>
 <alpine.NEB.2.22.394.2009011326140453.22465@HIDDEN>
 <jwv5z8xsl4u.fsf-monnier+emacs@HIDDEN>
Date: Tue, 01 Sep 2020 09:30:07 -0400
In-Reply-To: <jwv5z8xsl4u.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Tue, 01 Sep 2020 09:08:28 -0400")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.061 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41423
Cc: Michael Albinus <michael.albinus@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
 rrandresf@HIDDEN, Tim Vaughan <timv@HIDDEN>, 41423 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> And the fix is to make this third call return in 0.00 seconds like the
> others by making it return not the list of commands but a mere function
> (which will return that list of commands only when called, but in the
> present case it won't be called).

See for example patch below (which shouldn't be applied as-is since the
body of the function ends up misindented).


        Stefan


diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index 48c99acac3..e41afea9ef 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -399,11 +399,15 @@
 
 (defun eshell-complete-commands-list ()
   "Generate list of applicable, visible commands."
-  (let ((filename (pcomplete-arg)) glob-name)
+  ;; Building the commands list can take quite a while over Tramp
+  ;;  (bug#41423), so do it lazily.
+  (completion-table-dynamic
+   (lambda (filename)
     (if (file-name-directory filename)
         (if eshell-force-execution
             (pcomplete-dirs-or-entries nil #'file-readable-p)
           (pcomplete-executables))
+       (let (glob-name)
       (if (and (> (length filename) 0)
 	       (eq (aref filename 0) eshell-explicit-command-char))
 	  (setq filename (substring filename 1)
@@ -455,7 +459,7 @@
 			    (and eshell-show-lisp-alternatives
 				 (null completions)))
 			(all-completions filename obarray #'functionp))
-		   completions)))))))
+		      completions)))))))))
 
 (define-obsolete-function-alias 'eshell-pcomplete #'completion-at-point "27.1")
 





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 1 Sep 2020 13:08:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 01 09:08:37 2020
Received: from localhost ([127.0.0.1]:55358 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kD61d-00072t-5P
	for submit <at> debbugs.gnu.org; Tue, 01 Sep 2020 09:08:37 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:54110)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1kD61b-00072g-VU
 for 41423 <at> debbugs.gnu.org; Tue, 01 Sep 2020 09:08:36 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 63FBF80533;
 Tue,  1 Sep 2020 09:08:30 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id DAE838066B;
 Tue,  1 Sep 2020 09:08:28 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1598965708;
 bh=vCsC+fsC6Oj6sCbFY7J68aziATNxlHsuD92XEGJ7Kk8=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=MOdY9wIn6pYv5iVb/L1hP/mZQBX0AnBnDLdLc/bHrvN0Q5ZEhMlfMRBxFDowNC1oh
 xs95F1UiZrlgmofbfBTkssr98Ap9rp6aZBFoRnb39MVgTO5KgJpfeMOnICU1+Ot/SX
 i1ExpiD63InPGe4+M021Qyw81t0weXi1/K6N8ObApMKW71PFGHLXv4oa7e9FjCxLaW
 rydAC/pfJNCFLhUthg/77HxooeSYcIcoeoSccGiODQxskNxOX7pjJbMm6o7/G1qzNw
 RbFDyIh7EysixH7I7osKxGQ2FjOF1Q3R4zmszFK9aNeqTtvTQLK+UYxvtnIYusBFLZ
 oG1+Byf4ua/qw==
Received: from alfajor (unknown [45.72.232.131])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8A0A81202FB;
 Tue,  1 Sep 2020 09:08:28 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Gregory Heytings <ghe@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
Message-ID: <jwv5z8xsl4u.fsf-monnier+emacs@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
 <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
 <87mu2d7hka.fsf@HIDDEN> <jwvv9h11mtb.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008291808310453.23004@HIDDEN>
 <jwveeno23j8.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008302320550453.28913@HIDDEN>
 <jwvh7sirwcu.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2009011003160453.3798@HIDDEN>
 <B552D4AE-EC7A-4841-98BF-88C1C6EE8762@HIDDEN>
 <alpine.NEB.2.22.394.2009011326140453.22465@HIDDEN>
Date: Tue, 01 Sep 2020 09:08:28 -0400
In-Reply-To: <alpine.NEB.2.22.394.2009011326140453.22465@HIDDEN>
 (Gregory Heytings's message of "Tue, 1 Sep 2020 13:50:16 +0200
 (CEST)")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.061 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41423
Cc: Michael Albinus <michael.albinus@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
 rrandresf@HIDDEN, Tim Vaughan <timv@HIDDEN>, 41423 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> This will print:
>
> calling pcomplete-completions-at-point
> returning from pcomplete-completions-at-point, call took 0.00 seconds
> calling pcomplete-completions-at-point
> returning from pcomplete-completions-at-point, call took 0.00 seconds
> calling pcomplete-completions-at-point
> returning from pcomplete-completions-at-point, call took N seconds
[...]
> Note again that this third call to pcomplete-completions-at-point does
> nothing useful.  It just build a list of all possible commands, and throws
> it away.

Exactly.

And the fix is to make this third call return in 0.00 seconds like the
others by making it return not the list of commands but a mere function
(which will return that list of commands only when called, but in the
present case it won't be called).


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 1 Sep 2020 13:04:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 01 09:04:37 2020
Received: from localhost ([127.0.0.1]:55353 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kD5xl-0006xF-Ik
	for submit <at> debbugs.gnu.org; Tue, 01 Sep 2020 09:04:37 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:64615)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1kD5xj-0006x2-SX
 for 41423 <at> debbugs.gnu.org; Tue, 01 Sep 2020 09:04:36 -0400
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 3465910022F;
 Tue,  1 Sep 2020 09:04:30 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 55C7C100019;
 Tue,  1 Sep 2020 09:04:28 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1598965468;
 bh=QidgmSLKF0f6mS+hnLKWuHKoRzS+WJOFW29KiUcmC7E=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=o5jg89gh2jjZv9n4Swl6E9+vPSywWTMgACVwXX5XEwqo0ly8OLMGNrPkrEATUAtYF
 dUyAUFCx80VlV+LqvzjL+4hE+Q1vtK1v1Yky0w62/J8rLXmpjYoiu7jvFSro1SoSpo
 50Wzzy8DHL8Cjg6IFNEjb+Vrge0JWxWhQ5PJnTF2dqvaNiWRbM7O+70HpE4mGx1dis
 jeJ4qlaVZE1myaDn4zFYrn1cfx1WkLqJoI2X0hu4W66KiW4GR7v3W/HhKjtKlfe/8T
 yGzQUe4WRla0lHgJ28bG1cg/NCPnke/XgP7t8PqGWxewWL8dveak1+2OGvNWrus7iW
 Ayh7JmdNZe45w==
Received: from alfajor (unknown [45.72.232.131])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0DD74120314;
 Tue,  1 Sep 2020 09:04:28 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Gregory Heytings <ghe@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
Message-ID: <jwvblipsltb.fsf-monnier+emacs@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
 <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
 <87mu2d7hka.fsf@HIDDEN> <jwvv9h11mtb.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008291808310453.23004@HIDDEN>
 <jwveeno23j8.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008302320550453.28913@HIDDEN>
 <jwvh7sirwcu.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2009011003160453.3798@HIDDEN>
Date: Tue, 01 Sep 2020 09:04:27 -0400
In-Reply-To: <alpine.NEB.2.22.394.2009011003160453.3798@HIDDEN>
 (Gregory Heytings's message of "Tue, 1 Sep 2020 10:31:14 +0200
 (CEST)")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.055 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41423
Cc: Tim Vaughan <timv@HIDDEN>, rrandresf@HIDDEN,
 Michael Albinus <michael.albinus@HIDDEN>, 41423 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> `eshell-complete-commands-list` eagerly builds the list of possible
>> candidates and it takes a while whereas we should here return something
>> quickly and cheaply, e.g. by returning a function which will build and
>> return this list more lazily when completion is actually performed.
> No, the bug is in the completion mechanism, not in eshell.  I don't know
> exactly (because the mechanism is so complicated) where the completion
> functions should be fixed, but it is clear that there is no reason to call
> pcomplete-completions-at-point *three* times.

The reason why it does so, is that it wants to know when a "completion
session" terminates, e.g. to hide the *Completions* buffer or to run the
exit-function.

So it calls it:

- once to do the actual completion.
- once per command in post-command-hook to see if we're done.

Since in your example you have 2 commands (TAB and RET), that gives you
a total of 3.  This design relies on the fact that completion tables can
be lazy, so it should always be possible to make the
completion-at-point-function very cheap and harmless, so it's OK to call
it repeatedly (or even needlessly).

> There is no reason to call pcomplete-completions-at-point when RET
> is pressed.

If running that function is costly, it's a bug.

That's how completion-at-point-functions was designed.

If you want to change that design, be my guest, but it likely implies
changes to a fair bit of code, including outside Emacs.

>> Of course, the slowdown will presumably still be seen when you do actually
>> want to complete a command name, so we should probably try and figure out
>> more precisely where the slowdown comes from and how to avoid/reduce it.
> That's another, separate issue, and it is not relevant here.

Agreed.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 1 Sep 2020 11:50:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 01 07:50:50 2020
Received: from localhost ([127.0.0.1]:55297 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kD4oM-0005Dz-2r
	for submit <at> debbugs.gnu.org; Tue, 01 Sep 2020 07:50:50 -0400
Received: from mx.sdf.org ([205.166.94.24]:65405)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ghe@HIDDEN>) id 1kD4oK-0005Dk-3O
 for 41423 <at> debbugs.gnu.org; Tue, 01 Sep 2020 07:50:49 -0400
Received: from sdf.org (IDENT:ghe@HIDDEN [205.166.94.9])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 081BoKnu005863
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Tue, 1 Sep 2020 11:50:21 GMT
Received: (from ghe@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 081BoSpC026843;
 Tue, 1 Sep 2020 11:50:28 GMT
Date: Tue, 1 Sep 2020 13:50:16 +0200 (CEST)
From: Gregory Heytings <ghe@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
In-Reply-To: <B552D4AE-EC7A-4841-98BF-88C1C6EE8762@HIDDEN>
Message-ID: <alpine.NEB.2.22.394.2009011326140453.22465@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
 <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
 <87mu2d7hka.fsf@HIDDEN> <jwvv9h11mtb.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008291808310453.23004@HIDDEN>
 <jwveeno23j8.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008302320550453.28913@HIDDEN>
 <jwvh7sirwcu.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2009011003160453.3798@HIDDEN>
 <B552D4AE-EC7A-4841-98BF-88C1C6EE8762@HIDDEN>
User-Agent: Alpine 2.22 (NEB 394 2020-01-19)
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 41423
Cc: Tim Vaughan <timv@HIDDEN>, 41423 <at> debbugs.gnu.org,
 "Gregory Heytings via Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>,
 rrandresf@HIDDEN, Michael Albinus <michael.albinus@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


>
> Would it help to profile the completion process in this use case using 
> the built-in Lisp profiler?
>

No, because the bug is not about cpu or mem usage, but about doing 
something useless that just takes time (without eating much resources).

A much better way to profile this is to use:

(defvar pcomplete-completions-at-point-time 0)
(defun around-pcomplete-completions-at-point (fun)
   (message "calling pcomplete-completions-at-point")
   (setq pcomplete-completions-at-point-time (float-time))
   (let ((ret (funcall fun)))
     (message "returning from pcomplete-completions-at-point, call took %.2f seconds" (- (float-time) pcomplete-completions-at-point-time))
     ret))
(advice-add 'pcomplete-completions-at-point :around #'around-pcomplete-completions-at-point)

(let ((default-directory "/ssh:user@host:~/")) (eshell))

This will print:

calling pcomplete-completions-at-point
returning from pcomplete-completions-at-point, call took 0.00 seconds
calling pcomplete-completions-at-point
returning from pcomplete-completions-at-point, call took 0.00 seconds
calling pcomplete-completions-at-point
returning from pcomplete-completions-at-point, call took N seconds

The value of N depends on the speed of your connection.  On a fast 
connection it will be something around 50, on a slower one something 
around 100.  With a local directory (that is, without let-binding 
default-directory before entering eshell) it depends on your machine.  On 
a fast one it will be something around 0.10, on a slower one something 
around 0.50.

Note again that this third call to pcomplete-completions-at-point does 
nothing useful.  It just build a list of all possible commands, and throws 
it away.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Sep 2020 11:50:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 01 07:50:50 2020
Received: from localhost ([127.0.0.1]:55295 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kD4oL-0005Dx-Qr
	for submit <at> debbugs.gnu.org; Tue, 01 Sep 2020 07:50:50 -0400
Received: from lists.gnu.org ([209.51.188.17]:34280)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ghe@HIDDEN>) id 1kD4oI-0005Di-7p
 for submit <at> debbugs.gnu.org; Tue, 01 Sep 2020 07:50:48 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:47082)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ghe@HIDDEN>) id 1kD4oH-0001JN-UO
 for bug-gnu-emacs@HIDDEN; Tue, 01 Sep 2020 07:50:45 -0400
Received: from mx.sdf.org ([205.166.94.24]:65411)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ghe@HIDDEN>)
 id 1kD4oF-0002V7-PY; Tue, 01 Sep 2020 07:50:45 -0400
Received: from sdf.org (IDENT:ghe@HIDDEN [205.166.94.9])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 081BoKnu005863
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Tue, 1 Sep 2020 11:50:21 GMT
Received: (from ghe@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 081BoSpC026843;
 Tue, 1 Sep 2020 11:50:28 GMT
Date: Tue, 1 Sep 2020 13:50:16 +0200 (CEST)
From: Gregory Heytings <ghe@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
In-Reply-To: <B552D4AE-EC7A-4841-98BF-88C1C6EE8762@HIDDEN>
Message-ID: <alpine.NEB.2.22.394.2009011326140453.22465@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
 <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
 <87mu2d7hka.fsf@HIDDEN> <jwvv9h11mtb.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008291808310453.23004@HIDDEN>
 <jwveeno23j8.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008302320550453.28913@HIDDEN>
 <jwvh7sirwcu.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2009011003160453.3798@HIDDEN>
 <B552D4AE-EC7A-4841-98BF-88C1C6EE8762@HIDDEN>
User-Agent: Alpine 2.22 (NEB 394 2020-01-19)
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
Received-SPF: pass client-ip=205.166.94.24; envelope-from=ghe@HIDDEN;
 helo=mx.sdf.org
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/01 07:50:39
X-ACL-Warn: Detected OS   = ???
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
Cc: Tim Vaughan <timv@HIDDEN>, 41423 <at> debbugs.gnu.org,
 "Gregory Heytings via Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>,
 rrandresf@HIDDEN, Michael Albinus <michael.albinus@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)


>
> Would it help to profile the completion process in this use case using 
> the built-in Lisp profiler?
>

No, because the bug is not about cpu or mem usage, but about doing 
something useless that just takes time (without eating much resources).

A much better way to profile this is to use:

(defvar pcomplete-completions-at-point-time 0)
(defun around-pcomplete-completions-at-point (fun)
   (message "calling pcomplete-completions-at-point")
   (setq pcomplete-completions-at-point-time (float-time))
   (let ((ret (funcall fun)))
     (message "returning from pcomplete-completions-at-point, call took %.2f seconds" (- (float-time) pcomplete-completions-at-point-time))
     ret))
(advice-add 'pcomplete-completions-at-point :around #'around-pcomplete-completions-at-point)

(let ((default-directory "/ssh:user@host:~/")) (eshell))

This will print:

calling pcomplete-completions-at-point
returning from pcomplete-completions-at-point, call took 0.00 seconds
calling pcomplete-completions-at-point
returning from pcomplete-completions-at-point, call took 0.00 seconds
calling pcomplete-completions-at-point
returning from pcomplete-completions-at-point, call took N seconds

The value of N depends on the speed of your connection.  On a fast 
connection it will be something around 50, on a slower one something 
around 100.  With a local directory (that is, without let-binding 
default-directory before entering eshell) it depends on your machine.  On 
a fast one it will be something around 0.10, on a slower one something 
around 0.50.

Note again that this third call to pcomplete-completions-at-point does 
nothing useful.  It just build a list of all possible commands, and throws 
it away.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 1 Sep 2020 10:14:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 01 06:14:44 2020
Received: from localhost ([127.0.0.1]:55141 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kD3JM-0004dU-Cv
	for submit <at> debbugs.gnu.org; Tue, 01 Sep 2020 06:14:44 -0400
Received: from eggs.gnu.org ([209.51.188.92]:39264)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1kD3JL-0004d6-Ex
 for 41423 <at> debbugs.gnu.org; Tue, 01 Sep 2020 06:14:43 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:48266)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1kD3JF-0006Rg-Ri; Tue, 01 Sep 2020 06:14:37 -0400
Received: from [2a02:14f:1ff:9ae7::8cee:a9f] (port=51636)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1kD3JE-0000pk-KD; Tue, 01 Sep 2020 06:14:37 -0400
Date: Tue, 01 Sep 2020 13:14:33 +0300
User-Agent: K-9 Mail for Android
In-Reply-To: <alpine.NEB.2.22.394.2009011003160453.3798@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
 <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
 <87mu2d7hka.fsf@HIDDEN> <jwvv9h11mtb.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008291808310453.23004@HIDDEN>
 <jwveeno23j8.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008302320550453.28913@HIDDEN>
 <jwvh7sirwcu.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2009011003160453.3798@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable
Subject: Re: bug#41423: 27.0.91;
 eshell file completion in tramp dir is slow (3 minutes) [regression
 on pretest]
To: Gregory Heytings <ghe@HIDDEN>,
 "Gregory Heytings via Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
Message-ID: <B552D4AE-EC7A-4841-98BF-88C1C6EE8762@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41423
Cc: Michael Albinus <michael.albinus@HIDDEN>, rrandresf@HIDDEN,
 Tim Vaughan <timv@HIDDEN>, 41423 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

On September 1, 2020 11:31:14 AM GMT+03:00, "Gregory Heytings via Bug repor=
ts for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu=
=2Eorg> wrote:
>
>>
>>> 26=2E therefore pcomplete-completions does not call pcomplete/cd but=
=20
>>> eshell-complete-commands-list
>>
>> I guess this is the culprit
>>
>
>No, see below=2E
>
>>
>> and this is where the time is spent=2E
>>
>
>Yes, this is what I said=2E
>
>>
>> `eshell-complete-commands-list` eagerly builds the list of possible=20
>> candidates and it takes a while whereas we should here return
>something=20
>> quickly and cheaply, e=2Eg=2E by returning a function which will build
>and=20
>> return this list more lazily when completion is actually performed=2E
>>
>
>No, the bug is in the completion mechanism, not in eshell=2E  I don't
>know=20
>exactly (because the mechanism is so complicated) where the completion=20
>functions should be fixed, but it is clear that there is no reason to
>call=20
>pcomplete-completions-at-point *three* times=2E

Would it help to profile the completion process in this use case using the=
 built-in Lisp profiler?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Sep 2020 10:14:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 01 06:14:41 2020
Received: from localhost ([127.0.0.1]:55138 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kD3JJ-0004dF-4z
	for submit <at> debbugs.gnu.org; Tue, 01 Sep 2020 06:14:41 -0400
Received: from lists.gnu.org ([209.51.188.17]:35214)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1kD3JG-0004d7-N3
 for submit <at> debbugs.gnu.org; Tue, 01 Sep 2020 06:14:40 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49366)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1kD3JG-0007Id-Hj
 for bug-gnu-emacs@HIDDEN; Tue, 01 Sep 2020 06:14:38 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:48266)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1kD3JF-0006Rg-Ri; Tue, 01 Sep 2020 06:14:37 -0400
Received: from [2a02:14f:1ff:9ae7::8cee:a9f] (port=51636)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1kD3JE-0000pk-KD; Tue, 01 Sep 2020 06:14:37 -0400
Date: Tue, 01 Sep 2020 13:14:33 +0300
User-Agent: K-9 Mail for Android
In-Reply-To: <alpine.NEB.2.22.394.2009011003160453.3798@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
 <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
 <87mu2d7hka.fsf@HIDDEN> <jwvv9h11mtb.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008291808310453.23004@HIDDEN>
 <jwveeno23j8.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008302320550453.28913@HIDDEN>
 <jwvh7sirwcu.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2009011003160453.3798@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable
Subject: Re: bug#41423: 27.0.91;
 eshell file completion in tramp dir is slow (3 minutes) [regression
 on pretest]
To: Gregory Heytings <ghe@HIDDEN>,
 "Gregory Heytings via Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
Message-ID: <B552D4AE-EC7A-4841-98BF-88C1C6EE8762@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: Michael Albinus <michael.albinus@HIDDEN>, rrandresf@HIDDEN,
 Tim Vaughan <timv@HIDDEN>, 41423 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

On September 1, 2020 11:31:14 AM GMT+03:00, "Gregory Heytings via Bug repor=
ts for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu=
=2Eorg> wrote:
>
>>
>>> 26=2E therefore pcomplete-completions does not call pcomplete/cd but=
=20
>>> eshell-complete-commands-list
>>
>> I guess this is the culprit
>>
>
>No, see below=2E
>
>>
>> and this is where the time is spent=2E
>>
>
>Yes, this is what I said=2E
>
>>
>> `eshell-complete-commands-list` eagerly builds the list of possible=20
>> candidates and it takes a while whereas we should here return
>something=20
>> quickly and cheaply, e=2Eg=2E by returning a function which will build
>and=20
>> return this list more lazily when completion is actually performed=2E
>>
>
>No, the bug is in the completion mechanism, not in eshell=2E  I don't
>know=20
>exactly (because the mechanism is so complicated) where the completion=20
>functions should be fixed, but it is clear that there is no reason to
>call=20
>pcomplete-completions-at-point *three* times=2E

Would it help to profile the completion process in this use case using the=
 built-in Lisp profiler?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 1 Sep 2020 08:31:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 01 04:31:24 2020
Received: from localhost ([127.0.0.1]:54833 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kD1hM-0008CP-8C
	for submit <at> debbugs.gnu.org; Tue, 01 Sep 2020 04:31:24 -0400
Received: from mx.sdf.org ([205.166.94.24]:63039)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ghe@HIDDEN>) id 1kD1hI-0008CE-JH
 for 41423 <at> debbugs.gnu.org; Tue, 01 Sep 2020 04:31:23 -0400
Received: from sdf.org (IDENT:ghe@HIDDEN [205.166.94.9])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 0818VJ0c000064
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Tue, 1 Sep 2020 08:31:19 GMT
Received: (from ghe@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 0818VRh1003820;
 Tue, 1 Sep 2020 08:31:27 GMT
Date: Tue, 1 Sep 2020 10:31:14 +0200 (CEST)
From: Gregory Heytings <ghe@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
In-Reply-To: <jwvh7sirwcu.fsf-monnier+emacs@HIDDEN>
Message-ID: <alpine.NEB.2.22.394.2009011003160453.3798@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
 <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
 <87mu2d7hka.fsf@HIDDEN> <jwvv9h11mtb.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008291808310453.23004@HIDDEN>
 <jwveeno23j8.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008302320550453.28913@HIDDEN>
 <jwvh7sirwcu.fsf-monnier+emacs@HIDDEN>
User-Agent: Alpine 2.22 (NEB 394 2020-01-19)
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 41423
Cc: Tim Vaughan <timv@HIDDEN>, rrandresf@HIDDEN,
 Michael Albinus <michael.albinus@HIDDEN>, 41423 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


>
>> 26. therefore pcomplete-completions does not call pcomplete/cd but 
>> eshell-complete-commands-list
>
> I guess this is the culprit
>

No, see below.

>
> and this is where the time is spent.
>

Yes, this is what I said.

>
> `eshell-complete-commands-list` eagerly builds the list of possible 
> candidates and it takes a while whereas we should here return something 
> quickly and cheaply, e.g. by returning a function which will build and 
> return this list more lazily when completion is actually performed.
>

No, the bug is in the completion mechanism, not in eshell.  I don't know 
exactly (because the mechanism is so complicated) where the completion 
functions should be fixed, but it is clear that there is no reason to call 
pcomplete-completions-at-point *three* times.

There is no reason to call pcomplete-completions-at-point when RET is 
pressed.

Typing "cd foo/ RET" does not call pcomplete-completions-at-point. 
Typing "cd foo TAB RET" should only call pcomplete-completions-at-point to 
add the trailing slash, and should not build a list of all possible 
commands.

>
> Of course, the slowdown will presumably still be seen when you do 
> actually want to complete a command name, so we should probably try and 
> figure out more precisely where the slowdown comes from and how to 
> avoid/reduce it.
>

That's another, separate issue, and it is not relevant here.  BTW, when 
you want to complete a command name, at least you have some characters in 
the prefix (or if you don't, you expect that listing all candidates will 
be slow).

Typing "cd TAB" works almost instantaneously (and prints "Sole 
completion"), even on a remote host.  Typing "ls TAB" works almost 
instantaneously, too, even on a remote host.  It prints "Complete, but not 
unique", and pressing TAB again lists the alternate completion candidates. 
Typing "l TAB" takes (on a remote host) five to ten seconds before 
printing all completion candidates, but again this is what a user expects.

Nobody expects that typing RET, when the completion has already been done, 
would take three minutes.

>
> Maybe `tramp-eshell-directory-change` should tell 
> `eshell-complete-commands-list` to cache the list and also not to bother 
> checking `file-executable-p`?
>

That's yet another, separate issue, that is not relevant here.  Indeed 
there are possible improvements in eshell and tramp, but this bug is in 
the completion mechanism, not in eshell or in tramp.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 1 Sep 2020 04:24:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 01 00:24:13 2020
Received: from localhost ([127.0.0.1]:54490 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kCxq9-00083H-Bv
	for submit <at> debbugs.gnu.org; Tue, 01 Sep 2020 00:24:13 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:19310)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1kCxq6-000832-Mx
 for 41423 <at> debbugs.gnu.org; Tue, 01 Sep 2020 00:24:11 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 0FFAB80712;
 Tue,  1 Sep 2020 00:24:05 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 32D1680513;
 Tue,  1 Sep 2020 00:24:03 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1598934243;
 bh=7FjurgGv+xAhtzaP7RQ9XaOUHzo2/4PfbsMbKJnomIs=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=QmZSYL2ZKuJ5m9ipqtZrlqRII4difdroaAXJUrwxbXj9hZX5WGK+icOshkiSna4yQ
 iPrB4/nalylur1zkCjkyjTDRoPkCQuE5+3S1AgBtZn+aUagQOJB9TJuB121VqsJxLq
 5Gd9LCfyXSlmbM6GoepmeVEGSvCLF8cUBa0QwiJOkfqyte+9YTTfGpk8Jc1CLWQYD+
 JceIqt37w3G0LIP2ZAU7i//uZJhB5UuTnKvS0SuROS6utrVVBZ35H8TmKppZHWG7mE
 kZNtOrpaUuWnKuGBP14lfR9XdTo+JuvbSV6/zTjOa7E8wK8VlT3G4RxTIEWGpuudo5
 Z5wIBsfBiotHA==
Received: from alfajor (unknown [45.72.232.131])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E89BB1202FB;
 Tue,  1 Sep 2020 00:24:02 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Gregory Heytings <ghe@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
Message-ID: <jwvh7sirwcu.fsf-monnier+emacs@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
 <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
 <87mu2d7hka.fsf@HIDDEN> <jwvv9h11mtb.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008291808310453.23004@HIDDEN>
 <jwveeno23j8.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008302320550453.28913@HIDDEN>
Date: Tue, 01 Sep 2020 00:23:54 -0400
In-Reply-To: <alpine.NEB.2.22.394.2008302320550453.28913@HIDDEN>
 (Gregory Heytings's message of "Sun, 30 Aug 2020 22:28:01 +0000")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.061 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41423
Cc: Tim Vaughan <timv@HIDDEN>, rrandresf@HIDDEN,
 Michael Albinus <michael.albinus@HIDDEN>, 41423 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> I do not understand why I should explain to you how the code you wrote
> works.

[ Because I remember ow it's supposed to work, but I don't know how it
  actually behaves in this specific case.  ]

> 19. given that the value of the start position did not change, the lambda
>     let-bound at step 8 returns t, and therefore completion-in-region--postch
>     does not exit completion-in-region-mode
> 20. completion-in-region--postch is now finished, it did not change
>     anything in the eshell buffer
> 21. RET is pressed
> 22. post-command-hook is executed, and still contains
>     completion-in-region--postch, so it is called again
> 23. completion-in-region--postch calls completion-in-region-mode-predicate
> 24. this calls pcomplete-completions-at-point a third time, which calls
>     pcomplete-completions

Looks OK so far.

> 25. for some reason, pcomplete-completions considers that it must now
>     complete a command name and not a directory name

I guess this is because after RET we're now at BOL so it looks like
a brand new command is starting.

> 26. therefore pcomplete-completions does not call pcomplete/cd but
>     eshell-complete-commands-list

I guess this is the culprit and this is where the time is spent.

`eshell-complete-commands-list` eagerly builds the list of possible
candidates and it takes a while whereas we should here return something
quickly and cheaply, e.g. by returning a function which will build and
return this list more lazily when completion is actually performed.

Of course, the slowdown will presumably still be seen when you do
actually want to complete a command name, so we should probably try and
figure out more precisely where the slowdown comes from and how to
avoid/reduce it.

I guess part of the slowdown comes from the fact that we don't just use
`file-name-all-completions` in each directory in PATH but we
additionally call `file-executable-p` (or `file-readable-p`) on every
command found, which I expect will take quite a while when it goes
through Tramp.

Still, I'm not completely sure where the time is spent because I'm not
sure which files/dirs will go through tramp.  AFAICT, `eshell-get-path`
will return the "local" $PATH rather than that of the remote host ... oh
wait, no I see that `tramp-eshell-directory-change` will set that to the
remote host's $PATH, so it should indeed work correctly (but slowly).

Maybe `tramp-eshell-directory-change` should tell
`eshell-complete-commands-list` to cache the list and also not to bother
checking `file-executable-p`?

> And the last steps should be:
>
> 29. when eshell-complete-commands-list has finished its job,
> pcomplete-completions-at-point returns a value in which the start position
> has changed
> 30. therefore the lambda let-bound at step 8 returns nil, and therefore
> completion-in-region--postch exits completion-in-region-mode entered at step
> 10
> 31. this removes completion-in-region--postch from post-command-hook
> 32. eshell finally prints its next prompt

Yes, these steps look fine.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 31 Aug 2020 08:30:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 31 04:30:09 2020
Received: from localhost ([127.0.0.1]:51513 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kCfCb-0003BT-7D
	for submit <at> debbugs.gnu.org; Mon, 31 Aug 2020 04:30:09 -0400
Received: from mx.sdf.org ([205.166.94.24]:55035)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ghe@HIDDEN>) id 1kCfCZ-0003Al-Gh
 for 41423 <at> debbugs.gnu.org; Mon, 31 Aug 2020 04:30:08 -0400
Received: from sdf.org (IDENT:ghe@HIDDEN [205.166.94.9])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 07V8U62u025342
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Mon, 31 Aug 2020 08:30:06 GMT
Received: (from ghe@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 07V8UCMI018223;
 Mon, 31 Aug 2020 08:30:12 GMT
Date: Mon, 31 Aug 2020 08:30:03 +0000
From: Gregory Heytings <ghe@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
In-Reply-To: <alpine.NEB.2.22.394.2008302320550453.28913@HIDDEN>
Message-ID: <alpine.NEB.2.22.394.2008311015210453.3060@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
 <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
 <87mu2d7hka.fsf@HIDDEN> <jwvv9h11mtb.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008291808310453.23004@HIDDEN>
 <jwveeno23j8.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008302320550453.28913@HIDDEN>
User-Agent: Alpine 2.22 (NEB 394 2020-01-19)
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 41423
Cc: Tim Vaughan <timv@HIDDEN>, rrandresf@HIDDEN,
 Michael Albinus <michael.albinus@HIDDEN>, 41423 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Two corrections:

Step 19 should be:

19. given that the value of the start position did not change, the lambda let-bound at step 8 returns t, and therefore completion-in-region--postch does not exit completion-in-region-mode

And the last steps should be:

29. when eshell-complete-commands-list has finished its job, pcomplete-completions-at-point returns a value in which the start position has changed
30. therefore the lambda let-bound at step 8 returns nil, and therefore completion-in-region--postch exits completion-in-region-mode entered at step 10
31. this removes completion-in-region--postch from post-command-hook
32. eshell finally prints its next prompt




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 30 Aug 2020 22:28:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 30 18:28:08 2020
Received: from localhost ([127.0.0.1]:50932 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kCVnz-0000qL-P4
	for submit <at> debbugs.gnu.org; Sun, 30 Aug 2020 18:28:08 -0400
Received: from mx.sdf.org ([205.166.94.24]:57328)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ghe@HIDDEN>) id 1kCVny-0000qE-M3
 for 41423 <at> debbugs.gnu.org; Sun, 30 Aug 2020 18:28:07 -0400
Received: from sdf.org (IDENT:ghe@HIDDEN [205.166.94.9])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 07UMS5Dw014957
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Sun, 30 Aug 2020 22:28:05 GMT
Received: (from ghe@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 07UMSB48002619;
 Sun, 30 Aug 2020 22:28:11 GMT
Date: Sun, 30 Aug 2020 22:28:01 +0000
From: Gregory Heytings <ghe@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
In-Reply-To: <jwveeno23j8.fsf-monnier+emacs@HIDDEN>
Message-ID: <alpine.NEB.2.22.394.2008302320550453.28913@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
 <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
 <87mu2d7hka.fsf@HIDDEN> <jwvv9h11mtb.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008291808310453.23004@HIDDEN>
 <jwveeno23j8.fsf-monnier+emacs@HIDDEN>
User-Agent: Alpine 2.22 (NEB 394 2020-01-19)
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 41423
Cc: Tim Vaughan <timv@HIDDEN>, rrandresf@HIDDEN,
 Michael Albinus <michael.albinus@HIDDEN>, 41423 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


>
> Hmm... any hope you could refine your description accordingly?
>

I do not understand why I should explain to you how the code you wrote 
works.  Anyway, here we go (and I fear you will now tell me that my 
description is now too refined):

1. start emacs -Q
2. in an eshell buffer, type "<command> <first letters of a directory name> TAB" (command can be "cd", "ls", "rm", ...)
3. TAB calls completion-at-point
4. completion-at-point looks at completion-at-point-functions, whose value is (pcomplete-completions-at-point t), and calls pcomplete-completions-at-point
5. pcomplete-completions-at-point calls pcomplete-completions, which calls pcomplete/cd, which calls pcomplete--here, ...
6. pcomplete-completions returns a collection of completion candidates, and pcomplete-completions-at-point returns that collection together with a function pointer (to pcomplete-completions-at-point itself), a start position, an end position, and a property list
7. we are now back in completion-at-point, and enter the second case in its pcase
8. completion-at-point let-binds completion-in-region-mode-predicate to a lambda, which calls pcomplete-completion-at-point
9. completion-at-point then calls completion-in-region, which calls completion--in-region
10. completion--in-region enters completion-in-region-mode, which adds completion-in-region--postch to post-command-hook
11. completion--in-region calls completion--in-region-1, which calls completion--do-completion, which finally does the actual completion based on the collection of completion candidates returned at step 6
12. at this point the eshell buffer contains the completed directory name, with a trailing slash
13. completion-at-point is now finished, and post-command-hook is executed
14. post-command-hook calls completion-in-region--postch
15. completion-in-region--postch calls completion-in-region-mode-predicate (in fact, completion-in-region-mode--predicate which has been set to completion-in-region-mode-predicate when entering completion-in-region-mode at step 10)
16. this calls pcomplete-completions-at-point a second time, which calls pcomplete-completions, which calls pcomplete/cd, which calls pcomplete--here, ...
17. pcomplete/cd and pcomplete-completions return the exact same values as in step 6
18. pcomplete-completions-at-point returns almost the same value as in step 6 (the only difference is the value of the end position)
19. given that the value of the start position did not change, the lambda let-bound at step 8 returns t, and therefore completion-in-region--postch exits completion-in-region-mode entered at step 10
20. completion-in-region--postch is now finished, it did not change anything in the eshell buffer
21. RET is pressed
22. post-command-hook is executed, and still contains completion-in-region--postch, so it is called again
23. completion-in-region--postch calls completion-in-region-mode-predicate
24. this calls pcomplete-completions-at-point a third time, which calls pcomplete-completions
25. for some reason, pcomplete-completions considers that it must now complete a command name and not a directory name
26. therefore pcomplete-completions does not call pcomplete/cd but eshell-complete-commands-list
27. eshell-complete-commands-list loops through all possible command names 
28. if these command names had a common prefix, it would have been inserted in the eshell buffer (?), but this is not the case, so the effect of this loop (apart from a waste of time) is nil
29. when eshell-complete-commands-list has finished its job, eshell prints its next prompt

At step 27 it is possible to interrupt the loop with C-g.  At step 21 it 
is possible to remove completion-in-region--postch from post-command-hook, 
for example by switching buffers with C-x C-b.

>
> Calling `pcomplete-completions-at-point` several times is not 
> necessarily a problem.  E.g. it's normal to call it a second time after 
> completion to check whether we're still in the same completion area (in 
> order to detect when completion is "finished").
>

For some general case , I don't know (I admit I can't think of a case in 
which this would be useful, but I know my experience is limited).  To 
complete a directory name in a shell, I don't see why this should be the 
case.  The (now obsolete) mechanism calls pcomplete (which also calls 
pcomplete/cd) a single time, and it worked.  I don't see what steps 13-29 
could possibly do that would be useful, at least in the context of a 
shell.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 30 Aug 2020 03:55:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 29 23:55:16 2020
Received: from localhost ([127.0.0.1]:49353 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kCER1-0007ab-Ue
	for submit <at> debbugs.gnu.org; Sat, 29 Aug 2020 23:55:16 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:20327)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1kCER0-0007aP-Sc
 for 41423 <at> debbugs.gnu.org; Sat, 29 Aug 2020 23:55:15 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 51468809C0;
 Sat, 29 Aug 2020 23:55:09 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 87FA380855;
 Sat, 29 Aug 2020 23:55:07 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1598759707;
 bh=OEUyx7UZASVoTjFTxToe+cVgX/XLB/rSIT0U4zK+3PU=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=U1Zjjc6I/uWI2CUbiNSptGRBI3ZtZgwcn9qV4OZriFJDcUzCarEe3Kq52LNI0L5nn
 OFXfC8/efd+zCAVWwIN9hDNeWlbGMqF3S0732xGlDWD6DHYVcEI+Ymc+BN5AR5Dvic
 bM+OSjZ9NWcovRWNFjxJ5LBG3dsqKTjhvzUOoF+QerlLZWMBwuGJcvy2mZHmcdRj8P
 K+PUL8GpRabxJ/nhbTBTNUqj+u5pQsyLUUW10Shjx63fcf5UbyBJnWz3nwUm27QnYT
 5e8mNgEDa5K5NMjQTZ9AtcgW/HSUkT+1aNIUPtrJLLKVy4EQdtyW16pbIcvGhdvoHW
 pYN0bRn7VgLMg==
Received: from alfajor (unknown [45.72.232.131])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3621A120397;
 Sat, 29 Aug 2020 23:55:07 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Gregory Heytings <ghe@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
Message-ID: <jwveeno23j8.fsf-monnier+emacs@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
 <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
 <87mu2d7hka.fsf@HIDDEN> <jwvv9h11mtb.fsf-monnier+emacs@HIDDEN>
 <alpine.NEB.2.22.394.2008291808310453.23004@HIDDEN>
Date: Sat, 29 Aug 2020 23:55:05 -0400
In-Reply-To: <alpine.NEB.2.22.394.2008291808310453.23004@HIDDEN>
 (Gregory Heytings's message of "Sat, 29 Aug 2020 16:12:15 +0000")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.061 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41423
Cc: Tim Vaughan <timv@HIDDEN>, rrandresf@HIDDEN,
 Michael Albinus <michael.albinus@HIDDEN>, 41423 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Please don't take my words too literally.  "This completes the directory
> name" does not mean that `pcomplete/cd' performs the completion
> itself.  Indeed it returns something with which the completion is performed.

Hmm... any hope you could refine your description accordingly?

> The bug is clearly not there (at step 2), but later (in the fact that
> `completion-at-point' calls `pcomplete-completions-at-point' three times).

Calling `pcomplete-completions-at-point` several times is not
necessarily a problem.  E.g. it's normal to call it a second time after
completion to check whether we're still in the same completion area (in
order to detect when completion is "finished").


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 29 Aug 2020 17:28:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 29 13:28:43 2020
Received: from localhost ([127.0.0.1]:49069 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kC4eh-0001P3-Is
	for submit <at> debbugs.gnu.org; Sat, 29 Aug 2020 13:28:43 -0400
Received: from mout.gmx.net ([212.227.17.20]:57979)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1kC4ec-0001Ol-0D
 for 41423 <at> debbugs.gnu.org; Sat, 29 Aug 2020 13:28:42 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1598722103;
 bh=8EjOZSQU/mUQ2T0mDajJUD/WeB2eT3rWVi6AqT+H0Mw=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=T/TOPlJZWCFQdFHdEjnnu6+EqStNgHJsdO7IzhbANKzn4J9tM2LbYOIsMpVtyVhbY
 3aRZXfeKTlHzgBlg2w7cFhl20iIJ1yXdbwURZYDfSEnxquM0/6W6djRio/2DGoL4HG
 eg+YWLokOcsNFzODD9Z4tYSp4FyuO7IZwYQr0TbI=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([212.86.51.69]) by mail.gmx.com (mrgmx104
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MdefJ-1klPXD4C5x-00ZfnK; Sat, 29
 Aug 2020 19:28:23 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
To: Gregory Heytings <ghe@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
References: <alpine.NEB.2.22.394.2008291454180453.301@HIDDEN>
 <87imd175pf.fsf@HIDDEN>
 <alpine.NEB.2.22.394.2008291855400453.27856@HIDDEN>
Date: Sat, 29 Aug 2020 19:28:19 +0200
In-Reply-To: <alpine.NEB.2.22.394.2008291855400453.27856@HIDDEN>
 (Gregory Heytings's message of "Sat, 29 Aug 2020 17:14:04 +0000")
Message-ID: <87a6yd745o.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:ZFerM4wTOYtflTNEXNSjpRwd0bT6GI4omzO/6d7Qvyzle0isqTy
 H9S/4H5u1DFPcCCw0TO7xnSHcWge41tVD4fb0VJiaUKdyM0LxJX/dkdUHZuaZtj4sTA0K4S
 fPdjrml79f3Jx+xwm+7DYqy+pl0+7thdssuTGEePeQLw4ENlnEo9SFP1dGohEMe7ags9rJg
 n0mAX7ZRXLuVpSMsw3zrg==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:hcNkEOGd/5E=:qesqrL/hN0KQQxXBcSCgxc
 251gQnq8XCX1UJXJqgkbWYLUOkp4yJlMsgGYmTTWaVkYMCi0prB8P0ZFXSf3VqLz3KvZ6rFJX
 s/UQM4hl//yAh3Jqq0qEgTS4yYVEFMy2toTVH8gGZY0mtVJbfsobW3pWLSOUjyYzJf59txC+i
 eoAI4VY7fkt1kL6ufMHj/knaRbyXiwck+0/ynmoMmIlwgswdm3db0A63Bw1jpnWr/nIu5t19V
 ZVwpSW86wVx62Ztv1nx1LUFtyLF7h1RPiqjs6L2rjE5ob0kKxcNHQgb5Q4UO3cj2Oi7/enDVP
 mKGBeSuzbw1U1IZf0I0yXI25cBVNjurlSKBDjvrE3dMiSggauj1WAC4s8y1EjD43xhnaKK1pb
 WTqN0lKXqgANmLHow4Iw6y4kbakfh0Cu8NcRqPcQpX97qpm14hSITnxIFjJUlsREihV6BPtFs
 447z3U/Bp2rhZqhHfewqzDOd2hY4DfshsG9g4KTePAKKqDuAgDQiOE04h2p0RUDxVRg0ADh3F
 OTt7suHRofg7lStv401Ky7oAjb2j0fDNX4GXf7huHr0x6UPmFUOC7wua48+TZzkZTIoKt1MJ5
 x1PpuZJZemQkLYiH81yON6n4XiiH5vChaid2cm8LxWMN//B1AxbnN1NTSzKWbYOu+O949VudV
 MqFRWM2JjVNtZ/tWAB94aVMNpce2E2Hat1/VUDyQahmPATlOhug5qOPcnbLvP6p9SleiisxMu
 7qZ1UhYnyXiR64OwE+O64PTjT95gHpuyl6qRi0rz9xQrgqzcJwI39Geylodp3wBlUYo5PUAWV
 C0ctSuPINjIvJfNk9wXE3Zm2r04Ju7CtMtWqeXmJdfnHDRU2aMXRSYXqLwm3Ch+GN43ELh11a
 dXEqiZxfkCIFknPhJa3M/NWlVSW0pKiZWaw7SNn0SkiHS4E7jrBr/XZDUJVPHYNabfeqWYqTR
 MmTVbCb+HlBQnJdaeAZ5oE4svsphBAJC24V9sPoyKWRLu8lrG1Ht04X9sWwNbU/jqkmeXQkOG
 OjQ326hjTSyQa6qcG6eJA6FFXn915m7sPU4+VItYSRVL4fHZeH0+HYUW1EJey/W97kkOcgfxX
 y5ffT97Ml26AL2Rj+BLYPwVlzqfu3szoTebJufLohPD2FoJpf2EPWUzwJ2A1mvnLd4Exs5exZ
 m+1w60FhUl/4CejyiX52NWo2J15cgR2Qwtf0ydRUsNUMsRfHT6WQ0tgkfyyeEtKNncjXd/g2W
 F35Afc5cV1K4PDGQhLEgFIQ0qalB8btjXTzeIIg==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41423
Cc: rrandresf@HIDDEN, Tim Vaughan <timv@HIDDEN>, 41423 <at> debbugs.gnu.org,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Gregory Heytings <ghe@HIDDEN> writes:

> A much better patch at this point is to just restore the previous
> default behavior (in Emacs 26 and earlier) by setting
> completion-at-point-functions to '(pcomplete t) instead of
> '(pcomplete-completions-at-point t), for example with:
>
> (add-hook 'eshell-mode-hook (function (lambda () (setq
> completion-at-point-functions '(pcomplete t)))))
>
> pcomplete is obsolete, but it is still there, and it works.

I guess Stefan had a reason when he applied
047c1b19353ff58d8cd45935c7b44c911b70e312 last year. Let's see his
analysis.

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 29 Aug 2020 17:14:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 29 13:14:10 2020
Received: from localhost ([127.0.0.1]:49061 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kC4Qc-00014c-0x
	for submit <at> debbugs.gnu.org; Sat, 29 Aug 2020 13:14:10 -0400
Received: from mx.sdf.org ([205.166.94.24]:57922)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ghe@HIDDEN>) id 1kC4Qa-00014T-IL
 for 41423 <at> debbugs.gnu.org; Sat, 29 Aug 2020 13:14:09 -0400
Received: from sdf.org (IDENT:ghe@HIDDEN [205.166.94.9])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 07THE7Dv003446
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Sat, 29 Aug 2020 17:14:07 GMT
Received: (from ghe@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 07THE6Bm000802;
 Sat, 29 Aug 2020 17:14:06 GMT
Date: Sat, 29 Aug 2020 17:14:04 +0000
From: Gregory Heytings <ghe@HIDDEN>
To: Michael Albinus <michael.albinus@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
In-Reply-To: <87imd175pf.fsf@HIDDEN>
Message-ID: <alpine.NEB.2.22.394.2008291855400453.27856@HIDDEN>
References: <alpine.NEB.2.22.394.2008291454180453.301@HIDDEN>
 <87imd175pf.fsf@HIDDEN>
User-Agent: Alpine 2.22 (NEB 394 2020-01-19)
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 41423
Cc: rrandresf@HIDDEN, Tim Vaughan <timv@HIDDEN>, 41423 <at> debbugs.gnu.org,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


>
>> I just checked, and see no visible improvement.
>
> The first time you try completion, there's no difference. The cache must 
> be filled. But all next times you complete, it shall be faster for 
> remote directoriues.
>

Yes, this is what I did.  The first time there was no difference.  The 
second time I did not see any difference either, alas.  I just tried it 
again.

>
> I do not claim my patch is the solution. But it shall be useful, if 
> eshell-complete-commands-list is called somewhere.
>

A much better patch at this point is to just restore the previous default 
behavior (in Emacs 26 and earlier) by setting 
completion-at-point-functions to '(pcomplete t) instead of 
'(pcomplete-completions-at-point t), for example with:

(add-hook 'eshell-mode-hook (function (lambda () (setq completion-at-point-functions '(pcomplete t)))))

pcomplete is obsolete, but it is still there, and it works.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 29 Aug 2020 16:55:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 29 12:55:10 2020
Received: from localhost ([127.0.0.1]:49042 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kC48D-0000cH-RJ
	for submit <at> debbugs.gnu.org; Sat, 29 Aug 2020 12:55:10 -0400
Received: from mout.gmx.net ([212.227.15.15]:44849)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1kC48C-0000bz-HQ
 for 41423 <at> debbugs.gnu.org; Sat, 29 Aug 2020 12:55:09 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1598720095;
 bh=jUTlkxu20GkF7iRAaqKrgw3Jj1HQ2mHVFSmIgPdt3so=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=Hjt+KiZJxS6CzirIoGusbQcOKR98Ueudr2ZIY40g/5CErt3/fyjKHi9NfjSw77JCD
 AQAM3NCIL0zD0UXP1Co7OFtGI/+61eZNt4yEh/53iIzHDykszYwiWFvTssgGO7abZS
 FJEiHfpuT4IMKDHp+CwzOwu1rrzJXvkH4GSTh3S0=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([212.86.51.69]) by mail.gmx.com (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MkYXs-1ksJAe39J8-00m0zz; Sat, 29
 Aug 2020 18:54:54 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
To: Gregory Heytings <ghe@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
References: <alpine.NEB.2.22.394.2008291454180453.301@HIDDEN>
Date: Sat, 29 Aug 2020 18:54:52 +0200
In-Reply-To: <alpine.NEB.2.22.394.2008291454180453.301@HIDDEN>
 (Gregory Heytings's message of "Sat, 29 Aug 2020 13:08:55 +0000")
Message-ID: <87imd175pf.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:Qmhnz9I+o5tQkgpDDI/cLjbGU/rCmtuuJbhtKa6IU1D0siPSY0m
 Y8v9TaDliV7x8XZiIxEniNklMO0nc9xxcEPFZyxzWGU/O8S+kFG7EweGBF7S2rU44t3VBW8
 6+z+hLksMi4kVaeNfGpFVadEMkaecL9gZEkMw+GhaLoDlHQioE3PtG6Vk/SpphH83pkbT0Y
 Anr0aaNrXaONspi0slzOw==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:XW2+hs4as6s=:AfotO/7iJ0uyneH/0KIM6D
 +n80/ZewOgI2yRxlW82dht40pOIaNZ5f1LPleGrRGXUbMO5xWgOWxO675SMowisytA0WhnPem
 ACEoetnKrGdMFaH2yaWs3Am6sNA5cIo3Gqw2hI+otg40YkdoRFW22/fitPlVyNw9mWj8gg+Xl
 dx3s+p5LysVUJSyvu7V880exG1Z8QLclGhJpBEVPmVlYHRAJ5gUnpHMXRVERBYX30/2tzjeUe
 ecIB/H1BzQMfcwO0GyfZ5fMijjg8XhqJhCQQYMjtdnyCAO6QJCCEWRaLTs6oh4MUbOagppeV/
 2LGoBp3PClFVp3LLs8POlf2qPQRP67XGGXXUQS8wonfcaHvuDLiIHen6V4QXtjGF0mxfOmkaT
 2CcS9YLyX/byuT/iqpXpAs8Iw+I0+KL0HbpMHI1bnXswH2jYc2MbRVf8p8t8iAfXFq5gzNhBI
 0Fo0e3kg0Ja5AGmP3ppofj/ZjG8JP/f5m8Feyvpf0y3mT5ggDUl/cdf6gqpwG3C40j0UxQyLe
 CkGu+qmlqF1B/gT9bhKCc7CxiGrnwDfs64ijwdFj1U8vxRL4XmFAcz0YZEixbR/g59qRf8X0J
 zy98XP0nwKHm+c0WQoxDNckZh3CUqmSyz2G9y+N+by5f8wBx1aSLES9y2ZGsThylwyKwYaJGA
 s73Hs2BHn9SGWtv44Vs3+8fSzik72wIRaicxWY62CWOH5UOw8PxAojQOYOsZaDp4bUvE2WmO8
 WMRUUHGwWfeFyBUZgPfQjRL58smPc1J7FSnoEcEv64KHE2OvoYYiwW8+Ff1rSroBMsgOPwpkc
 zUIZkdRnptbAZ2l92/3H/6Axp3lXIwQFLz0dORq9ZbyllWv24OIvTDEjkE5WYnAI/8jpZnTsT
 GN0H6ly3msTgVUGfgteOPJbaZd2IZbYFhiMB9cNdtWZG8oeFOLRuzwbvUNWrVPliwNFKYLMnz
 arDPEW6T0EB32wYUjuwqck8qtWsjqBRFRWDN4mDquYoMGEQ+VVnJKebbXI4KLqjPl5Y5YlgUH
 Rc/lCoC1zGcKC3AZmksutvwSsRyoiVAoBP1Txwi+ea3/v6kG5L6FP1O8dxcDfVOw1+zfLuXrH
 6qTvJ0V3QWgpljz4Kkdlwori7mKOwUZ6kF/paFGA4+82XjLFqvsTVeyk/McrsWpCddapdbfvH
 xjn9i4GA66GhLiimDYREOwt4RgqDuGUG5O9tU3AQ6xQynld5FqpyQOZS1ik0CzBWgD28sJqPa
 DAJbaEY/xLj82/kA9OQ3+/nYMZDhbEaa4GbPbdA==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41423
Cc: rrandresf@HIDDEN, Tim Vaughan <timv@HIDDEN>, 41423 <at> debbugs.gnu.org,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Gregory Heytings <ghe@HIDDEN> writes:

> Hi Michael,

Hi Gregory,

>> However, the remote case could be improved. Tramp uses caches. They
>> expire after a while (10 seconds per default), but this might be
>> improved. The appended patch disables Tramp cache expiry while being
>> in eshell-complete-commands-list, so completion might be faster once
>> the cache has been filled. Could you pls check?
>>
>
> I just checked, and see no visible improvement.

The first time you try completion, there's no difference. The cache must
be filled. But all next times you complete, it shall be faster for
remote directoriues.

> That being said, I don't think this bug should be fixed on the eshell
> level.  It's a bug in the completion mechanisms, and
> `eshell-complete-commands-list' should simply not be called here.

I do not claim my patch is the solution. But it shall be useful, if
eshell-complete-commands-list is called somewhere.

> Gregory

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 29 Aug 2020 16:12:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 29 12:12:22 2020
Received: from localhost ([127.0.0.1]:48939 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kC3So-0003ZL-0L
	for submit <at> debbugs.gnu.org; Sat, 29 Aug 2020 12:12:22 -0400
Received: from mx.sdf.org ([205.166.94.24]:62638)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ghe@HIDDEN>) id 1kC3Sl-0003ZE-Fx
 for 41423 <at> debbugs.gnu.org; Sat, 29 Aug 2020 12:12:20 -0400
Received: from sdf.org (IDENT:ghe@HIDDEN [205.166.94.9])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 07TGCIDj018825
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Sat, 29 Aug 2020 16:12:18 GMT
Received: (from ghe@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 07TGCHj3017107;
 Sat, 29 Aug 2020 16:12:17 GMT
Date: Sat, 29 Aug 2020 16:12:15 +0000
From: Gregory Heytings <ghe@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
In-Reply-To: <jwvv9h11mtb.fsf-monnier+emacs@HIDDEN>
Message-ID: <alpine.NEB.2.22.394.2008291808310453.23004@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
 <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
 <87mu2d7hka.fsf@HIDDEN> <jwvv9h11mtb.fsf-monnier+emacs@HIDDEN>
User-Agent: Alpine 2.22 (NEB 394 2020-01-19)
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 41423
Cc: Tim Vaughan <timv@HIDDEN>, rrandresf@HIDDEN,
 Michael Albinus <michael.albinus@HIDDEN>, 41423 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


>> 1. TAB calls completion-at-point
>> 2. completion-at-point calls pcomplete-completions-at-point, which calls pcomplete/cd; this completes the directory name
>
> Sounds like a bug: the `completion-at-point-functions` should not 
> perform the completion but should only return a description of the part 
> of the text that is the subject of completion, along with a description 
> (generally in the form of a function) of the set of elements from which 
> the possible completions can be taken.
>

Please don't take my words too literally.  "This completes the directory 
name" does not mean that `pcomplete/cd' performs the completion itself. 
Indeed it returns something with which the completion is performed.

The bug is clearly not there (at step 2), but later (in the fact that 
`completion-at-point' calls `pcomplete-completions-at-point' three times).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 29 Aug 2020 15:44:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 29 11:44:22 2020
Received: from localhost ([127.0.0.1]:48905 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kC31i-0002ui-1H
	for submit <at> debbugs.gnu.org; Sat, 29 Aug 2020 11:44:22 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:29986)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1kC31g-0002uW-5v
 for 41423 <at> debbugs.gnu.org; Sat, 29 Aug 2020 11:44:20 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A9C9F809C0;
 Sat, 29 Aug 2020 11:44:14 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 2FD8D80855;
 Sat, 29 Aug 2020 11:44:13 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1598715853;
 bh=9hU1h7PZ6QTi9j883I83rZXFAJJgdI+lYbJack31u90=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=ISePyYXlF8iQEa4o6VCVJrMoUXfD0cv6BDbJBY5B2xUNm4bhYYDKXik5kZEx7sLxM
 FA6afQ81B73l1yz4khNU0GwZSc+ZaYRbGDV2j1z2RTtKKU9gWtnQfMQDRGw/asVNQa
 fv9m5WHQyp+mM5aji6C9W38A0dPIXIX+BirsoKy/ruoBMeQQORaiAMqVlSHnbjMJGH
 zWdIvrnFHRXQI6P3XP43iZgtoNpDl4UvfLiNK8ZfEG0YYyqypisxn0Uq2aT8UIKq3C
 aDwSERIAhXtzSB+VnRtj3f86GZ3Gm3tcrDOLpPhLdFQ53TPS1KldBwU2ngLH+hpBQa
 YaAdpXFR3MVIQ==
Received: from alfajor (unknown [45.72.232.131])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id CCE79120795;
 Sat, 29 Aug 2020 11:44:12 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Michael Albinus <michael.albinus@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
Message-ID: <jwvv9h11mtb.fsf-monnier+emacs@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
 <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
 <87mu2d7hka.fsf@HIDDEN>
Date: Sat, 29 Aug 2020 11:44:11 -0400
In-Reply-To: <87mu2d7hka.fsf@HIDDEN> (Michael Albinus's message of "Sat, 29
 Aug 2020 14:38:45 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.061 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41423
Cc: Gregory Heytings <ghe@HIDDEN>, rrandresf@HIDDEN,
 Tim Vaughan <timv@HIDDEN>, 41423 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> 1. TAB calls completion-at-point
>> 2. completion-at-point calls pcomplete-completions-at-point, which
>> calls pcomplete/cd; this completes the directory name

Sounds like a bug: the `completion-at-point-functions` should not
perform the completion but should only return a description of the part
of the text that is the subject of completion, along with a description
(generally in the form of a function) of the set of elements from which
the possible completions can be taken.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 29 Aug 2020 13:09:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 29 09:09:00 2020
Received: from localhost ([127.0.0.1]:48028 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kC0bM-000569-CH
	for submit <at> debbugs.gnu.org; Sat, 29 Aug 2020 09:09:00 -0400
Received: from mx.sdf.org ([205.166.94.24]:60806)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ghe@HIDDEN>) id 1kC0bK-000561-PS
 for 41423 <at> debbugs.gnu.org; Sat, 29 Aug 2020 09:08:59 -0400
Received: from sdf.org (IDENT:ghe@HIDDEN [205.166.94.9])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 07TD8vC5001332
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Sat, 29 Aug 2020 13:08:57 GMT
Received: (from ghe@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 07TD8v43015268;
 Sat, 29 Aug 2020 13:08:57 GMT
Date: Sat, 29 Aug 2020 13:08:55 +0000
From: Gregory Heytings <ghe@HIDDEN>
To: Michael Albinus <michael.albinus@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
Message-ID: <alpine.NEB.2.22.394.2008291454180453.301@HIDDEN>
User-Agent: Alpine 2.22 (NEB 394 2020-01-19)
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 41423
Cc: rrandresf@HIDDEN, Tim Vaughan <timv@HIDDEN>, 41423 <at> debbugs.gnu.org,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Hi Michael,

>
> However, the remote case could be improved. Tramp uses caches. They 
> expire after a while (10 seconds per default), but this might be 
> improved. The appended patch disables Tramp cache expiry while being in 
> eshell-complete-commands-list, so completion might be faster once the 
> cache has been filled. Could you pls check?
>

I just checked, and see no visible improvement.

That being said, I don't think this bug should be fixed on the eshell 
level.  It's a bug in the completion mechanisms, and 
`eshell-complete-commands-list' should simply not be called here.

Gregory




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 29 Aug 2020 12:39:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 29 08:39:05 2020
Received: from localhost ([127.0.0.1]:48011 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kC08P-0004Ng-37
	for submit <at> debbugs.gnu.org; Sat, 29 Aug 2020 08:39:05 -0400
Received: from mout.gmx.net ([212.227.15.18]:41647)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1kC08J-0004N6-Uu
 for 41423 <at> debbugs.gnu.org; Sat, 29 Aug 2020 08:39:04 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1598704727;
 bh=35OnjKQ+4o66ozTQuhxDtrbMl0UyDnphmT9A78wFNHk=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=VazCDg1ja/arGtaIcba56hBhd628vhMGnKwbUfFpwYUIWWwqMUZXdLIHYpl603c4D
 VC6CK6hB4zgQqj5WU2rxv5pO8ks0EU2OgQBMdvzd8dq8tpfqjRIHHfaqpsmKyW8I+L
 b9iPTKKe2kSCtLaKZEq1Q9mnD4Fr/GzJ7MyyiXEk=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([212.86.51.69]) by mail.gmx.com (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MtfNl-1kSHhA0W9X-00vC5r; Sat, 29
 Aug 2020 14:38:47 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
To: Gregory Heytings <ghe@HIDDEN>
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
 <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
Date: Sat, 29 Aug 2020 14:38:45 +0200
In-Reply-To: <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
 (Gregory Heytings's message of "Fri, 28 Aug 2020 23:15:12 +0000")
Message-ID: <87mu2d7hka.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Provags-ID: V03:K1:Sg19DI6xoAjNCpklD2knphGiTPUtuFPlT56/uMpIoVcKtsr4kyz
 ZI15HWn71DN4+0bidzqembtdO//JLeliP4/+57okbixvoOOymx/7ol6htjLQyd8uIqrFeid
 pk/LwiIFUd2zTjI6WIZu42LZ5nlD/F0ZlBuYpt0N5L15PA7vqa3v9I4qvQcHEJgtUMhevlv
 NZJqsqmezaD41aLSUH1Mw==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:tWrZs+v2FHg=:TRFbbu2NJKxdvEaDdjOgDw
 f43/7IhoxZ8SMwjStrYVKHFCDiImBktPH84ynUnHEZ6hu35oMfVFisq9IMcYefsfGLJ8dJ+6o
 tcgCsAcGNEhpjgiaQEBX6f3I3y47k9npFuzcmZdKGJU2m65wtOizJODfMh4O4g+etltFLT0aU
 0h8ueXT9XG5ghD4MWy3bkIKu+3oIndMjpUAJ0BtUCyL4sWwdD0u4/IBmfNfANAs2oxlEqMZKB
 ZDToHXSWUdamrawb9XqkWNd9N8+OTHh3JsK48VMUKpD9rQWC9Fa2VLvWrw4HL6eJl/NjRo9hF
 82jC0zpq9esiSMw29UIWSX/NmN+DtV00sG23K6whQ9nVAKLZ0d0kp351i+xtUgLXpqR19g8aq
 aG4zuJg2V6HIrv1JEbwM/UW2s/Nk54MVJW4aOjBYF6x56NI9TDonGbEtH8mvcY2GQGsyUFq4C
 Na1zKioRUcKAh8dTKqIlIF+nYGkgiOF87eChDWyOa7gbPppLFysCPmOg+zGRDHWDTAe80NH0Y
 qgVYz5ZK7BRzMSLz35YHzdmiAW/HKnOAENP3kuAagUNIxYdphWWG9k22RkofiWl4eoTGp+y7A
 2Vj2mdB4cVSGCfuq0PgefPpGFuWOX2VHurgHL8SqPa4FWOlOFmQPg26IyXFQ3sMV5/gGe/90m
 IL7ZPsqKBWBsFwbTuIiTp16S5c7s+mAY8C+9tq5od4l4ux1MjprWp8r7xH2P6ek7a2jj6cVvf
 4BxouacezmMdY56TxHjNgdlswTeYkWN+sfFBXTuTAC6Fmn+aKptgk322vUcATOxsvwD/qLVra
 vtSod+PFbpgLOfLCNXYCvtH4oaoHmXjJlPOaXJHDen46hrW/Yy2wnRAdpcpuP9bB/meHpJIK1
 O0a5Xx1pe/rtgrexYp434L5PLGay8y10bBY1GrotAYsfRv30w898XZ9RRh0iM8atl+xOVhwRa
 ZJ+H3AGUKUFdMPt27d3r5zXTvmuVJu3FvQsA8dx/7TXjb4umMBof81x3zVhzi/jBicH3eTcyU
 /dyy2WpyryrFQeCoL9GIx/DIK6JDFXl7nwlRuSyqaGDoUW9lAe7HHVq27OQHqK4fRNtJOREkU
 RC/dAYxICrSlHwQAfWGF/zv6v21qUpaBMYduovIdeaVpIjQyH+T+RAJS3FkyS7avzS40HOsYU
 8Wg7kJz99uyMrsHCU/S0rqTUVgCiDTaAzbGoX4mpCvr9j7Z1A8n+8/1zFy0/o9HhZS4Vs8PPy
 oYunEizHJx5C+wvzaqPxj8KA8vPegSafoCvFGtg==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41423
Cc: rrandresf@HIDDEN, Tim Vaughan <timv@HIDDEN>, 41423 <at> debbugs.gnu.org,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain

Gregory Heytings <ghe@HIDDEN> writes:

Hi,

> Apparently my previous last note was not the last one ;-)
>
> I still don't know how this bug should be fixed (except by using (setq
> completion-at-point-functions '(pcomplete t))), but here is a more
> detailed explanation of what is happening, at least how I understand
> it:
>
> 1. TAB calls completion-at-point
> 2. completion-at-point calls pcomplete-completions-at-point, which
> calls pcomplete/cd; this completes the directory name
> 3. completion-at-point let-binds completion-in-region-mode-predicate
> to a lambda, which contains pcomplete-completion-at-point
> 4. completion-at-point calls completion-in-region, which adds
> completion-in-region--postch to post-command-hook
> 5. post-command-hook calls completion-in-region--postch
> 6. completion-in-region--postch funcalls completion-in-region-mode-predicate
> 7. this calls pcomplete-completions-at-point a second time, which
> again calls pcomplete/cd (and adds a '/' after the directory name (?))
> 8. RET is pressed
> 9. post-command-hook still contains completion-in-region--postch: it
> is called again
> 10. completion-in-region--postch funcalls
> completion-in-region-mode-predicate again
> 11. this calls pcomplete-completions-at-point a third (!) time
> 12. at this point pcomplete-completions-at-point considers (for some
> reason, possibly because the last character of the input is '/' (?))
> that it is a command that it must now complete
> 13. therefore instead of calling pcomplete/cd a third time,
> pcomplete-completions-at-point now calls eshell-complete-commands-list
> 14. this loops through all possible command names (on the local or remote host)
> 15. if all command names had had a common prefix, that prefix would
> have been inserted now, but this is not the case, so the effect of
> this loop (apart from a waste of time) is nil
>
> The fact that default-directory is remote is not important here, the
> exact same steps take place when it is local, except that step 15 is
> executed much faster.
>
> At step 15 it is possible to interrupt the loop with C-g.  At step 8
> it is possible to remove completion-in-region--postch from
> post-command-hook for example by switching buffers with C-x C-b.
>
> Why such a overly complicated mechanism is used, or what should be
> done to avoid this behavior, is beyond my understanding.

I don't know the completion machinery, so I'm adding Stefan who might
know better.

However, the remote case could be improved. Tramp uses caches. They
expire after a while (10 seconds per default), but this might be
improved. The appended patch disables Tramp cache expiry while being in
eshell-complete-commands-list, so completion might be faster once the
cache has been filled. Could you pls check?

Best regards, Michael.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment
Content-Transfer-Encoding: quoted-printable

*** /tmp/ediff046iSD	2020-08-29 14:36:21.788278641 +0200
=2D-- /usr/local/src/emacs-27/lisp/eshell/em-cmpl.el	2020-08-29 14:22:38.7=
81483169 +0200
***************
*** 399,405 ****

  (defun eshell-complete-commands-list ()
    "Generate list of applicable, visible commands."
!   (let ((filename (pcomplete-arg)) glob-name)
      (if (file-name-directory filename)
          (if eshell-force-execution
              (pcomplete-dirs-or-entries nil #'file-readable-p)
=2D-- 399,405 ----

  (defun eshell-complete-commands-list ()
    "Generate list of applicable, visible commands."
!   (let ((filename (pcomplete-arg)) glob-name remote-file-name-inhibit-ca=
che)
      (if (file-name-directory filename)
          (if eshell-force-execution
              (pcomplete-dirs-or-entries nil #'file-readable-p)

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 28 Aug 2020 23:15:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 28 19:15:24 2020
Received: from localhost ([127.0.0.1]:47659 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kBnae-0005nW-1P
	for submit <at> debbugs.gnu.org; Fri, 28 Aug 2020 19:15:24 -0400
Received: from mx.sdf.org ([205.166.94.24]:49407)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ghe@HIDDEN>) id 1kBnaY-0005nF-W5
 for 41423 <at> debbugs.gnu.org; Fri, 28 Aug 2020 19:15:23 -0400
Received: from sdf.org (IDENT:ghe@HIDDEN [205.166.94.9])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 07SNFFOl005325
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Fri, 28 Aug 2020 23:15:15 GMT
Received: (from ghe@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 07SNFEfg024451;
 Fri, 28 Aug 2020 23:15:14 GMT
Date: Fri, 28 Aug 2020 23:15:12 +0000
From: Gregory Heytings <ghe@HIDDEN>
To: 41423 <at> debbugs.gnu.org
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
In-Reply-To: <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
Message-ID: <alpine.NEB.2.22.394.2008290031430453.17495@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
 <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
User-Agent: Alpine 2.22 (NEB 394 2020-01-19)
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 41423
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Apparently my previous last note was not the last one ;-)

I still don't know how this bug should be fixed (except by using (setq 
completion-at-point-functions '(pcomplete t))), but here is a more 
detailed explanation of what is happening, at least how I understand it:

1. TAB calls completion-at-point
2. completion-at-point calls pcomplete-completions-at-point, which calls pcomplete/cd; this completes the directory name
3. completion-at-point let-binds completion-in-region-mode-predicate to a lambda, which contains pcomplete-completion-at-point
4. completion-at-point calls completion-in-region, which adds completion-in-region--postch to post-command-hook
5. post-command-hook calls completion-in-region--postch
6. completion-in-region--postch funcalls completion-in-region-mode-predicate
7. this calls pcomplete-completions-at-point a second time, which again calls pcomplete/cd (and adds a '/' after the directory name (?))
8. RET is pressed
9. post-command-hook still contains completion-in-region--postch: it is called again
10. completion-in-region--postch funcalls completion-in-region-mode-predicate again
11. this calls pcomplete-completions-at-point a third (!) time
12. at this point pcomplete-completions-at-point considers (for some reason, possibly because the last character of the input is '/' (?)) that it is a command that it must now complete
13. therefore instead of calling pcomplete/cd a third time, pcomplete-completions-at-point now calls eshell-complete-commands-list
14. this loops through all possible command names (on the local or remote host)
15. if all command names had had a common prefix, that prefix would have been inserted now, but this is not the case, so the effect of this loop (apart from a waste of time) is nil

The fact that default-directory is remote is not important here, the exact 
same steps take place when it is local, except that step 15 is executed 
much faster.

At step 15 it is possible to interrupt the loop with C-g.  At step 8 it is 
possible to remove completion-in-region--postch from post-command-hook for 
example by switching buffers with C-x C-b.

Why such a overly complicated mechanism is used, or what should be done to 
avoid this behavior, is beyond my understanding.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 28 Aug 2020 13:17:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 28 09:17:30 2020
Received: from localhost ([127.0.0.1]:45604 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kBeG1-0007QG-VH
	for submit <at> debbugs.gnu.org; Fri, 28 Aug 2020 09:17:30 -0400
Received: from mx.sdf.org ([205.166.94.24]:60326)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ghe@HIDDEN>) id 1kBeFz-0007Q5-Cn
 for 41423 <at> debbugs.gnu.org; Fri, 28 Aug 2020 09:17:28 -0400
Received: from sdf.org (IDENT:ghe@HIDDEN [205.166.94.9])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 07SDHORK025628
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Fri, 28 Aug 2020 13:17:24 GMT
Received: (from ghe@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 07SDHNLG003722;
 Fri, 28 Aug 2020 13:17:23 GMT
Date: Fri, 28 Aug 2020 13:17:21 +0000
From: Gregory Heytings <ghe@HIDDEN>
To: 41423 <at> debbugs.gnu.org
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
In-Reply-To: <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
Message-ID: <alpine.NEB.2.22.394.2008281452430453.30371@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
 <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
User-Agent: Alpine 2.22 (NEB 394 2020-01-19)
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 41423
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


A last note: this bug exists because in Emacs 27 eshell uses 
`pcomplete-completions-at-point': TAB is bound to `completion-at-point' 
and `completion-at-point-functions' is `(pcomplete-completions-at-point 
t)'.

In Emacs 26 eshell used the (now obsolete) `pcomplete' function: TAB was 
bound to `eshell-pcomplete', which was defined as follows:

(defun eshell-pcomplete (&optional interactively)
    "Eshell wrapper for `pcomplete'."
    (interactive "p")
    (setq this-command 'pcomplete)
    (condition-case nil
        (if interactively
  	  (call-interactively 'pcomplete)
  	(pcomplete))
      (text-read-only (completion-at-point))))

IOW, pcomplete-completions-at-point was called only if `pcomplete' failed, 
and is now called by default.  (`completion-at-point-functions' was set to 
`(pcomplete-completions-at-point t)', as in Emacs 27.)

A simple fix is to eval

(setq completion-at-point-functions '(pcomplete t))

after starting eshell (or to put this in one of the eshell hooks), which 
will restore the previous default behavior.

I have no idea how `pcomplete-completions-at-point' should be adapted to 
avoid this bug.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 28 Aug 2020 09:32:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 28 05:32:55 2020
Received: from localhost ([127.0.0.1]:45099 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kBakh-0005kg-E4
	for submit <at> debbugs.gnu.org; Fri, 28 Aug 2020 05:32:55 -0400
Received: from mx.sdf.org ([205.166.94.24]:57569)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ghe@HIDDEN>) id 1kBakf-0005kW-G1
 for 41423 <at> debbugs.gnu.org; Fri, 28 Aug 2020 05:32:54 -0400
Received: from sdf.org (IDENT:ghe@HIDDEN [205.166.94.9])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 07S9WoBi001963
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Fri, 28 Aug 2020 09:32:51 GMT
Received: (from ghe@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 07S9WoXl022017;
 Fri, 28 Aug 2020 09:32:50 GMT
Date: Fri, 28 Aug 2020 09:32:48 +0000
From: Gregory Heytings <ghe@HIDDEN>
To: 41423 <at> debbugs.gnu.org
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
In-Reply-To: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
Message-ID: <alpine.NEB.2.22.394.2008281030550453.7064@HIDDEN>
References: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
User-Agent: Alpine 2.22 (NEB 394 2020-01-19)
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 41423
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


>
> The root of this bug is that `eshell-complete-commands-list' loops 
> through all executables *on the remote server* with (while comps-in-path 
> ...). That means typically 1000-2000 commands to check, one by one, 
> hence the 3 minutes delay.
>
> The easy fix is to hit C-g, which stops this loop.
>

Another note: in fact this bug exists because 
`eshell-complete-commands-list' is, in this context, called in Emacs 27, 
but not in Emacs 26 and earlier.

The backtrace is:

* eshell-complete-commands-list()
   #f(compiled-function () #<bytecode 0x1e0009b1b5c5>)()
   pcomplete--here(#f(compiled-function () #<bytecode 0x1e0009b1b5c5>) nil nil nil)
   #f(compiled-function () #<bytecode 0x1fff46e348cd94>)()
   pcomplete-completions()
   pcomplete-completions-at-point()
   #f(compiled-function () #<bytecode 0xcbc6f2b2c706bdb>)()
   completion-in-region--postch()

In Emacs 26 `pcomplete--here' is called only once, with 
`pcomplete-entries' and `file-directory-p' in its `form' argument, and 
`pcomplete-completions' returns.

In Emacs 27 `pcomplete--here' is called twice with these arguments, and a 
third time with `eshell-complete-commands-list' as its `form' argument. 
It is this third call which takes about three minutes to complete.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 27 Aug 2020 14:38:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 27 10:38:39 2020
Received: from localhost ([127.0.0.1]:43583 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kBJ31-0006dU-Eh
	for submit <at> debbugs.gnu.org; Thu, 27 Aug 2020 10:38:39 -0400
Received: from mx.sdf.org ([205.166.94.24]:62120)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ghe@HIDDEN>) id 1kBJ2x-0006dH-Bd
 for 41423 <at> debbugs.gnu.org; Thu, 27 Aug 2020 10:38:37 -0400
Received: from sdf.org (IDENT:ghe@HIDDEN [205.166.94.9])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 07REcYF0007132
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Thu, 27 Aug 2020 14:38:34 GMT
Received: (from ghe@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 07REcYNY005244;
 Thu, 27 Aug 2020 14:38:34 GMT
Date: Thu, 27 Aug 2020 14:38:32 +0000
From: Gregory Heytings <ghe@HIDDEN>
To: 41423 <at> debbugs.gnu.org
Subject: Re: bug#41423: 27.0.91; eshell file completion in tramp dir is slow
 (3 minutes) [regression on pretest]
Message-ID: <alpine.NEB.2.22.394.2008271314030453.28819@HIDDEN>
User-Agent: Alpine 2.22 (NEB 394 2020-01-19)
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 41423
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


The root of this bug is that `eshell-complete-commands-list' loops through 
all executables *on the remote server* with (while comps-in-path ...). 
That means typically 1000-2000 commands to check, one by one, hence the 3 
minutes delay.

The easy fix is to hit C-g, which stops this loop.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.
Added indication that bug 41423 blocks43018 Request was from Michael Albinus <michael.albinus@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 19 Aug 2020 17:53:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 19 13:53:34 2020
Received: from localhost ([127.0.0.1]:40939 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k8SHF-0006s7-5b
	for submit <at> debbugs.gnu.org; Wed, 19 Aug 2020 13:53:34 -0400
Received: from out5-smtp.messagingengine.com ([66.111.4.29]:39175)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <timv@HIDDEN>) id 1k8LGg-0005yw-0H
 for 41423 <at> debbugs.gnu.org; Wed, 19 Aug 2020 06:24:31 -0400
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 04DBA5C0160
 for <41423 <at> debbugs.gnu.org>; Wed, 19 Aug 2020 06:24:24 -0400 (EDT)
Received: from imap34 ([10.202.2.84])
 by compute1.internal (MEProxy); Wed, 19 Aug 2020 06:24:24 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ughan.xyz; h=
 mime-version:message-id:date:from:to:subject:content-type; s=
 fm3; bh=e9QZsnQIwHqaysmtYzP047oU6Z7ABrUzrg1IBbBjOKQ=; b=iwAhFfox
 3Fo0sYlWoi178gpz4J0GMeZsWrHGjUfKyFZx3KM2wtJozgI0M+MB6xqmtATWTlQK
 jPty42bL89dLDng2lhDsUBE3ukzGQlV5EmUuyN5K5AO8r1Tbdw4ydXeQA+7znAsD
 0Gu97nBXIKLOv0QetPczc8WNZR0+U9wfFu2llWAfVI8WreazKx0eS7E5/DxSlmoi
 b3krwL0z6EU2H2CxNQIfZILhkvm138RqHPLs9t28zDiXD1JL7Z4y7Ow6OoIPbx7G
 5i3AEdbshpglZrtewyRqP7tkKWUqhwfkGYkIpJGcAIwdkiBmhP/KQJLsFZ2yyIdG
 EaDAfYC8xgpuNQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=content-type:date:from:message-id
 :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender
 :x-me-sender:x-sasl-enc; s=fm3; bh=e9QZsnQIwHqaysmtYzP047oU6Z7AB
 rUzrg1IBbBjOKQ=; b=iRbhdeU1G7t3M5I65AByKFAujBlM4J0F4BMjdHsaFxx3s
 Gh0S0IfwZ+u+JijSA+e2Q9NxqTQ/j5ikG34B8lrBGp6Kk4PZs0Av2AiOZKgoiLW3
 tYpnXkJ+vkIsY70G66jwB7wQHw3xDN8WJ687t7xH1f/Q4QiAgXKrDe9NbQmqudAF
 TN9fwJIQdJR4VRYBaj2Lw8YkXfHtPMHdm8+lW8zjLQRMJWnJ6TwIEYbozKUuTY/P
 7y7MsojD4ZIZ8NG/vEToEq74EquuXMrQRa2eFqjsukToLfmJ4/Pd6hrBde8fX+cL
 mnxd8d/nBhpg1OI9olsblCgNsCaFNFeCrmDuLdBaQ==
X-ME-Sender: <xms:1_08X1oW0qPP5Uvu9uDPgermcF1bOMzJA4Lksq_hqG83BJOy7aOLLA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedruddtkedgvdefucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdlfeehmdenucfjughrpefofg
 ggkfffhffvufgtsehttdertderreejnecuhfhrohhmpedfvfhimhcugggruhhghhgrnhdf
 uceothhimhhvsehughhhrghnrdighiiiqeenucggtffrrghtthgvrhhnpefhueejiedvhf
 egfeegffetteehveehleffudffieetgfdttdehveffieetfffgveenucevlhhushhtvghr
 ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehtihhmvhesuhhghhgrnhdrgi
 ihii
X-ME-Proxy: <xmx:1_08X3p8dm9UdbBb-ueEDaXSAW4GVEdnz3bHZkXfEQYcsTLxtN3wow>
 <xmx:1_08XyP0IG3qdR7Jt_0pOrSdJ5NWpPE4SYKAa9lDx560DRjkv1ratQ>
 <xmx:1_08Xw7RhsGPF5-jekvkWTebldRD2886GXTNWbZN4_iGISEMRJ-EXQ>
 <xmx:1_08X7K-HF38MuS-y6k0qlGZCXOAHhGH-_BgZ0Rxs2kYR-ukcoU-AA>
Received: by mailuser.nyi.internal (Postfix, from userid 501)
 id AFFAA1460062; Wed, 19 Aug 2020 06:24:23 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
User-Agent: Cyrus-JMAP/3.3.0-191-gef79d59-fm-20200818.001-gef79d590
Mime-Version: 1.0
Message-Id: <4272ba22-6331-4bdc-914a-82df3ab870f1@HIDDEN>
Date: Wed, 19 Aug 2020 12:24:03 +0200
From: "Tim Vaughan" <timv@HIDDEN>
To: 41423 <at> debbugs.gnu.org
Subject: =?UTF-8?Q?bug#41423:_27.0.91;
 _eshell_file_completion_in_tramp_dir_is_slo?=
 =?UTF-8?Q?w_(3_minutes)_[regression_on_pretest]?=
Content-Type: text/plain
X-Spam-Score: 1.8 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Just a heads up: I believe I'm experiencing this bug under
 27.1. (Before finding this bug report I also did a bisection and found the
 same culprit commit that Andres did.). Thus I expect it somehow ma [...] 
 Content analysis details:   (1.8 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 0.0 T_PDS_OTHER_BAD_TLD    Untrustworthy TLDs
 [URI: ughan.xyz (xyz)]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
 [66.111.4.29 listed in wl.mailspike.net]
 -0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at https://www.dnswl.org/,
 low trust [66.111.4.29 listed in list.dnswl.org]
 2.0 FROM_SUSPICIOUS_NTLD_FP From abused NTLD
 0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
 0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
X-Debbugs-Envelope-To: 41423
X-Mailman-Approved-At: Wed, 19 Aug 2020 13:53:31 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.2 (-)

Just a heads up: I believe I'm experiencing this bug under 27.1.  (Before finding this bug report I also did a bisection and found the same culprit commit that Andres did.).  Thus I expect it somehow manage to escape pretest.

Additionally, I've noticed that although the effect is severe only in tramp directories, there is a noticeable (~0.5s) pause when executing commands in local directories, provided autocompletion has been used to create the command string.  (The exact same command does not seem to cause the delay when typed in without invoking autocompletion.)

I'm not at all familiar with the eshell code, but I spent some time trying to identify the cause.  Weirdly the behaviour does not seem to occur when I instrument `eshell-send-input', making it a bit of a heisenbug.

Tim




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.
Added indication that bug 41423 blocks39200 Request was from Michael Albinus <michael.albinus@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 28 May 2020 11:48:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 28 07:48:15 2020
Received: from localhost ([127.0.0.1]:51199 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jeH1D-0004cN-Em
	for submit <at> debbugs.gnu.org; Thu, 28 May 2020 07:48:15 -0400
Received: from mout.gmx.net ([212.227.15.18]:42853)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1jeH1C-0004cA-6s
 for 41423 <at> debbugs.gnu.org; Thu, 28 May 2020 07:48:14 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1590666484;
 bh=9UiR6CPVRC2+eHcUTws2KufalAc/NuN5uxx+YzinOH8=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=B7qKqeqPCu0pvI+y0Snp5fj0sdEoz+deLQS3se6ggbpJVVY+c/syOZV5sLRqa020s
 8TCKJ3lI9J+8lAJ90dQ76efy4D2TpIfa/XalfTSyN1FH2Ccv7l1LxGw4SVB+th4Lys
 X05GpXrGRKq+At1gEE1TfPjCQzCFKiifIypjTlik=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([79.140.119.31]) by mail.gmx.com (mrgmx005
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mk0Ne-1jBVlc0x7A-00kQEL; Thu, 28
 May 2020 13:48:04 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
To: =?utf-8?Q?andr=C3=A9s_ram=C3=ADrez?= <rrandresf@HIDDEN>
Subject: 27.0.91; eshell file completion in tramp dir is slow (3 minutes)
 [regression on pretest] (was: bug#41423: additional info)
References: <86k116inmr.fsf@HIDDEN>
 <handler.41423.B.158999173030371.ack <at> debbugs.gnu.org>
 <86tv0aecgn.fsf@HIDDEN>
Date: Thu, 28 May 2020 13:48:02 +0200
In-Reply-To: <86tv0aecgn.fsf@HIDDEN> (=?utf-8?Q?=22andr=C3=A9s_ram?=
 =?utf-8?Q?=C3=ADrez=22's?= message of "Wed,
 20 May 2020 17:35:36 +0000")
Message-ID: <87r1v4z3f1.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Provags-ID: V03:K1:cUL25lJOyq8s1a4pXpWnNwiMTHXx2emd85RrVfZJjJMWxLnfXch
 fDOs5wndmuQz25w6FcpFitRTQQ9m23+jgALSdnAPJyR3jBnOYdxDU3gnoOV8ZdimZUGyDaA
 OBHg3xa77wjgYm4+fkzABI5SeThYZGTlO/TErvzH13oYcRyMwJkUdB6GlOa21Y8wiDtL7AF
 zowFiA1xXttWfH+4Bjr6w==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:JvaMFd2tnu8=:bpETMyYpXn3m8ZLjsqpp14
 8GSyAtgKc1y7/z/74s6HvCiU+fPvenNN1USbjJhVgyEDrhtCbidVDqMuk+ON0/wWNn9onnhLT
 GWhzzNfzoTICrlA29JoxN2cvAhLYtkqCtG/vzm8TbrnbTZgBRPaYQffJ6VAzRnQVTAmLxdFsG
 ljCIp7qXVObOsDvIbnySuWUtWQY6WaHdPokWLrlxJudG+gWgaQ44IpDlpGT3q4AqOlvm7cqOl
 05FYYTk6sAweyLGhCXL0EIrS4ysDdUIw9L1/GIpWF6cjJ6wsKzQE9boNiwnUfjvvrUU7T05hY
 1mBSPAiLxcTJGUXoeRVeh+iA2VT8SB4AgCHVv27anOWM/IJ7fzuVMesoQP0+Si8am/MJNfoOo
 3khGDAFqqFnbB4KKbRGykGM1yrZxP0H1+l4zVP9NlSmOexHO1oZleWNOKkjNFWzg2f99SBBZT
 ooNP1JnF1plz9Jm0gzuc7EOt1kclhXEnYM+9dMqRcGhCvHbwF6G7g+ji6/QIy7FF9psr3ff0I
 NjVX/VsqLdXWhRUev/fOu6o0GHeQn1LD1AzaRAg4L9gE8vF1nJ+xhxoiaNidIdfALdzqBDtMX
 rormDGxCh7ks2jyLnnoBQ+/UWH7AW0mxRSe6GXb8tXTXEiFcy6YZ02xysI3UhXkIaB8e2Wu0x
 ZVPzTu4E23xeHTGW61pEyxdJXLRBfSXBaRnqrh0CNLi5xLfyrs+3xuPvp8zsOD0dn+slzYVnw
 sII0sDy/NN/zuRC4r0riF7RxQQ8GfXhgwG+eSruDT3OaL57wXNlogYpm+6ION3Ps2fhDjaCy1
 UDLUpj5pNgMAtQT2aWSrIDTxbXYrsFEISf9OT8o+qvsbekagpKR+zE4YU24vVuns9tjKs6P5k
 0bdc77hRWnKqhUe9dwzrkC4JyMstDiIwuGB/1YuYBWYFVUuHCrldJLwsPXkrFn6F2rE80IML6
 MUc/ZMr0OLWN8r+yBpAksT0/bNVbJj3EiDh6ny7ImmwGtMpDl+OAzYE/89y6lQAez6jdAlcji
 XRinaFFaKSB0SptEGr4S9zUU+ZKVUxEDrSt31V/isHH2MEcLzzMC8LQt7/mBNZ2PQm9KpwmWh
 jkzzUsyAz6/um9LZx4XvFlYcp19eJEk4Chbfs07wxRH3HER6DTgCLKMUM2Tbj/rZkpajP3YGp
 EblL5bkVzcdcLH/5Rc2luNrnNog+1yqg2Hioxo1FUBOagzoqaISPztv3fh0hv5X1YVzCIlxkB
 r+O+GrUA66w7MixdP
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41423
Cc: 41423 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

andr=C3=A9s ram=C3=ADrez <rrandresf@HIDDEN> writes:

Hi,

> It also delays if I replace cd by find-file on the eshell buffer. BTW
> completion needs to happen for the delay to appear.

I've bisected the emacs-27 branch for this. The first bad commit is

--8<---------------cut here---------------start------------->8---
commit 047c1b19353ff58d8cd45935c7b44c911b70e312 (HEAD, refs/bisect/bad)
Author: Stefan Monnier <monnier@HIDDEN>
Date:   Tue Mar 19 23:41:20 2019 -0400

    * lisp/eshell/em-cmpl.el: Use completion-at-point i.s.o pcomplete
--8<---------------cut here---------------end--------------->8---

Since this is a serious regression, I'm marking this as blocking for
Emacs 27. (Sorry Eli, but you can always overrule me)

> andres.ramirez

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.
Changed bug title to '27.0.91; eshell file completion in tramp dir is slow (3 minutes) [regression on pretest]' from '27.0.91; tramp regression on pretest' Request was from Noam Postavsky <npostavs@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 41423 <at> debbugs.gnu.org:


Received: (at 41423) by debbugs.gnu.org; 20 May 2020 17:35:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 20 13:35:46 2020
Received: from localhost ([127.0.0.1]:54203 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jbSd8-0001Y6-K8
	for submit <at> debbugs.gnu.org; Wed, 20 May 2020 13:35:46 -0400
Received: from mail-qk1-f177.google.com ([209.85.222.177]:42485)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rrandresf@HIDDEN>) id 1jbSd7-0001Xs-Mg
 for 41423 <at> debbugs.gnu.org; Wed, 20 May 2020 13:35:46 -0400
Received: by mail-qk1-f177.google.com with SMTP id s1so4384621qkf.9
 for <41423 <at> debbugs.gnu.org>; Wed, 20 May 2020 10:35:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:in-reply-to:organization:references:date:message-id
 :mime-version; bh=2V1gwaSt0r/e09tWdrOVcteWn//ztZaz7c37QtNLzVA=;
 b=XbkK71Ik85yNVVdAvxrTaRtm8OfjJ3eVS0I1Br/VcM3CfzjwJOJApF4zuA4YiWXJ5Y
 qh5JZBfHGx6bhRiN2LwVQfY4yf+Orw8gKpg4pVZV2JXhfRJZu9ysyarSyA+IUZL8dHlN
 5KOH1by5h+IhSKMy7nftiwW2iX86a1NzCoGidJXROks71ZrMCEKn2TkfAyTK6J6KmTVk
 WZsrc8dpkVkcw9lp1lyLouQ5nvM7Gr0f6lW0+SLYnDkewNePAvCQb7vozpHu/KkGTPog
 infDvgrSMnfCDMnEUXC9R5jpOO3DCZ7/v/kpg5GIVOIjBJIIoYUUXv6oMHuUp/5KAOy3
 fhuA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:in-reply-to:organization
 :references:date:message-id:mime-version;
 bh=2V1gwaSt0r/e09tWdrOVcteWn//ztZaz7c37QtNLzVA=;
 b=VRrnXm1zaFCDU9UVISoXoirNB5Of2mnn8xe7iv/cKqvMEcZroDkAuMFAvckkZDiiC2
 OmwoGcxZFRZybWVT8p4EgePALPAfkZFlLXDPduUCKQ4+kwK17e8s7lrWyWpHwm/ub9RU
 jwYuxO1Tyh0LnAesCc/K/JTFyiWkPvj04ZZbbJQYNV6rN1HFKduzbQkvhbUSCbqkQ4X+
 8fgyvPh7ebTnLAW3xo1BiILHKbIhdoviv/bMQtXJvh6q36mswU4arT/BA4btDlCrUXe7
 DOm+yzGZBFMpJr+LIVrDu1aHZRwcnRbVGVunHIa/zaafWDOvSyb8osajT5BSfLhPa/pl
 AQww==
X-Gm-Message-State: AOAM533SfvrcfaPBRT4JJxBEOUuqw8slWAJNcZbGrUSLuV7sEHdqoaZW
 3q+5gWA1C2S7K6GT/YnueCOHsiSZ
X-Google-Smtp-Source: ABdhPJyOcZMO0vu3qS8l/TP/qn7cL2hXdnh/gcy4FqqOTi/CBSkXfQ+sNT0tj12vckVaXMZTN9n6hA==
X-Received: by 2002:a37:943:: with SMTP id 64mr5717197qkj.14.1589996139765;
 Wed, 20 May 2020 10:35:39 -0700 (PDT)
Received: from sacsa.n800.arm.processor.yandex.fm ([190.236.255.69])
 by smtp.gmail.com with ESMTPSA id 206sm2735992qki.48.2020.05.20.10.35.38
 for <41423 <at> debbugs.gnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 20 May 2020 10:35:39 -0700 (PDT)
From: =?utf-8?Q?andr=C3=A9s_ram=C3=ADrez?= <rrandresf@HIDDEN>
To: 41423 <at> debbugs.gnu.org
Subject: additional info
In-Reply-To: <handler.41423.B.158999173030371.ack <at> debbugs.gnu.org>
Organization: bien.comun.org
References: <86k116inmr.fsf@HIDDEN>
 <handler.41423.B.158999173030371.ack <at> debbugs.gnu.org>
X-Attribution: INKA
Date: Wed, 20 May 2020 17:35:36 +0000
Message-ID: <86tv0aecgn.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 41423
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

More info.
It also delays if I replace cd by find-file on the eshell buffer. BTW
completion needs to happen for the delay to appear.

andres.ramirez




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 20 May 2020 16:22:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 20 12:22:10 2020
Received: from localhost ([127.0.0.1]:54108 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jbRTt-0007tm-Lw
	for submit <at> debbugs.gnu.org; Wed, 20 May 2020 12:22:09 -0400
Received: from lists.gnu.org ([209.51.188.17]:54768)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rrandresf@HIDDEN>) id 1jbRTs-0007tf-KN
 for submit <at> debbugs.gnu.org; Wed, 20 May 2020 12:22:08 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:46524)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rrandresf@HIDDEN>)
 id 1jbRTs-0005TC-89
 for bug-gnu-emacs@HIDDEN; Wed, 20 May 2020 12:22:08 -0400
Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]:43984)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <rrandresf@HIDDEN>)
 id 1jbRTr-0008TB-4b
 for bug-gnu-emacs@HIDDEN; Wed, 20 May 2020 12:22:07 -0400
Received: by mail-qk1-x72d.google.com with SMTP id i14so4096258qka.10
 for <bug-gnu-emacs@HIDDEN>; Wed, 20 May 2020 09:22:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version;
 bh=YCz0HIodYUG6KZMSd/yBFpLnbOJsv304sS4kQQdSYt8=;
 b=FtkjQj6pJsYoYDCQTCYVc3pbokRHhDt7zeVMUuyYWt43m7bvk9h2C9seS3qui3hvCL
 Lx3OZfAIZILJ/6jJC4h8i+YP5JU4l1zDXW5ef7IGBdDgm54GPOtUF/MnRd/r7yG70jYA
 MWLdDZUtsyupR8LUcM3/5mS9AxyXbb5BQezKevOeE6EQ/+3VRqFve3CodvoJDKfOBM6l
 kuz2cKw+Aw0BLNfTYnnKWWYj1R1ShoPtttPi2AGucEjJvV3F2gqGzV/xUixStJ8yyCzX
 BlGMIAcx5xnjlJybWhCgRlAdYIks1MY96hJI+8G1oPf62Xplyb0YxGWadH6wA0zr9ExZ
 6ogA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
 bh=YCz0HIodYUG6KZMSd/yBFpLnbOJsv304sS4kQQdSYt8=;
 b=Xg5zwuE4HTcUCu3G+LvMYiK04VygaVpqrjsjRLkqUfe7dtZWMg8CWodWydC3TPgidd
 dtWJb8F4vNb7tSzuU3oMeHMVMFCq2Y6lvLDlC/k9pN1FrhDhyqYlds49HDLd9j+1D1LZ
 F0o966T+FEnwgISRaw9SarUCr2ii101Ev93fMMYtQGjMzk6uBCo225xaPcwgiQrvSZL3
 eSzdl7Ovom8r4gKIvO/fyRzYaqBfihsrbVh7Jmh6Se0w/eryXvdxNzE8Crctd0MIBkjZ
 se2bMMnOdvg60hmEltcMr/bAi9LI1WIPaxbPVjvzVynKL89/l2f/9U3Y8GlblO1y4SsB
 lwQg==
X-Gm-Message-State: AOAM532MDGcokPGK6WE/7TMIBdq7q+6qYM5eepWsJV7I55irU1A6dPXg
 ZI8jTIatVR4QEtrXiVNemF5TJRn8
X-Google-Smtp-Source: ABdhPJy40b0GVZY8G1b+/CczE79CbBr/HK0lQJdVh1gVRAYgFcJ760P15utYDjjlHz9+As0rJnxytg==
X-Received: by 2002:a05:620a:482:: with SMTP id
 2mr5600992qkr.327.1589991725361; 
 Wed, 20 May 2020 09:22:05 -0700 (PDT)
Received: from sacsa ([190.236.255.69])
 by smtp.gmail.com with ESMTPSA id z185sm2699571qka.79.2020.05.20.09.22.03
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 20 May 2020 09:22:04 -0700 (PDT)
From: rrandresf@HIDDEN
To: bug-gnu-emacs@HIDDEN
Subject: 27.0.91; tramp regression on pretest
Date: Wed, 20 May 2020 16:20:44 +0000
Message-ID: <86k116inmr.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2607:f8b0:4864:20::72d;
 envelope-from=rrandresf@HIDDEN; helo=mail-qk1-x72d.google.com
X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache.
 That's all we know.
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)


1. emacs -Q
2. Evaluate snippet below:
--8<---------------cut here---------------start------------->8---
(let ((default-directory "/ssh:user@5quince:~/")) (eshell))
--8<---------------cut here---------------end--------------->8---
3.  On the eshell buffer I do
--8<---------------cut here---------------start------------->8---
cd dev/c/h {hit TAB key for getting completion do its job and press Return key}
--8<---------------cut here---------------end--------------->8---

Observation: On emacs-26.3 it is inmediate. But on pretest it takes almost 3m to
complete same the action.

andres.ramirez
ps: just in case completion does cd dev/c/hildon/


In GNU Emacs 27.0.91 (build 1, armv7l-unknown-linux-gnueabihf, X toolkit, Xaw3d scroll bars)
System Description: Arch Linux ARM

Recent messages:
Loading em-basic...done
Loading em-cmpl...done
Loading em-dirs...done
Loading em-glob...done
Loading em-hist...done
Loading em-ls...done
Loading em-prompt...done
Loading em-script...done
Loading em-term...done
Loading em-unix...done
#<buffer *eshell*>
Configured using:
 'configure '--program-transform-name=s/^ctags$/ctags.emacs/'
 --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/usr/share --with-x-toolkit=lucid
 --mandir=/usr/share/man --pdfdir=/usr/share/doc/emacs --with-modules
 --with-xft --without-gconf --without-gsettings --with-imagemagick
 --without-xwidgets --without-pop --with-gameuser=:games
 --disable-build-details 'CFLAGS=-march=armv7-a -mfloat-abi=hard
 -mfpu=vfpv3-d16 -O2 -pipe -fstack-protector-strong -fno-plt'
 CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
XAW3D XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GLIB NOTIFY
INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS LUCID X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON
PDUMPER LCMS2 GMP

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: C
  locale-coding-system: nil

Major mode: Eshell

Minor modes in effect:
  eshell-prompt-mode: t
  eshell-hist-mode: t
  eshell-pred-mode: t
  eshell-cmpl-mode: t
  eshell-proc-mode: t
  eshell-arg-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils pcmpl-unix em-unix
em-term term easymenu ehelp em-script em-prompt em-ls em-hist em-pred
em-glob em-dirs esh-var em-cmpl em-basic em-banner em-alias tramp-cache
tramp-sh esh-mode eshell esh-cmd esh-ext esh-opt esh-proc esh-io esh-arg
esh-module esh-groups esh-util tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat shell pcomplete comint ansi-color
ring parse-time iso8601 time-date ls-lisp format-spec auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs cl-loaddefs cl-lib
password-cache json subr-x map seq term/screen term/xterm xterm byte-opt
gv bytecomp byte-compile cconv disp-table tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
font-render-setting x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 8 141067 10597)
 (symbols 24 9524 1)
 (strings 16 41154 2442)
 (string-bytes 1 1131300)
 (vectors 8 19393)
 (vector-slots 4 599625 10098)
 (floats 8 51 242)
 (intervals 28 265 162)
 (buffers 576 13))




Acknowledgement sent to rrandresf@HIDDEN:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#41423; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 1 Sep 2020 13:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.