unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How do I remove the extra bash-3.2$ from shell-mode?
@ 2015-05-04 20:48 Andrew Pennebaker
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Pennebaker @ 2015-05-04 20:48 UTC (permalink / raw)
  To: Emacs Help

Help, the first line of my shell-mode has an extra bash-3.2$ prompt before
my git prompt.

I tried writing PROMPT_COMMAND= in my ~/.bashrc according to an earlier
Stack Overflow post, but bash-3.2$ continues to display anyway.

M-x shell-mode RET

Expected:

    dotfiles (master)$ RET
    dotfiles (master)$ RET
    dotfiles (master)$ RET

Observed:

    bash-3.2$ dotfiles (master)$ RET
    dotfiles (master)$ RET
    dotfiles (master)$ RET

Configuration:

* https://github.com/mcandre/dotfiles/blob/master/.emacs
* https://github.com/mcandre/dotfiles/blob/master/.emacs_bash
* https://github.com/mcandre/dotfiles/blob/master/.bash_profile
* https://github.com/mcandre/dotfiles/blob/master/.bashrc
* https://github.com/mcandre/dotfiles/tree/master/.bashrc.d
* https://github.com/mcandre/dotfiles/tree/master/.bash_profile.d

System:

* emacs 24.4.1
* bash 3.2.57
* Mac OS X 10.10.3

-- 
Cheers,
Andrew


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

* Re: How do I remove the extra bash-3.2$ from shell-mode?
       [not found] <mailman.2337.1430772503.904.help-gnu-emacs@gnu.org>
@ 2015-05-04 20:50 ` Pascal J. Bourguignon
       [not found]   ` <mailman.2343.1430776948.904.help-gnu-emacs@gnu.org>
  2015-05-04 22:02   ` Andrew Pennebaker
  0 siblings, 2 replies; 9+ messages in thread
From: Pascal J. Bourguignon @ 2015-05-04 20:50 UTC (permalink / raw)
  To: help-gnu-emacs

Andrew Pennebaker <andrew.pennebaker@gmail.com> writes:

> Help, the first line of my shell-mode has an extra bash-3.2$ prompt before
> my git prompt.
>
> I tried writing PROMPT_COMMAND= in my ~/.bashrc according to an earlier
> Stack Overflow post, but bash-3.2$ continues to display anyway.

What about reading man bash?
Stackoverflow will never replace documentation!
Emacs has a couple of nice commands to read unix manual pages.
Try: M-x man RET bash RET

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


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

* Re: How do I remove the extra bash-3.2$ from shell-mode?
       [not found]   ` <mailman.2343.1430776948.904.help-gnu-emacs@gnu.org>
@ 2015-05-04 21:58     ` Pascal J. Bourguignon
  2015-05-04 22:00       ` Pascal J. Bourguignon
  0 siblings, 1 reply; 9+ messages in thread
From: Pascal J. Bourguignon @ 2015-05-04 21:58 UTC (permalink / raw)
  To: help-gnu-emacs

Andrew Pennebaker <andrew.pennebaker@gmail.com> writes:

> Could you be more specific?

Use the features of emacs, like, say, C-s

> On Mon, May 4, 2015 at 3:50 PM, Pascal J. Bourguignon <pjb@informatimago.com
>> wrote:
>
>> Andrew Pennebaker <andrew.pennebaker@gmail.com> writes:
>>
>> > Help, the first line of my shell-mode has an extra bash-3.2$ prompt
>> before
>> > my git prompt.
>> >
>> > I tried writing PROMPT_COMMAND= in my ~/.bashrc according to an earlier
>> > Stack Overflow post, but bash-3.2$ continues to display anyway.
>>
>> What about reading man bash?
>> Stackoverflow will never replace documentation!
>> Emacs has a couple of nice commands to read unix manual pages.
>> Try: M-x man RET bash RET
>>
>> --
>> __Pascal Bourguignon__                 http://www.informatimago.com/
>> “The factory of the future will have only two employees, a man and a
>> dog. The man will be there to feed the dog. The dog will be there to
>> keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
>>

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


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

* Re: How do I remove the extra bash-3.2$ from shell-mode?
  2015-05-04 21:58     ` Pascal J. Bourguignon
@ 2015-05-04 22:00       ` Pascal J. Bourguignon
  2015-05-05  0:09         ` Andrew Pennebaker
       [not found]         ` <mailman.2355.1430784572.904.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 9+ messages in thread
From: Pascal J. Bourguignon @ 2015-05-04 22:00 UTC (permalink / raw)
  To: help-gnu-emacs

"Pascal J. Bourguignon" <pjb@informatimago.com> writes:

> Andrew Pennebaker <andrew.pennebaker@gmail.com> writes:
>
>> Could you be more specific?
>
> Use the features of emacs, like, say, C-s

Actually, no.

The point of unix manual page is that they should be READ!

You should definitely read the manual page of bash from begin to end.

I know it's one of the biggest pages, nonetheless, since bash is a
program you're using all the time, you should read its documentation.

There's no way out.


>> On Mon, May 4, 2015 at 3:50 PM, Pascal J. Bourguignon <pjb@informatimago.com
>>> wrote:
>>
>>> Andrew Pennebaker <andrew.pennebaker@gmail.com> writes:
>>>
>>> > Help, the first line of my shell-mode has an extra bash-3.2$ prompt
>>> before
>>> > my git prompt.
>>> >
>>> > I tried writing PROMPT_COMMAND= in my ~/.bashrc according to an earlier
>>> > Stack Overflow post, but bash-3.2$ continues to display anyway.
>>>
>>> What about reading man bash?
>>> Stackoverflow will never replace documentation!
>>> Emacs has a couple of nice commands to read unix manual pages.
>>> Try: M-x man RET bash RET
>>>
>>> --
>>> __Pascal Bourguignon__                 http://www.informatimago.com/
>>> “The factory of the future will have only two employees, a man and a
>>> dog. The man will be there to feed the dog. The dog will be there to
>>> keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
>>>

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


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

* Re: How do I remove the extra bash-3.2$ from shell-mode?
  2015-05-04 20:50 ` How do I remove the extra bash-3.2$ from shell-mode? Pascal J. Bourguignon
       [not found]   ` <mailman.2343.1430776948.904.help-gnu-emacs@gnu.org>
@ 2015-05-04 22:02   ` Andrew Pennebaker
  1 sibling, 0 replies; 9+ messages in thread
From: Andrew Pennebaker @ 2015-05-04 22:02 UTC (permalink / raw)
  To: Pascal J. Bourguignon; +Cc: Emacs Help

Could you be more specific?

On Mon, May 4, 2015 at 3:50 PM, Pascal J. Bourguignon <pjb@informatimago.com
> wrote:

> Andrew Pennebaker <andrew.pennebaker@gmail.com> writes:
>
> > Help, the first line of my shell-mode has an extra bash-3.2$ prompt
> before
> > my git prompt.
> >
> > I tried writing PROMPT_COMMAND= in my ~/.bashrc according to an earlier
> > Stack Overflow post, but bash-3.2$ continues to display anyway.
>
> What about reading man bash?
> Stackoverflow will never replace documentation!
> Emacs has a couple of nice commands to read unix manual pages.
> Try: M-x man RET bash RET
>
> --
> __Pascal Bourguignon__                 http://www.informatimago.com/
> “The factory of the future will have only two employees, a man and a
> dog. The man will be there to feed the dog. The dog will be there to
> keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
>



-- 
Cheers,
Andrew


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

* Re: How do I remove the extra bash-3.2$ from shell-mode?
  2015-05-04 22:00       ` Pascal J. Bourguignon
@ 2015-05-05  0:09         ` Andrew Pennebaker
  2015-05-05  0:37           ` Robert Thorpe
       [not found]         ` <mailman.2355.1430784572.904.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 9+ messages in thread
From: Andrew Pennebaker @ 2015-05-05  0:09 UTC (permalink / raw)
  To: Pascal J. Bourguignon; +Cc: Emacs Help

Emacs seems to be printing its default PS1 prompt before emacs_bash has
fully executed. Is there a way to suppress this?

On Mon, May 4, 2015 at 5:00 PM, Pascal J. Bourguignon <pjb@informatimago.com
> wrote:

> "Pascal J. Bourguignon" <pjb@informatimago.com> writes:
>
> > Andrew Pennebaker <andrew.pennebaker@gmail.com> writes:
> >
> >> Could you be more specific?
> >
> > Use the features of emacs, like, say, C-s
>
> Actually, no.
>
> The point of unix manual page is that they should be READ!
>
> You should definitely read the manual page of bash from begin to end.
>
> I know it's one of the biggest pages, nonetheless, since bash is a
> program you're using all the time, you should read its documentation.
>
> There's no way out.
>
>
> >> On Mon, May 4, 2015 at 3:50 PM, Pascal J. Bourguignon <
> pjb@informatimago.com
> >>> wrote:
> >>
> >>> Andrew Pennebaker <andrew.pennebaker@gmail.com> writes:
> >>>
> >>> > Help, the first line of my shell-mode has an extra bash-3.2$ prompt
> >>> before
> >>> > my git prompt.
> >>> >
> >>> > I tried writing PROMPT_COMMAND= in my ~/.bashrc according to an
> earlier
> >>> > Stack Overflow post, but bash-3.2$ continues to display anyway.
> >>>
> >>> What about reading man bash?
> >>> Stackoverflow will never replace documentation!
> >>> Emacs has a couple of nice commands to read unix manual pages.
> >>> Try: M-x man RET bash RET
> >>>
> >>> --
> >>> __Pascal Bourguignon__                 http://www.informatimago.com/
> >>> “The factory of the future will have only two employees, a man and a
> >>> dog. The man will be there to feed the dog. The dog will be there to
> >>> keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
> >>>
>
> --
> __Pascal Bourguignon__                 http://www.informatimago.com/
> “The factory of the future will have only two employees, a man and a
> dog. The man will be there to feed the dog. The dog will be there to
> keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
>



-- 
Cheers,
Andrew


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

* Re: How do I remove the extra bash-3.2$ from shell-mode?
       [not found]         ` <mailman.2355.1430784572.904.help-gnu-emacs@gnu.org>
@ 2015-05-05  0:20           ` Pascal J. Bourguignon
  0 siblings, 0 replies; 9+ messages in thread
From: Pascal J. Bourguignon @ 2015-05-05  0:20 UTC (permalink / raw)
  To: help-gnu-emacs

Andrew Pennebaker <andrew.pennebaker@gmail.com> writes:

> Emacs seems to be printing its default PS1 prompt before emacs_bash has
> fully executed. Is there a way to suppress this?

Just add:

echo '# welcome to emacs shell' 

at the end of your ~/.emacs_bash file, and it is "~/.emacs_bash", not
"emacs_bash"!!!!!!!!

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


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

* Re: How do I remove the extra bash-3.2$ from shell-mode?
  2015-05-05  0:09         ` Andrew Pennebaker
@ 2015-05-05  0:37           ` Robert Thorpe
  2015-05-05  1:42             ` Andrew Pennebaker
  0 siblings, 1 reply; 9+ messages in thread
From: Robert Thorpe @ 2015-05-05  0:37 UTC (permalink / raw)
  To: Andrew Pennebaker; +Cc: pjb, help-gnu-emacs

Andrew Pennebaker <andrew.pennebaker@gmail.com> writes:

> Emacs seems to be printing its default PS1 prompt before emacs_bash has
> fully executed. Is there a way to suppress this?

I think the problem is that bash prints out the prompt when it starts.
It's only after it has read the line changing the prompt that it can
actually change the prompt.

The info manual says "The value of the variable `PROMPT_COMMAND' is
examined just before Bash prints each primary prompt."  So, at the start
of the .bashrc it has the wrong value, so one line is wrong.

I think you have to use -p to change the value for the first line.

I think your environment is configured oddly if you're seeing this
prompt at all.

BR,
Robert Thorpe



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

* Re: How do I remove the extra bash-3.2$ from shell-mode?
  2015-05-05  0:37           ` Robert Thorpe
@ 2015-05-05  1:42             ` Andrew Pennebaker
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Pennebaker @ 2015-05-05  1:42 UTC (permalink / raw)
  To: Robert Thorpe; +Cc: Pascal Bourguignon, Emacs Help

Thank you for pointing that out. Turns out I was loading my git prompt with
.bash_profile, but not with .bashrc, after I had changed the load style of
my bash configuration for speed.

I've created
https://github.com/mcandre/dotfiles/blob/master/.bashrc.d/emacs-git-prompt.sh
to get the best of both worlds: fast shells, and idiomatic Emacs shell
prompts!

On Mon, May 4, 2015 at 7:37 PM, Robert Thorpe <rt@robertthorpeconsulting.com
> wrote:

> Andrew Pennebaker <andrew.pennebaker@gmail.com> writes:
>
> > Emacs seems to be printing its default PS1 prompt before emacs_bash has
> > fully executed. Is there a way to suppress this?
>
> I think the problem is that bash prints out the prompt when it starts.
> It's only after it has read the line changing the prompt that it can
> actually change the prompt.
>
> The info manual says "The value of the variable `PROMPT_COMMAND' is
> examined just before Bash prints each primary prompt."  So, at the start
> of the .bashrc it has the wrong value, so one line is wrong.
>
> I think you have to use -p to change the value for the first line.
>
> I think your environment is configured oddly if you're seeing this
> prompt at all.
>
> BR,
> Robert Thorpe
>



-- 
Cheers,
Andrew


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

end of thread, other threads:[~2015-05-05  1:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.2337.1430772503.904.help-gnu-emacs@gnu.org>
2015-05-04 20:50 ` How do I remove the extra bash-3.2$ from shell-mode? Pascal J. Bourguignon
     [not found]   ` <mailman.2343.1430776948.904.help-gnu-emacs@gnu.org>
2015-05-04 21:58     ` Pascal J. Bourguignon
2015-05-04 22:00       ` Pascal J. Bourguignon
2015-05-05  0:09         ` Andrew Pennebaker
2015-05-05  0:37           ` Robert Thorpe
2015-05-05  1:42             ` Andrew Pennebaker
     [not found]         ` <mailman.2355.1430784572.904.help-gnu-emacs@gnu.org>
2015-05-05  0:20           ` Pascal J. Bourguignon
2015-05-04 22:02   ` Andrew Pennebaker
2015-05-04 20:48 Andrew Pennebaker

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