From: Ivan Kozlov <[email-masked]>
Date: Sat, 29 Feb 2020 04:30:15 +0300

This indeed has nothing to do with cd.

Any time complete-in-region-mode (apparently, I don’t actually know what does that) is active in eshell, typing RET, or C-j, or C-c C-u and probably many similar commands which should probably conceptually exit the mode, it lags forever. It takes many seconds on my old netbook.

Not only that, it doesn’t even exit the mode! So if you enter ls a<TAB>, then C-c C-u, then type something again and do RET/C-c C-u/etc., it will lag. Even if you type RET and get a new prompt, it will continue to lag. But then if you type something in the new prompt, apparently it won’t. It’s crazy.

Needless to say, erasing only the argument in question also doesn’t quit it. If you enter ls a<TAB> and erase the ‘a’ with DEL/M-DEL/C-c C-w/etc., then press RET/C-c C-u/etc., it will lag.

But here are some things that do quit it:
— typing SPC;
— pressing C-g;
— moving the point to outside the argument;
— switching to a different buffer and back.

All this equally applies to command completion etc.

In general, completion in eshell is *completely* broken.

One further example: when complete-in-region-mode is active (again, _apparently_) and there is some text before the point, typing * (the asterisk character) runs some undocumented command which completes the argument if there is exactly one possible completion and doesn’t do anything otherwise, so it’s like TAB without the *Completions* buffer.

So typing ls a<TAB>/* will produce ls a/b if b is the only file in a/, and ls a/ otherwise.

This makes entering glob patterns (one of the most common tasks in shell) a *giant pain* with constantly hitting C-g and what not to make the completion stuff go away. I have no idea whether using * for the command was a deliberate decision, but it is really bad.

Moreover, typing \ inserts \<TAB>! This one is inexplicable. It makes quoting characters a giant pain with constantly erasing the tab or cancelling the completion garbage as above.

The third atrocity is bug #15386.

Together they render eshell clearly unusable.

I wish I could remotely understand what’s going on between completion-in-region/pcomplete/eshell, but the code appears complicated and is completely undocumented. I can’t even find where the * and \ bindings are set up. It is certainly the most horribly broken thing I have encountered in Emacs.