GNU bug report logs - #26661
compile, shell etc. should use bash-completion !

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Tue, 25 Apr 2017 23:38:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 26661 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#26661; Package emacs. (Tue, 25 Apr 2017 23:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 25 Apr 2017 23:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Subject: compile, shell etc. should use bash-completion !
Date: Wed, 26 Apr 2017 07:36:59 +0800
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26661; Package emacs. (Tue, 01 Sep 2020 23:16:02 GMT) Full text and rfc822 format available.

Message #8 received at 26661 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 26661 <at> debbugs.gnu.org
Subject: Re: bug#26661: compile, shell etc. should use bash-completion !
Date: Tue, 1 Sep 2020 16:14:57 -0700
tags 26661 + notabug wontfix
close 26661
thanks

積丹尼 Dan Jacobson <jidanni <at> 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.




Added tag(s) notabug and wontfix. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Tue, 01 Sep 2020 23:16:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 26661 <at> debbugs.gnu.org and 積丹尼 Dan Jacobson <jidanni <at> jidanni.org> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Tue, 01 Sep 2020 23:16:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26661; Package emacs. (Wed, 02 Sep 2020 22:11:01 GMT) Full text and rfc822 format available.

Message #15 received at 26661 <at> debbugs.gnu.org (full text, mbox):

From: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 26661 <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#26661: compile, shell etc. should use bash-completion !
Date: Thu, 03 Sep 2020 00:10:29 +0200
Stefan Kangas <stefan <at> 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".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26661; Package emacs. (Wed, 02 Sep 2020 22:35:01 GMT) Full text and rfc822 format available.

Message #18 received at 26661 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
Cc: 26661 <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#26661: compile, shell etc. should use bash-completion !
Date: Wed, 2 Sep 2020 18:34:00 -0400
Kévin Le Gouguec <kevin.legouguec <at> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26661; Package emacs. (Fri, 04 Sep 2020 11:06:01 GMT) Full text and rfc822 format available.

Message #21 received at 26661 <at> debbugs.gnu.org (full text, mbox):

From: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 26661 <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#26661: compile, shell etc. should use bash-completion !
Date: Fri, 04 Sep 2020 13:05:38 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

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

IIUC Debian's bash-completion package merely provides configuration for
Bash's native completion facilities (`complete' is just a Bash builtin);
I expect that if it's not installed, the MELPA package will just end up
with an empty list of completion candidates.

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

It would probably have better program coverage though.  Lots of authors
of CLI tools now maintain their own completion configuration for
e.g. Bash and/or Zsh, so by supporting Bash's native completion
facilities we would leverage their efforts instead of re-developing
ad-hoc completion functions.

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

All I can say is that I enjoy python.el offering the interpreter's
native completions, and I wish shell-mode et al. could work the same
way.  Philosophically speaking, it would make sense IMO for one GNU
project (Emacs) to leverage the API offered by another GNU project
(Bash).


I'm not saying pcomplete doesn't deserve some love and we could not
implement smarter completions with it; I just think the benefit/cost
ratio of enabling native Bash completions by default seems high.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26661; Package emacs. (Fri, 04 Sep 2020 13:29:02 GMT) Full text and rfc822 format available.

Message #24 received at 26661 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
Cc: 26661 <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#26661: compile, shell etc. should use bash-completion !
Date: Fri, 4 Sep 2020 13:28:49 +0000
reopen 26661
tags 26661 - notabug wontfix
thanks

Kévin Le Gouguec <kevin.legouguec <at> gmail.com> writes:

> Lots of authors of CLI tools now maintain their own completion
> configuration for e.g. Bash and/or Zsh, so by supporting Bash's native
> completion facilities we would leverage their efforts instead of
> re-developing ad-hoc completion functions.
[...]
> I just think the benefit/cost ratio of enabling native Bash
> completions by default seems high.

OK, those are indeed compelling arguments, so I'm re-opening the bug
report.

Maybe we could convince the authors of the bash-completion package to
assign their copyright to the FSF.




Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 04 Sep 2020 13:29:02 GMT) Full text and rfc822 format available.

Removed tag(s) wontfix and notabug. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Fri, 04 Sep 2020 13:29:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26661; Package emacs. (Wed, 21 Oct 2020 17:07:02 GMT) Full text and rfc822 format available.

Message #31 received at 26661 <at> debbugs.gnu.org (full text, mbox):

From: Bhavin Gandhi <bhavin7392 <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: szermatt <at> gmx.net, 26661 <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>,
 Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
Subject: Re: bug#26661: compile, shell etc. should use bash-completion !
Date: Wed, 21 Oct 2020 22:35:48 +0530
On Fri, 4 Sep 2020 at 18:59, Stefan Kangas <stefan <at> marxist.se> wrote:
>
> Maybe we could convince the authors of the bash-completion package to
> assign their copyright to the FSF.
>

I reached out to the author of bash-completion over GitHub, they are
willing to do that if there is enough interest. Adding them in CC.

https://github.com/szermatt/emacs-bash-completion/issues/45#issuecomment-706671531

-- 
Warm Regards,
Bhavin Gandhi (bhavin192) | https://geeksocket.in




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26661; Package emacs. (Thu, 29 Oct 2020 01:17:01 GMT) Full text and rfc822 format available.

Message #34 received at 26661 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Bhavin Gandhi <bhavin7392 <at> gmail.com>
Cc: szermatt <at> gmx.net, 26661 <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>,
 Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
Subject: Re: bug#26661: compile, shell etc. should use bash-completion !
Date: Wed, 28 Oct 2020 18:16:05 -0700
Bhavin Gandhi <bhavin7392 <at> gmail.com> writes:

> On Fri, 4 Sep 2020 at 18:59, Stefan Kangas <stefan <at> marxist.se> wrote:
>>
>> Maybe we could convince the authors of the bash-completion package to
>> assign their copyright to the FSF.
>
> I reached out to the author of bash-completion over GitHub, they are
> willing to do that if there is enough interest. Adding them in CC.
>
> https://github.com/szermatt/emacs-bash-completion/issues/45#issuecomment-706671531

I found the comment on that page interesting:

   I have to say that I personally find bash-completion a bit hackish
   and fragile (by nature) to be something that'd come as part of
   standard Emacs, but that's something for Emacs maintainers to decide.

So perhaps this should better be part of GNU ELPA for users that want
it as optional behavior.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26661; Package emacs. (Thu, 29 Oct 2020 06:32:02 GMT) Full text and rfc822 format available.

Message #37 received at 26661 <at> debbugs.gnu.org (full text, mbox):

From: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 26661 <at> debbugs.gnu.org, szermatt <at> gmx.net,
 Bhavin Gandhi <bhavin7392 <at> gmail.com>,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#26661: compile, shell etc. should use bash-completion !
Date: Thu, 29 Oct 2020 07:31:49 +0100
Stefan Kangas <stefan <at> marxist.se> writes:

>> https://github.com/szermatt/emacs-bash-completion/issues/45#issuecomment-706671531
>
> I found the comment on that page interesting:
>
>    I have to say that I personally find bash-completion a bit hackish
>    and fragile (by nature) to be something that'd come as part of
>    standard Emacs, but that's something for Emacs maintainers to decide.
>
> So perhaps this should better be part of GNU ELPA for users that want
> it as optional behavior.

I'd be interested in knowing what makes bash-completion inherently more
hackish and fragile than say, python.el's native completion?  AFAICT
both essentially use a dedicated buffer to send completion queries to an
inferior process.

I may not have been thorough enough when reading either library's code
though, so maybe I missed something.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26661; Package emacs. (Thu, 29 Oct 2020 18:16:02 GMT) Full text and rfc822 format available.

Message #40 received at 26661 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
Cc: 26661 <at> debbugs.gnu.org, szermatt <at> gmx.net,
 Bhavin Gandhi <bhavin7392 <at> gmail.com>,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#26661: compile, shell etc. should use bash-completion !
Date: Thu, 29 Oct 2020 11:15:30 -0700
Kévin Le Gouguec <kevin.legouguec <at> gmail.com> writes:

> Stefan Kangas <stefan <at> marxist.se> writes:
>
>>> https://github.com/szermatt/emacs-bash-completion/issues/45#issuecomment-706671531
>>
>> I found the comment on that page interesting:
>>
>>    I have to say that I personally find bash-completion a bit hackish
>>    and fragile (by nature) to be something that'd come as part of
>>    standard Emacs, but that's something for Emacs maintainers to decide.
>>
>> So perhaps this should better be part of GNU ELPA for users that want
>> it as optional behavior.
>
> I'd be interested in knowing what makes bash-completion inherently more
> hackish and fragile than say, python.el's native completion?  AFAICT
> both essentially use a dedicated buffer to send completion queries to an
> inferior process.

The comparison should rather be to the existing pcomplete support, I
think.

I suppose it's hackish and fragile because it can break at any time due
to third-party changes outside of our control.  But you're likely to get
a better answer from the author of the emacs-bash-completion package,
who wrote that remark in the first place.




This bug report was last modified 4 years and 30 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.