all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Running bash inside emacs
@ 2005-05-03 16:47 Madhusudan Singh
  2005-05-03 18:29 ` Pascal Bourguignon
  2005-05-03 19:06 ` Adrian Aichner
  0 siblings, 2 replies; 10+ messages in thread
From: Madhusudan Singh @ 2005-05-03 16:47 UTC (permalink / raw)


Hi

 I was wondering if it is possible to run a bash shell inside an emacs
buffer (where the up and down keys recall commands executed
in .bash_history and do not move the cursor around -- the problem with the
native shell available in emacs, tab results in command completion, etc.).

Thanks.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Running bash inside emacs
  2005-05-03 16:47 Running bash inside emacs Madhusudan Singh
@ 2005-05-03 18:29 ` Pascal Bourguignon
  2005-05-03 18:52   ` Madhusudan Singh
  2005-05-03 19:06 ` Adrian Aichner
  1 sibling, 1 reply; 10+ messages in thread
From: Pascal Bourguignon @ 2005-05-03 18:29 UTC (permalink / raw)


Madhusudan Singh <spammers-go-here@spam.invalid> writes:
>  I was wondering if it is possible to run a bash shell inside an emacs
> buffer (where the up and down keys recall commands executed
> in .bash_history and do not move the cursor around -- the problem with the
> native shell available in emacs, tab results in command completion, etc.).

M-x shell RET

Since emacs implement its own history and completion, the keys are
usually bound to emacs functions, and not passed to the inferior
shell.  

If you want to run an old command from ~/.bash_history, you could type:

sort -u < ~/.bash_history

then move to the line with the command and type RET.



-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Cats meow out of angst
"Thumbs! If only we had thumbs!
We could break so much!"

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Running bash inside emacs
  2005-05-03 18:29 ` Pascal Bourguignon
@ 2005-05-03 18:52   ` Madhusudan Singh
  2005-05-03 19:13     ` Walker Pendleton
                       ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Madhusudan Singh @ 2005-05-03 18:52 UTC (permalink / raw)


Pascal Bourguignon wrote:

> Madhusudan Singh <spammers-go-here@spam.invalid> writes:
>>  I was wondering if it is possible to run a bash shell inside an emacs
>> buffer (where the up and down keys recall commands executed
>> in .bash_history and do not move the cursor around -- the problem with
>> the native shell available in emacs, tab results in command completion,
>> etc.).
> 
> M-x shell RET
> 
> Since emacs implement its own history and completion, the keys are
> usually bound to emacs functions, and not passed to the inferior
> shell.
> 
> If you want to run an old command from ~/.bash_history, you could type:
> 
> sort -u < ~/.bash_history
> 
> then move to the line with the command and type RET.
> 
> 
> 

Thanks for your response. I posted this question because I am not
comfortable with the solution you showed.

Typing in sort commands, etc. when you can just open up a native bash shell
and use up/down keys to your heart's content, does not make any sense at
all. This is especially important when you are debugging some code and need
access to the shell, repeatedly. The solution you list would be a
horrendous waste of typing and time in that case.

Maybe it is time for a M-x bash RET.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Running bash inside emacs
  2005-05-03 16:47 Running bash inside emacs Madhusudan Singh
  2005-05-03 18:29 ` Pascal Bourguignon
@ 2005-05-03 19:06 ` Adrian Aichner
  1 sibling, 0 replies; 10+ messages in thread
From: Adrian Aichner @ 2005-05-03 19:06 UTC (permalink / raw)


Madhusudan Singh <spammers-go-here@spam.invalid> writes:

> Hi
>
>  I was wondering if it is possible to run a bash shell inside an emacs
> buffer (where the up and down keys recall commands executed
> in .bash_history and do not move the cursor around -- the problem with the
> native shell available in emacs, tab results in command completion, etc.).

Why don't you do it the X?Emacs way and use
M-n runs the command comint-next-matching-input-from-input
M-p runs the command comint-previous-matching-input-from-input
for history.

To insert avoid
TAB runs the command comint-dynamic-complete
use C-q TAB instead

C-q runs the command quoted-insert

Hope this helps,

Adrian

>
> Thanks.

-- 
Adrian Aichner
 mailto:adrian@xemacs.org
 http://www.xemacs.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Running bash inside emacs
  2005-05-03 18:52   ` Madhusudan Singh
@ 2005-05-03 19:13     ` Walker Pendleton
  2005-05-03 19:57       ` Madhusudan Singh
  2005-05-03 19:24     ` J. David Boyd
                       ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Walker Pendleton @ 2005-05-03 19:13 UTC (permalink / raw)


On  3 May 2005, Madhusudan Singh wrote:

[...]

> Typing in sort commands, etc. when you can just open up a native
> bash shell and use up/down keys to your heart's content, does not
> make any sense at all.

[...]

> Maybe it is time for a M-x bash RET.

If you don't see any sense in getting Emacs to help you, but merely
want to run your shell in Emacs, perhaps M-x term RET will be more to
your liking.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Running bash inside emacs
  2005-05-03 18:52   ` Madhusudan Singh
  2005-05-03 19:13     ` Walker Pendleton
@ 2005-05-03 19:24     ` J. David Boyd
  2005-05-03 22:53     ` Tim X
  2005-05-04 10:11     ` Phillip Lord
  3 siblings, 0 replies; 10+ messages in thread
From: J. David Boyd @ 2005-05-03 19:24 UTC (permalink / raw)


Madhusudan Singh <spammers-go-here@spam.invalid> writes:

> Pascal Bourguignon wrote:
> 
> Thanks for your response. I posted this question because I am not
> comfortable with the solution you showed.
> 
> Typing in sort commands, etc. when you can just open up a native bash shell
> and use up/down keys to your heart's content, does not make any sense at
> all. This is especially important when you are debugging some code and need
> access to the shell, repeatedly. The solution you list would be a
> horrendous waste of typing and time in that case.
> 
> Maybe it is time for a M-x bash RET.

I use Ctrl-UpArrow and Ctrl-DownArrow to scroll through my history list, and I
have my default shell set to be bash.  Works fine.

Dave

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Running bash inside emacs
  2005-05-03 19:13     ` Walker Pendleton
@ 2005-05-03 19:57       ` Madhusudan Singh
  0 siblings, 0 replies; 10+ messages in thread
From: Madhusudan Singh @ 2005-05-03 19:57 UTC (permalink / raw)


Walker Pendleton wrote:

> On  3 May 2005, Madhusudan Singh wrote:
> 
> [...]
> 
>> Typing in sort commands, etc. when you can just open up a native
>> bash shell and use up/down keys to your heart's content, does not
>> make any sense at all.
> 
> [...]
> 
>> Maybe it is time for a M-x bash RET.
> 
> If you don't see any sense in getting Emacs to help you, but merely
> want to run your shell in Emacs, perhaps M-x term RET will be more to
> your liking.

Precisely what I was looking for. Thanks !!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Running bash inside emacs
  2005-05-03 18:52   ` Madhusudan Singh
  2005-05-03 19:13     ` Walker Pendleton
  2005-05-03 19:24     ` J. David Boyd
@ 2005-05-03 22:53     ` Tim X
  2005-05-04 10:11     ` Phillip Lord
  3 siblings, 0 replies; 10+ messages in thread
From: Tim X @ 2005-05-03 22:53 UTC (permalink / raw)


Madhusudan Singh <spammers-go-here@spam.invalid> writes:

> Pascal Bourguignon wrote:
>
>> Madhusudan Singh <spammers-go-here@spam.invalid> writes:
>>>  I was wondering if it is possible to run a bash shell inside an emacs
>>> buffer (where the up and down keys recall commands executed
>>> in .bash_history and do not move the cursor around -- the problem with
>>> the native shell available in emacs, tab results in command completion,
>>> etc.).
>> 
>> M-x shell RET
>> 
>> Since emacs implement its own history and completion, the keys are
>> usually bound to emacs functions, and not passed to the inferior
>> shell.
>> 
>> If you want to run an old command from ~/.bash_history, you could type:
>> 
>> sort -u < ~/.bash_history
>> 
>> then move to the line with the command and type RET.
>> 
>> 
>> 
>
> Thanks for your response. I posted this question because I am not
> comfortable with the solution you showed.
>
> Typing in sort commands, etc. when you can just open up a native bash shell
> and use up/down keys to your heart's content, does not make any sense at
> all. This is especially important when you are debugging some code and need
> access to the shell, repeatedly. The solution you list would be a
> horrendous waste of typing and time in that case.
>

You have a number of choices -

M-x term <ret>

M-x shell <ret> (note you need to use C-up/C-down to get the command
line history.

Also, don't discount eshell too quickly - it is very powerful and
offers a lot of functionality which is not obvious straight away.

Tim



-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Running bash inside emacs
  2005-05-03 18:52   ` Madhusudan Singh
                       ` (2 preceding siblings ...)
  2005-05-03 22:53     ` Tim X
@ 2005-05-04 10:11     ` Phillip Lord
  2005-05-05 17:08       ` Kevin Rodgers
  3 siblings, 1 reply; 10+ messages in thread
From: Phillip Lord @ 2005-05-04 10:11 UTC (permalink / raw)



>>>>> "Madhusudan" == Madhusudan Singh <spammers-go-here@spam.invalid> writes:

  Madhusudan> Thanks for your response. I posted this question because
  Madhusudan> I am not comfortable with the solution you showed.

  Madhusudan> Typing in sort commands, etc. when you can just open up
  Madhusudan> a native bash shell and use up/down keys to your heart's
  Madhusudan> content, does not make any sense at all. 

You can access a history with C-p and C-n. Why these are not bound to
up and down arrow by default, I really never understood. 

  Madhusudan> This is especially important when you are debugging some
  Madhusudan> code and need access to the shell, repeatedly. The
  Madhusudan> solution you list would be a horrendous waste of typing
  Madhusudan> and time in that case.

You're debugging bash code? I normally use mode-compile.el for
this. Basically, it runs bash with lots of debug output. 

I wonder whether GUD works on bash, that would be nice. 

  Madhusudan> Maybe it is time for a M-x bash RET.

It requires that you have bash. M-x shell also works with DOS, or many
other shells. 

Phil

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Running bash inside emacs
  2005-05-04 10:11     ` Phillip Lord
@ 2005-05-05 17:08       ` Kevin Rodgers
  0 siblings, 0 replies; 10+ messages in thread
From: Kevin Rodgers @ 2005-05-05 17:08 UTC (permalink / raw)


Phillip Lord wrote:
 > You can access a history with C-p and C-n.

I think you mean M-p and M-n, plus C-<up> and C-<down>.

 > Why these are not bound to up and down arrow by default, I really
 > never understood.

Because the arrow keys move up and down within the buffer, regardless of
mode.  This is a good thing.

 >   Madhusudan> Maybe it is time for a M-x bash RET.
 >
 > It requires that you have bash. M-x shell also works with DOS, or many
 > other shells.

I was going to refer you to http://www.emacswiki.org/elisp/defshell.el,
but it looks like it's suffering from a mild case of bit rot.

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-05-05 17:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-03 16:47 Running bash inside emacs Madhusudan Singh
2005-05-03 18:29 ` Pascal Bourguignon
2005-05-03 18:52   ` Madhusudan Singh
2005-05-03 19:13     ` Walker Pendleton
2005-05-03 19:57       ` Madhusudan Singh
2005-05-03 19:24     ` J. David Boyd
2005-05-03 22:53     ` Tim X
2005-05-04 10:11     ` Phillip Lord
2005-05-05 17:08       ` Kevin Rodgers
2005-05-03 19:06 ` Adrian Aichner

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.