Discussion:
bug#26661: compile, shell etc. should use bash-completion !
(too old to reply)
Stefan Kangas
2020-09-01 23:14:57 UTC
Permalink
tags 26661 + notabug wontfix
close 26661
thanks
M-x compile prompt,
Compile command: cat --<TAB>
M-x shell,
$ cat --<TAB>
etc. etc.
should all use bash-completion !
If the user has it turned on in his shell, emacs should recognize it.
https://www.google.com/search?q=bash-completion+emacs
Note that `shell' already supports pcomplete, which extends to
`compile' (and `shell-command', etc.) AFAICT. Try typing:

M-x compile RET make SPC TAB

and enjoy...

I'm also not exactly sure how integrating bash completion with Emacs
would work. Bash completion consists of a number of highly
bash-specific scripts. It would take significant effort to write an
Emacs parser for them.

It seems like a better idea for people to spend time on making pcomplete
extensions for more commands. But that would be outside the scope of
this feature request, I think.

I'm therefore closing this bug report.
Kévin Le Gouguec
2020-09-02 22:10:29 UTC
Permalink
Post by Stefan Kangas
I'm also not exactly sure how integrating bash completion with Emacs
would work. Bash completion consists of a number of highly
bash-specific scripts. It would take significant effort to write an
Emacs parser for them.
It seems like a better idea for people to spend time on making pcomplete
extensions for more commands. But that would be outside the scope of
this feature request, I think.
Out of curiosity, couldn't shell-mode (and M-x compile et al.) do what
python-mode does, i.e. ask the interpreter's "completion API" for
candidates when the user hits TAB?

I think that's what the "bash-completion" package from MELPA does[1];
this approach would allow Emacs to leverage Bash's programmable
completion with no special support for specific commands.


(Apologies if I've misunderstood something, I've only very quickly
glanced at python.el and bash-completion's internals.)


[1] https://raw.githubusercontent.com/szermatt/emacs-bash-completion/master/bash-completion.el

See e.g. bash-completion--setup-bash-common which runs "complete -p".
Stefan Kangas
2020-09-02 22:34:00 UTC
Permalink
Post by Kévin Le Gouguec
Out of curiosity, couldn't shell-mode (and M-x compile et al.) do what
python-mode does, i.e. ask the interpreter's "completion API" for
candidates when the user hits TAB?
I think that's what the "bash-completion" package from MELPA does[1];
this approach would allow Emacs to leverage Bash's programmable
completion with no special support for specific commands.
(Apologies if I've misunderstood something, I've only very quickly
glanced at python.el and bash-completion's internals.)
[1] https://raw.githubusercontent.com/szermatt/emacs-bash-completion/master/bash-completion.el
See e.g. bash-completion--setup-bash-common which runs "complete -p".
Interesting, I didn't know about that package. I tested it, and it
seems to do the job.

I think it's interesting as an alternative, but is it suitable as a
default? For example what happens if you don't have bash-completion
installed on your machine. IIRC it is a separate package in Debian.

Also, I doubt that it could ever be as powerful as pcomplete.

My preference is that for this use-case we point users to use the
third-party package, but I guess YMMV. Any other opinions?

Loading...