From: Gregory Heytings via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Tim Vaughan <timv@ughan.xyz>,
rrandresf@gmail.com, Michael Albinus <michael.albinus@gmx.de>,
41423@debbugs.gnu.org
Subject: bug#41423: 27.0.91; eshell file completion in tramp dir is slow (3 minutes) [regression on pretest]
Date: Sun, 30 Aug 2020 22:28:01 +0000 [thread overview]
Message-ID: <alpine.NEB.2.22.394.2008302320550453.28913@sdf.lonestar.org> (raw)
In-Reply-To: <jwveeno23j8.fsf-monnier+emacs@gnu.org>
>
> 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.
next prev parent reply other threads:[~2020-08-30 22:28 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-20 16:20 bug#41423: 27.0.91; tramp regression on pretest rrandresf
[not found] ` <handler.41423.B.158999173030371.ack@debbugs.gnu.org>
2020-05-20 17:35 ` bug#41423: additional info andrés ramírez
2020-05-28 11:48 ` bug#41423: 27.0.91; eshell file completion in tramp dir is slow (3 minutes) [regression on pretest] (was: bug#41423: additional info) Michael Albinus
2021-02-01 2:45 ` bug#41423: 27.0.91; eshell file completion in tramp dir is slow (3 minutes) [regression on pretest] Stefan Monnier
2021-02-01 4:36 ` bug#41423: Installing the fix for bug#41423 on emacs-27 (was: 27.0.91; eshell file completion in tramp dir is slow (3 minutes) [regression on pretest]) Stefan Monnier
2021-02-01 9:59 ` bug#41423: Installing the fix for bug#41423 on emacs-27 Michael Albinus
2021-02-01 14:47 ` bug#41423: Installing the fix for bug#41423 on emacs-27 (was: 27.0.91; eshell file completion in tramp dir is slow (3 minutes) [regression on pretest]) Eli Zaretskii
2021-02-01 15:33 ` bug#41423: Installing the fix for bug#41423 on emacs-27 Stefan Monnier
2021-02-01 15:53 ` andrés ramírez
2021-02-01 16:13 ` Stefan Monnier
2021-02-01 17:35 ` andrés ramírez
2022-06-27 8:29 ` bug#41423: bug#47389: 27.1.91; completion issue on eshell Lars Ingebrigtsen
2022-06-27 11:37 ` andrés ramírez
2022-06-27 11:44 ` Lars Ingebrigtsen
2020-08-19 10:24 ` bug#41423: 27.0.91; eshell file completion in tramp dir is slow (3 minutes) [regression on pretest] Tim Vaughan via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-27 14:38 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-28 9:32 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-28 13:17 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-28 23:15 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-29 12:38 ` Michael Albinus
2020-08-29 15:44 ` Stefan Monnier
2020-08-29 16:12 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-30 3:55 ` Stefan Monnier
2020-08-30 22:28 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2020-08-31 8:30 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-01 4:23 ` Stefan Monnier
2020-09-01 8:31 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-01 10:14 ` Eli Zaretskii
2020-09-01 11:50 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-01 13:08 ` Stefan Monnier
2020-09-01 13:30 ` Stefan Monnier
2020-09-01 15:41 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-01 13:04 ` Stefan Monnier
2020-09-01 15:40 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-02 0:31 ` Stefan Monnier
2020-09-02 10:26 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-02 10:33 ` Michael Albinus
2020-09-02 16:00 ` Drew Adams
2021-01-31 17:07 ` xristos--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-02 16:36 ` Stefan Monnier
2020-09-02 19:52 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-02 20:08 ` Stefan Monnier
2020-08-29 13:08 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-29 16:54 ` Michael Albinus
2020-08-29 17:14 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-29 17:28 ` Michael Albinus
2021-04-21 16:06 ` bug#41423: Installing the fix for bug#41423 on emacs-27 Andrés Ramírez
2021-04-23 22:14 ` Stefan Monnier
2021-04-24 3:37 ` andrés ramírez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.NEB.2.22.394.2008302320550453.28913@sdf.lonestar.org \
--to=bug-gnu-emacs@gnu.org \
--cc=41423@debbugs.gnu.org \
--cc=ghe@sdf.org \
--cc=michael.albinus@gmx.de \
--cc=monnier@iro.umontreal.ca \
--cc=rrandresf@gmail.com \
--cc=timv@ughan.xyz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).