help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question: Is there any way to use the bash completion feature from Emacs


From: ISHIKAWA,chiaki
Subject: Question: Is there any way to use the bash completion feature from Emacs shell mode.
Date: Sun, 9 Oct 2016 04:14:23 +0900
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

Hi,
I have been using GNU emacs more than 30 years and thank you for maintaining the great package.

I have a question.

Bash, the GNU shell interpreter has a feature called completion, and
over the years, people have created various completion databases for many commands which are useful.

Case in point.
I just noticed the source control system called mercurial (known as "hg" with its main command) has a very nice bash completion database.

The completion understands where the various so called MERCURIAL's patch queues are stored and thus can offer the alternatives quite easily.

e.g.
After including

. /usr/share/bash-completion/completions/hg

(I am using Debian GNU/Linux and the above is where the completion code for hg is stored.)

I can do the following inside a bash on an ordinary console.
$ hg qq [TAB]

expands to

$ hg qqueue

another couple of [TABS] expands to

--create             TEST                 patches
--delete             TEST-Q               pristine
--list               one-letter-C-locale  submission
--purge              partial4upload       submission1
--rename             partial4upload-1
$ hg qqueue

hitting pa[TAB] expands to

$hg qqueue pa
partial4upload    partial4upload-1  patches
address@hidden:/NREF-COMM-CENTRAL/comm-central/mozilla$ hg qqueue pa

Very nice.

However, due to various reasons, I prefer to run bash inside Emacs's shell buffer. It is easy to copy&paste the result of bash output and reuse commands is one reason. (I am so used to keyboard and copy&paste using mouse or other pointing device takes much longer.)

Unfortunately, bash's completion feature does not work in Emacs shell mode.
Obviously, [TAB] is stolen by Emacs for its own handling of TAB character.
Emacs's tab completion for filenames works great.
But I would like Bash's completion somehow works, too.

Is there a way?
Am I missing the obvious?
(Does using eshell mode helps?)

TIA



reply via email to

[Prev in Thread] Current Thread [Next in Thread]