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

0 views
Skip to first unread message

Stefan Kangas

unread,
Sep 1, 2020, 7:16:07 PM9/1/20
to 積丹尼 Dan Jacobson, 26...@debbugs.gnu.org
tags 26661 + notabug wontfix
close 26661
thanks

積丹尼 Dan Jacobson <jid...@jidanni.org> writes:

> 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

unread,
Sep 2, 2020, 6:11:05 PM9/2/20
to Stefan Kangas, 26...@debbugs.gnu.org, 積丹尼 Dan Jacobson
Stefan Kangas <ste...@marxist.se> 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".



Stefan Kangas

unread,
Sep 2, 2020, 6:35:05 PM9/2/20
to Kévin Le Gouguec, 26...@debbugs.gnu.org, 積丹尼 Dan Jacobson
Kévin Le Gouguec <kevin.l...@gmail.com> writes:

> 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?



Reply all
Reply to author
Forward
0 new messages