[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: |
Fri, 16 Apr 2021 21:10:10 -0300 |
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:
--8<---------------cut here---------------start------------->8---
(add-hook
'eshell-mode-hook
(function (lambda ()
(setq completion-at-point-functions '(pcomplete t)))))
--8<---------------cut here---------------end--------------->8---
On the other hand, applying your patch...
--8<---------------cut here---------------start------------->8---
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")
--8<---------------cut here---------------end--------------->8---
...does not make any noticeable change. Should I try a clean master to
make sure I'm doing the right thing here? Notice my case the slow down
is only involved with local files, no tramp business. I do experience
the ~0.5-second delay mentioned by Tim Vaughan. (Sometimes it takes
longer.)
Thanks!
- 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 <=
- Re: why is my cd command on eshell on Windows so slow?, Wayne Harris, 2021/04/17
- 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