[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: why is my cd command on eshell on Windows so slow?
From: |
Wayne Harris |
Subject: |
Re: why is my cd command on eshell on Windows so slow? |
Date: |
Sat, 17 Apr 2021 05:28:36 -0300 |
Wayne Harris via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>>>> %cd dir/
>>>>> 0.001 secs
>>>>> %
>> [...]
>>> It appears that the delay has nothing to do with Windows or with the
>>> cd-command. It seems to be the procedure
>>>
>>> completion-in-region--postch
>>
>> Sounds like bug#41423.
>> If that's the case, then I suggest you try the code in Emacs's `master`
>> where it should be fixed.
>
> It really sounds like bug#41423, even because the workaround provided by
> Gregory Heytings solves the problem, that is, I don't notice any slow
> down after applying:
>
> (add-hook
> 'eshell-mode-hook
> (function (lambda ()
> (setq completion-at-point-functions '(pcomplete t)))))
>
> On the other hand, applying your patch...
>
> diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
> index faf749d836..744be525ec 100644
> --- a/lisp/eshell/em-cmpl.el
> +++ b/lisp/eshell/em-cmpl.el
> @@ -399,16 +399,21 @@
>
> (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, especially over Tramp
> + ;; (bug#41423), so do it lazily.
> + (let ((glob-name
> + ;; When a command is specified using `eshell-explicit-command-char',
> + ;; that char is not part of the command and hence not part of what
> + ;; we complete. Adjust `pcomplete-stub' accordingly!
> + (if (and (> (length pcomplete-stub) 0)
> + (eq (aref pcomplete-stub 0) eshell-explicit-command-char))
> + (setq pcomplete-stub (substring pcomplete-stub 1)))))
> + (completion-table-dynamic
> + (lambda (filename)
> (if (file-name-directory filename)
> (if eshell-force-execution
> (pcomplete-dirs-or-entries nil #'file-readable-p)
> (pcomplete-executables))
> - (if (and (> (length filename) 0)
> - (eq (aref filename 0) eshell-explicit-command-char))
> - (setq filename (substring filename 1)
> - pcomplete-stub filename
> - glob-name t))
> (let* ((paths (eshell-get-path))
> (cwd (file-name-as-directory
> (expand-file-name default-directory)))
> @@ -455,7 +460,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")
>
> ...does not make any noticeable change.
[...]
Sorry! It does make a noticeable change. Your patch seems to solve the
problem quite well for me. I believe this is case closed. Thank you
for the marvelous patch.
- why is my cd command on eshell on Windows so slow?, Wayne Harris, 2021/04/16
- Re: why is my cd command on eshell on Windows so slow?, Eli Zaretskii, 2021/04/16
- Re: why is my cd command on eshell on Windows so slow?, Wayne Harris, 2021/04/16
- Re: why is my cd command on eshell on Windows so slow?, Stefan Monnier, 2021/04/16
- Re: why is my cd command on eshell on Windows so slow?, Wayne Harris, 2021/04/16
- Re: why is my cd command on eshell on Windows so slow?,
Wayne Harris <=
- Re: why is my cd command on eshell on Windows so slow?, Stefan Monnier, 2021/04/17
- Re: why is my cd command on eshell on Windows so slow?, Óscar Fuentes, 2021/04/17
- Re: why is my cd command on eshell on Windows so slow?, Eli Zaretskii, 2021/04/17
- Re: why is my cd command on eshell on Windows so slow?, Óscar Fuentes, 2021/04/17
- Re: why is my cd command on eshell on Windows so slow?, Eli Zaretskii, 2021/04/17
- Re: why is my cd command on eshell on Windows so slow?, Stefan Monnier, 2021/04/17