reddit / emacs

Builtin eshell completion at po

gdunk2 · 2022-10-02 16:23
I'm trying to use the builtin completion at point in eshell to complete command arguments. E.g in eshell I'd type `cd` and hit `<TAB>`: ~ $ cd to open up the `*Completions*` buffer. Im currently using emacs 29.0.50 (commit 72c64dd73c), and so `M-<down>` and `M-<up>` can cycle through the completions (directories in this case with the `cd` command), while keeping the eshell buffer focused. The problem I'm facing now is how to actually insert the currently highlighted completion into my eshell buffer. Clicking on the completion with the mouse will insert it into eshell, as well as switching focus to the `*Completions*` buffer and hitting `RET` over it, but I'm trying to do this without having to switch focus from eshell. `M-<up>` and `M-<down>`, added new in emacs 29, allow cycling through completions while keeping focus in the current window (my eshell in this case), but I cant select one. The command `minibuffer-choose-completion`, which is bound to `M-RET` returns an error saying "Text is read only", which I think is happening because it is trying to insert the completion into the minibuffer and not my eshell window. Moreover, `completion-at-point` for symbols in elisp files works as intended with `M-RET`, but not for eshell. Any help on how to sort this would be great. Thanks in advance
1nc0ns1st3nt · 2022-10-02 20:31
I uses eshell as well, I use Corfu for completion and it also auto complete. It requires some additional setup (check wiki for shell) tho to make it work flawlessly.
mclearc · 2022-10-04 00:32
I found completion to be pretty easy to set up (I also use corfu). Here's my config if that will be of help -- note especially the pcomplete setup and \`em-cmpl\` as well. https://github.com/Lambda-Emacs/lambda-emacs/blob/main/lambda-library/lambda-setup/lem-setup-eshell.el