From: Dan Hitt <dan.hitt@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Question: Is there any way to use the bash completion feature from Emacs shell mode.
Date: Mon, 10 Oct 2016 07:13:42 -0700 [thread overview]
Message-ID: <CAOphizKkUtjLiEGy74UMHWPYpFoNVoGtfa1HhVu+AErs2SY7Fw@mail.gmail.com> (raw)
In-Reply-To: <CAOphizLGxuqYFs0dM-==PpFz96X20Zjk9F48tC2=VQP9q6_gWg@mail.gmail.com>
Eli, sorry for double-posting so quickly.
But one example where emacs doesn't work as well as bash is emacs can
get confused over what directory you are in.
For example, if you have a bash alias that switches directory, emacs
cannot monitor it.
Then it will not know how to complete.
So that makes you hesitant to write little bash scripts that change
around your directory, because you know emacs will never track them.
I think term potentially can overcome that limitation, so we'll try it
out and see, although i can imagine that it may be confusing to switch
from Control-X to Control-C.
dan
On Mon, Oct 10, 2016 at 7:05 AM, Dan Hitt <dan.hitt@gmail.com> wrote:
> Tab completion certainly works, but it's the emacs completion, not the
> bash completion.
>
> Unfortunately, i don't have a good example of the difference right
> now, but i'll bet Chiaki does.
>
> (Bash can be much more intelligent about how to complete than emacs,
> of course, because it has a much sharper picture of what the user is
> doing and how the user is configured, while all emacs can do is
> observe from a distance.)
>
> Now, Bob's suggestion to use term-mode may just work, not sure.
>
> I never used term mode since trying it out a few decades ago, because
> i would get stuck in a buffer and not be able to get out --- unless it
> was a graphical emacs and i could use the mouse to choose another
> buffer --- but that would defeat the whole power of parking the mouse
> and controlling everything by the keyboard.
>
> However, Bob said that you substitute Control X with Control C, and
> man that works.
>
> So you can switch buffers using, e.g., Control-C o.
>
> I'd still be interested in a more deeply integrated bash, but if term
> doesn't have other problems, it's a very good proxy.
>
> dan
>
> On Sun, Oct 9, 2016 at 11:06 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>>> From: Dan Hitt <dan.hitt@gmail.com>
>>> Date: Sun, 9 Oct 2016 11:11:24 -0700
>>> Cc: help-gnu-emacs@gnu.org
>>>
>>> On Sat, Oct 8, 2016 at 12:14 PM, ISHIKAWA,chiaki <ishikawa@yk.rim.or.jp> wrote:
>>> > 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.
>>> >
>>> .......
>>> > 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.
>>>
>>> This is also my experience (in almost every detail).
>>>
>>> As the OP says, emacs has improved over the decades, and all the time
>>> new features are showing up, such as ibuffer. And emacs can do a lot
>>> of tricks, such as looking at jpg files.
>>>
>>> So, perhaps there is some mode like octave mode, that could run a bash
>>> shell with much deeper integration (perhaps by keeping a second
>>> interface to the inferior bash, such as through a socket or
>>> something?)? Or perhaps instead of bash it could be some derivative
>>> of bash? Or some derivative of zsh?
>>
>> I guess I don't understand what you guys are saying, because
>> completion with TAB and M-? keys does work for me in shell-mode. I
>> see completion on commands, files, and environment variables.
>>
>> What am I missing?
>>
next prev parent reply other threads:[~2016-10-10 14:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-08 19:14 Question: Is there any way to use the bash completion feature from Emacs shell mode ISHIKAWA,chiaki
2016-10-09 18:11 ` Dan Hitt
2016-10-10 6:06 ` Eli Zaretskii
2016-10-10 14:05 ` Dan Hitt
2016-10-10 14:13 ` Dan Hitt [this message]
2016-10-11 1:02 ` Bob Proulx
2016-10-11 0:59 ` Bob Proulx
2016-10-11 12:12 ` Filipp Gunbin
2016-10-10 0:49 ` Bob Proulx
2016-10-10 13:40 ` Oleksandr Gavenko
2016-10-10 23:24 ` Dmitry Gutov
2016-10-12 0:25 ` ISHIKAWA,chiaki
2016-10-12 18:50 ` Oleksandr Gavenko
2016-10-19 1:12 ` Robert Thorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOphizKkUtjLiEGy74UMHWPYpFoNVoGtfa1HhVu+AErs2SY7Fw@mail.gmail.com \
--to=dan.hitt@gmail.com \
--cc=eliz@gnu.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).