* shell prompt undesired characters
@ 2009-04-08 17:00 Dan Davison
2009-04-08 17:25 ` Peter Dyballa
2009-04-08 17:28 ` Peter Dyballa
0 siblings, 2 replies; 7+ messages in thread
From: Dan Davison @ 2009-04-08 17:00 UTC (permalink / raw)
To: help-gnu-emacs mailing list
I am having trouble getting a clean prompt with bash running under M-x
shell. Each line in the shell starts with
^[]0;~\a
(
I don't know how those two control characters will appear to you; what I
see in my emacs buffer is
^[]0;~^G
)
This is true if I set PS1='', so I believe my problem is not related to
escape characters in $PS1 (in fact they work fine if I use them).
I have tried with the system default .bashrc and the problem
persists. However, if I change to sh, then I get a normal, clean prompt
that displays just the contents of PS1.
Where are the strange initial characters above coming from when I run a
bash shell in emacs and how can I fix it?
Thanks a lot,
Dan
emacs 23.0.60.1
ubuntu 8.10
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: shell prompt undesired characters
2009-04-08 17:00 shell prompt undesired characters Dan Davison
@ 2009-04-08 17:25 ` Peter Dyballa
2009-04-08 17:53 ` Dan Davison
2009-04-08 17:28 ` Peter Dyballa
1 sibling, 1 reply; 7+ messages in thread
From: Peter Dyballa @ 2009-04-08 17:25 UTC (permalink / raw)
To: Dan Davison; +Cc: help-gnu-emacs mailing list
Am 08.04.2009 um 19:00 schrieb Dan Davison:
> Where are the strange initial characters above coming from when I
> run a
> bash shell in emacs and how can I fix it?
In ~/.emacs_bash you can set many things for a bash interpreter
running *shell* buffer (similarly for sh, csh, tcsh, ksh, ...). The
partial ANSI Esc code you gave looks like a reset/set normal of
previous colour or effect setting. It might work better when you add:
(add-hook 'shell-mode-hook (lambda ()
(ansi-color-for-comint-mode-on)))
--
Greetings
Pete
There's no place like 127.0.0.1
– origin unknown
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: shell prompt undesired characters
2009-04-08 17:00 shell prompt undesired characters Dan Davison
2009-04-08 17:25 ` Peter Dyballa
@ 2009-04-08 17:28 ` Peter Dyballa
1 sibling, 0 replies; 7+ messages in thread
From: Peter Dyballa @ 2009-04-08 17:28 UTC (permalink / raw)
To: Dan Davison; +Cc: help-gnu-emacs mailing list
Am 08.04.2009 um 19:00 schrieb Dan Davison:
> ^G
This is a BEL sound.
--
Greetings
Pete
A morning without coffee is like something without something else.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: shell prompt undesired characters
2009-04-08 17:25 ` Peter Dyballa
@ 2009-04-08 17:53 ` Dan Davison
2009-04-08 18:15 ` Peter Dyballa
2009-04-11 0:03 ` Alex Bennee
0 siblings, 2 replies; 7+ messages in thread
From: Dan Davison @ 2009-04-08 17:53 UTC (permalink / raw)
To: Peter Dyballa; +Cc: help-gnu-emacs mailing list
Peter Dyballa <Peter_Dyballa@web.de> writes:
> Am 08.04.2009 um 19:00 schrieb Dan Davison:
>
>> Where are the strange initial characters above coming from when I
>> run a
>> bash shell in emacs and how can I fix it?
>
>
> In ~/.emacs_bash you can set many things for a bash interpreter
> running *shell* buffer (similarly for sh, csh, tcsh, ksh, ...). The
> partial ANSI Esc code you gave looks like a reset/set normal of
> previous colour or effect setting. It might work better when you add:
>
> (add-hook 'shell-mode-hook (lambda ()
> (ansi-color-for-comint-mode-on)))
Thanks, but unfortunately that doesn't solve it. I've tried without any
~/.emacs and ~/.bashrc, on emacs22, and I still get those initial
characters. They're not coming from $PS1, so where are they coming from?
Dan
>
> --
> Greetings
>
> Pete
>
> There's no place like 127.0.0.1
> – origin unknown
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: shell prompt undesired characters
2009-04-08 17:53 ` Dan Davison
@ 2009-04-08 18:15 ` Peter Dyballa
2009-04-11 0:03 ` Alex Bennee
1 sibling, 0 replies; 7+ messages in thread
From: Peter Dyballa @ 2009-04-08 18:15 UTC (permalink / raw)
To: Dan Davison; +Cc: help-gnu-emacs mailing list
Am 08.04.2009 um 19:53 schrieb Dan Davison:
> I've tried without any
> ~/.emacs
I mentioned ~/.emacs_bash – it only customises bash when run inside
*shell* buffer. And this file is more useful than a car because it
can switch off so many things that are fine in a (dumb) terminal
emulation which GNU Emacs can do better.
> and ~/.bashrc, on emacs22, and I still get those initial
> characters.
Bash uses much more files, see 'man bash' or other bash documentation
(obviously there are good reasons why I don't use bash by default).
> They're not coming from $PS1, so where are they coming from?
Can you also check the meaning of PS1 in GNU Emacs's *shell* buffer?
In a terminal I have
PS1='\e[34;47;1m\j-\[\033[0;32m\]ttyp\[\033[0;31m\]://\[\033[0;32m\]
pete\[\033[0;31m\]:5\[\033[0;34m\]${PWD/$HOME//~pete}\e[33;46;1m \! /\
\ \[\033[0m\]'
in *shell* buffer it's
PS1='\h:\w \u\$ '
Thanks to ~/.emacs_bash, which does not contain ELisp but shell code:
PATH=$(defaults read "${HOME}/.MacOSX/environment" PATH)
MANPATH=$(defaults read "${HOME}/.MacOSX/environment" MANPATH)
PS1='\h:\w \u\$ '
unset DYLD_LIBRARY_PATH
BASH_ENV=${HOME}/Library/init/bash/aliases.mine
--
Greetings
Pete
They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety.
-Benjamin Franklin, Historical Review of Pennsylvania.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: shell prompt undesired characters
2009-04-08 17:53 ` Dan Davison
2009-04-08 18:15 ` Peter Dyballa
@ 2009-04-11 0:03 ` Alex Bennee
2009-04-11 0:49 ` Dan Davison
1 sibling, 1 reply; 7+ messages in thread
From: Alex Bennee @ 2009-04-11 0:03 UTC (permalink / raw)
To: Dan Davison; +Cc: help-gnu-emacs mailing list
2009/4/9 Dan Davison <davison@stats.ox.ac.uk>:
> Thanks, but unfortunately that doesn't solve it. I've tried without any
> ~/.emacs and ~/.bashrc, on emacs22, and I still get those initial
> characters. They're not coming from $PS1, so where are they coming from?
PS2? Bash has a whole bunch of env variables for various things,
including one for a
command to run after every line. I'd just do an 'env' and grep through
for anything that
looks like an escape character.
--
Alex, homepage: http://www.bennee.com/~alex/
CV: http://www.bennee.com/~alex/cv.php
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: shell prompt undesired characters
2009-04-11 0:03 ` Alex Bennee
@ 2009-04-11 0:49 ` Dan Davison
0 siblings, 0 replies; 7+ messages in thread
From: Dan Davison @ 2009-04-11 0:49 UTC (permalink / raw)
To: Alex Bennee; +Cc: help-gnu-emacs mailing list
Alex Bennee <kernel-hacker@bennee.com> writes:
> 2009/4/9 Dan Davison <davison@stats.ox.ac.uk>:
>> Thanks, but unfortunately that doesn't solve it. I've tried without any
>> ~/.emacs and ~/.bashrc, on emacs22, and I still get those initial
>> characters. They're not coming from $PS1, so where are they coming from?
>
> PS2? Bash has a whole bunch of env variables for various things,
> including one for a
> command to run after every line. I'd just do an 'env' and grep through
> for anything that
> looks like an escape character.
You're right; that revealed that the answer was $PROMPT_COMMAND. So it
looks like that'll be something to set in ~/.emacs_bash. I should have
looked into this more thoroughly myself... Thanks Peter and Alex for
replies.
Dan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-04-11 0:49 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-08 17:00 shell prompt undesired characters Dan Davison
2009-04-08 17:25 ` Peter Dyballa
2009-04-08 17:53 ` Dan Davison
2009-04-08 18:15 ` Peter Dyballa
2009-04-11 0:03 ` Alex Bennee
2009-04-11 0:49 ` Dan Davison
2009-04-08 17:28 ` Peter Dyballa
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).