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

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

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


From: Dan Hitt
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

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



reply via email to

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