Subject: bug#26661: compile, shell etc. should use bash-completion !

From: Kévin Le Gouguec <[email-masked]>
Date: Thu, 03 Sep 2020 00:10:29 +0200

Stefan Kangas <[email-masked]> writes:

> 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".