all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* weird emacs shell behavior
@ 2007-08-17 16:54 phundamental unaudio
  2007-08-17 17:43 ` Peter Dyballa
  0 siblings, 1 reply; 12+ messages in thread
From: phundamental unaudio @ 2007-08-17 16:54 UTC (permalink / raw)
  To: help-gnu-emacs


[-- Attachment #1.1: Type: text/plain, Size: 299 bytes --]

hello, when i issue alt-x shell the prompt looks weird like this:
^[[32;1mvytas@clt-84-32-234-17:~>^[[0m
with those unnesecery  characters in the beginning and the end. im using
22.1.1
could anyone tell me what the problem could be?

-- 
for my music go here:
http://www.sporadic-fault.co.nr

[-- Attachment #1.2: Type: text/html, Size: 381 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: weird emacs shell behavior
       [not found] <mailman.4916.1187369678.32220.help-gnu-emacs@gnu.org>
@ 2007-08-17 17:36 ` Joel J. Adamson
  2007-08-17 18:19   ` Emilio Lopes
  0 siblings, 1 reply; 12+ messages in thread
From: Joel J. Adamson @ 2007-08-17 17:36 UTC (permalink / raw)
  To: help-gnu-emacs

"phundamental unaudio" <unaudio@gmail.com> writes:

>    hello, when i issue alt-x shell the prompt looks weird like this:
>    [32;1mvytas@clt-84-32-234-17:~>[0m
>    with those unnesecery  characters in the beginning and the end. im
>    using 22.1.1
>    could anyone tell me what the problem could be?

Yes, I can tell you ;)

The [32, etc are control characters that indicate colors.  Try turning
them off in your shell's rc file or use "M-x ansi-term" to see the
colors.  Or learn to use Dired, which replaces much shell
functionality (I hardly use a real command line now).

Joel

-- 
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109

"It can be interesting to study ancient philosophy, but more as a kind
of accident report than to teach you anything useful."
                                        --Paul Graham
					http://www.paulgraham.com/raq.html

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

* Re: weird emacs shell behavior
  2007-08-17 16:54 phundamental unaudio
@ 2007-08-17 17:43 ` Peter Dyballa
  0 siblings, 0 replies; 12+ messages in thread
From: Peter Dyballa @ 2007-08-17 17:43 UTC (permalink / raw)
  To: phundamental unaudio; +Cc: help-gnu-emacs


Am 17.08.2007 um 18:54 schrieb phundamental unaudio:

> when i issue alt-x shell the prompt looks weird like this:
> ^[[32;1mvytas@clt-84-32-234-17:~>^[[0m
> with those unnesecery  characters in the beginning and the end. im  
> using
> 22.1.1
> could anyone tell me what the problem could be?

Your bash prompt is creating ANSI Esc sequences to set colours or  
effects.

In GNU Emacs 22 you can invoke

	ansi-color-for-comint-mode-on

to make *shell* buffer interpret certain ANSI Esc sequences (you can  
also put it into an init file). You can use a file ~/.emacs_<shell  
interpreter's name> to adjust some settings for *shell* buffer. You  
would need to use that shell interpreter's syntax. For example, if  
your login shell is bash and you put

	PS1="$ "

into ~/.emacs_bash than you'll have a much shorter and monochrome  
prompt ...

--
Greetings

   Pete

Increase the size of your bike by at least *five* inches!

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

* Re: weird emacs shell behavior
  2007-08-17 17:36 ` weird emacs shell behavior Joel J. Adamson
@ 2007-08-17 18:19   ` Emilio Lopes
  2007-08-17 18:26     ` Joel J. Adamson
  2007-08-17 19:34     ` Tassilo Horn
  0 siblings, 2 replies; 12+ messages in thread
From: Emilio Lopes @ 2007-08-17 18:19 UTC (permalink / raw)
  To: help-gnu-emacs

Joel J Adamson writes:

> "phundamental unaudio" <unaudio@gmail.com> writes:
>> hello, when i issue alt-x shell the prompt looks weird like this:
>> [32;1mvytas@clt-84-32-234-17:~>[0m

> The [32, etc are control characters that indicate colors.  Try
> turning them off in your shell's rc file or use "M-x ansi-term" to
> see the colors.

No need to resort to `ansi-term', which is a full terminal-emulator.
You can have shell mode interpret those codes using
`ansi-color-for-comint-mode-on'.

-- 
Emílio C. Lopes
Munich, Germany

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

* Re: weird emacs shell behavior
  2007-08-17 18:19   ` Emilio Lopes
@ 2007-08-17 18:26     ` Joel J. Adamson
  2007-08-17 18:38       ` Emilio Lopes
  2007-08-17 19:34     ` Tassilo Horn
  1 sibling, 1 reply; 12+ messages in thread
From: Joel J. Adamson @ 2007-08-17 18:26 UTC (permalink / raw)
  To: help-gnu-emacs

Emilio Lopes <eclig@gmx.net> writes:

> Joel J Adamson writes:
> No need to resort to `ansi-term', which is a full terminal-emulator.
> You can have shell mode interpret those codes using
> `ansi-color-for-comint-mode-on'.

What's the difference between shell-mode and a terminal emulator?  I
had trouble getting used to shell-mode, so I refused to learn much
about it.

Joel

-- 
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109

"It can be interesting to study ancient philosophy, but more as a kind
of accident report than to teach you anything useful."
                                        --Paul Graham
					http://www.paulgraham.com/raq.html

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

* Re: weird emacs shell behavior
  2007-08-17 18:26     ` Joel J. Adamson
@ 2007-08-17 18:38       ` Emilio Lopes
  2007-08-17 19:40         ` Joel J. Adamson
  0 siblings, 1 reply; 12+ messages in thread
From: Emilio Lopes @ 2007-08-17 18:38 UTC (permalink / raw)
  To: help-gnu-emacs

Joel J Adamson writes:

> What's the difference between shell-mode and a terminal emulator?

`shell-mode' is a mode for running a command interpreter (in most
cases a shell) in an Emacs buffer.  All Emacs commands are available
and work as expected: pressing "C-p" will move the cursor to the
previous line, "C-w" will kill the region etc.

In the terminal emulator you can run *any* terminal program, be it a
shell, a mailer or even VI (forgive the heresy!).  How the keybindings
behave is dictated by the program running in the terminal.

If you want to run a terminal program like "trn", "less" or "lynx" you
have no option but `ansi-term'.  For running a command interpreter
`shell-mode' offers you the best of both worlds: you can run your shell
*and* have all Emacs text manipulation facilities at your disposal.

Note that in shell-mode the command line editing provided by the your
shell (e.g. "readline") is not available; "shell-mode" provides it's
own command line editing facilities.

-- 
Emílio C. Lopes
Munich, Germany

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

* Re: weird emacs shell behavior
  2007-08-17 18:19   ` Emilio Lopes
  2007-08-17 18:26     ` Joel J. Adamson
@ 2007-08-17 19:34     ` Tassilo Horn
  2007-08-17 21:09       ` Peter Dyballa
       [not found]       ` <mailman.4930.1187384971.32220.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 12+ messages in thread
From: Tassilo Horn @ 2007-08-17 19:34 UTC (permalink / raw)
  To: help-gnu-emacs

Emilio Lopes <eclig@gmx.net> writes:

Hi Emilio,

>> The [32, etc are control characters that indicate colors.  Try
>> turning them off in your shell's rc file or use "M-x ansi-term" to
>> see the colors.
>
> No need to resort to `ansi-term', which is a full terminal-emulator.
> You can have shell mode interpret those codes using
> `ansi-color-for-comint-mode-on'.

I did that and now I get nicely colored output, but still there are some
control characters left and each command is printed twice.

,----
| > echo "Hello, test!"  <== That's what I typed.  It's bold after RET
| > echo "Hello, test!"  <== After my RET the line gets repeated...
| ^[]2;echo  ~^GHello, test! <== After the ^G comes the output.
`----

Do you know what ^[ and ^G are for control chars and how I can get rid
of them?

If I do the same in an xterm I get

,----
| > echo "Hallo, test..."
| Hallo, test...
`----

without any coloring.  So what's confusing emacs here?

Bye,
Tassilo

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

* Re: weird emacs shell behavior
  2007-08-17 18:38       ` Emilio Lopes
@ 2007-08-17 19:40         ` Joel J. Adamson
  0 siblings, 0 replies; 12+ messages in thread
From: Joel J. Adamson @ 2007-08-17 19:40 UTC (permalink / raw)
  To: help-gnu-emacs

Emilio Lopes <eclig@gmx.net> writes:

> Joel J Adamson writes:
>
>> What's the difference between shell-mode and a terminal emulator?
> In the terminal emulator you can run *any* terminal program, be it a
> shell, a mailer or even VI (forgive the heresy!).  How the keybindings
> behave is dictated by the program running in the terminal.
>
> If you want to run a terminal program like "trn", "less" or "lynx" you
> have no option but `ansi-term'.  For running a command interpreter
> `shell-mode' offers you the best of both worlds: you can run your shell
> *and* have all Emacs text manipulation facilities at your disposal.
>
> Note that in shell-mode the command line editing provided by the your
> shell (e.g. "readline") is not available; "shell-mode" provides it's
> own command line editing facilities.

Those are my two reasons for preferring ansi-term.  I sometimes run
lynx in ansi-term.  When i'm using a terminal, I make extensive use of
command-line editing, so I didnt' like having the Emacs inter-line
commands work in the buffer instead of on the command line (ironic
though that is).

Joel

-- 
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109

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

* Re: weird emacs shell behavior
  2007-08-17 19:34     ` Tassilo Horn
@ 2007-08-17 21:09       ` Peter Dyballa
       [not found]       ` <mailman.4930.1187384971.32220.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 12+ messages in thread
From: Peter Dyballa @ 2007-08-17 21:09 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: help-gnu-emacs


Am 17.08.2007 um 21:34 schrieb Tassilo Horn:

> | > echo "Hello, test!"  <== That's what I typed.  It's bold after RET

It becomes interpreted as prompt. Check comint-prompt-regexp and  
shell-prompt-pattern.

> | > echo "Hello, test!"  <== After my RET the line gets repeated...

Again, it seems to be kept for the prompt?

> | ^[]2;echo  ~^GHello, test! <== After the ^G comes the output.
> `----
>
> Do you know what ^[ and ^G are for control chars and how I can get rid
> of them?

ESC\x05 and BELL. Maybe you should check which echo you are using, what  
is set for it, and what else is set for the shell interpreter running  
in *shell* buffer.

After all: are you using GNU Emacs 22? At some time GNU Emacs 21.3.50  
from CVS learned this and GNU Emacs 22 inherited it. Earlier versions  
don't work as described.

--
Mit friedvollen Grüßen

   Pete

A morning without coffee is like something without something else.

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

* Re: weird emacs shell behavior
       [not found]       ` <mailman.4930.1187384971.32220.help-gnu-emacs@gnu.org>
@ 2007-08-18 14:36         ` Tassilo Horn
  2007-08-18 16:11           ` Peter Dyballa
       [not found]           ` <mailman.4951.1187453499.32220.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 12+ messages in thread
From: Tassilo Horn @ 2007-08-18 14:36 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 17.08.2007 um 21:34 schrieb Tassilo Horn:
>
>> | > echo "Hello, test!"  <== That's what I typed.  It's bold after RET
>
> It becomes interpreted as prompt. Check comint-prompt-regexp and
> shell-prompt-pattern.

,----[ C-h v comint-prompt-regexp RET ]
| comint-prompt-regexp is a variable defined in `comint.el'.
| Its value is 
| "^[^#$%>\n]*[#$%>] *"
| Local in buffer *shell*; global value is "^"
| 
| Documentation:
| Regexp to recognize prompts in the inferior process.
| Defaults to "^", the null string at BOL.
| 
| This variable is only used if the variable
| `comint-use-prompt-regexp' is non-nil.
`----

By default `comint-use-prompt-regexp' is nil in *shell*.  I've set it to
t, but that doesn't change things.

,----[ C-h v shell-prompt-pattern RET ]
| shell-prompt-pattern is a variable defined in `shell.el'.
| Its value is 
| "^[^#$%>\n]*[#$%>] *"
`----

So it seems that `comint-prompt-regexp' is set to `shell-prompt-pattern'
in shell-mode.

And this regexp matches my prompt.  It's only a simple "> " when TERM is
set to dumb.

(string-match shell-prompt-pattern "> ") == C-x C-e ==> 0

>> | > echo "Hello, test!"  <== After my RET the line gets repeated...
>
> Again, it seems to be kept for the prompt?
>
>> | ^[]2;echo  ~^GHello, test! <== After the ^G comes the output.
>> `----
>>
>> Do you know what ^[ and ^G are for control chars and how I can get rid
>> of them?
>
> ESC and BELL. Maybe you should check which echo you are using, what is
> set for it, and what else is set for the shell interpreter running in
> *shell* buffer.

,----
| > which echo
| > which echo
| ^[]2;which  ~^G/bin/echo
`----

echo --help tells me it's the echo from coreutils 6.9.

,----
| > env
| > env
| ^[]2;env  ~^GEMACS=t
| CLASSPATH= [snipped]
| DISPLAY=:0
| CVS_RSH=ssh
| INSIDE_EMACS=22.1.50.1,comint
| MAIL=/var/mail/heimdall
| JAVA_HOME=/opt/sun-jdk-1.6.0
| WINDOWPATH=7
| RI=--format ansi --width 80
| TERM=dumb
| SHLVL=2
| GREP_OPTIONS=--color=auto
| USER=heimdall
| GREP_COLOR=97;45
| LOGNAME=heimdall
| HOME=/home/heimdall
| DARCS_EDITOR=emacsclient
| INPUTRC=/etc/fish/fish_inputrc
| HUSHLOGIN=FALSE
| RGHOME=/home/heimdall/uni/repos/re-group/trunk
| VISUAL=emacsclient
| ANTLR_HOME=/usr/share/antlr/lib
| LS_COLORS=
| LC_ALL=en_US.UTF-8
| PATH=/bin:/usr/bin:/usr/X11R6/bin:/opt/bin:/usr/games/bin:/home/heimdall/bin:/usr/kde/3.5/bin:/usr/local/bin
| EDITOR=emacsclient
| COLUMNS=96
| BOUML_ID=50
| BROWSER=firefox
| JAVA_VERSION=1.6.0
| TERMCAP=
| XAUTHORITY=/home/heimdall/.Xauthority
| LANG=en_US.UTF-8
| MAILHOST=pop.gmx.de
| SHELL=/bin/fish
| PWD=/home/heimdall
`----

> After all: are you using GNU Emacs 22?

Yes, a some hours old CVS checkout.

Bye,
Tassilo

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

* Re: weird emacs shell behavior
  2007-08-18 14:36         ` Tassilo Horn
@ 2007-08-18 16:11           ` Peter Dyballa
       [not found]           ` <mailman.4951.1187453499.32220.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 12+ messages in thread
From: Peter Dyballa @ 2007-08-18 16:11 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: help-gnu-emacs


Am 18.08.2007 um 16:36 schrieb Tassilo Horn:

>> After all: are you using GNU Emacs 22?
>
> Yes, a some hours old CVS checkout.

I have set

	EMACS=t

and I am using a regular shell, tcsh. In my *shell* buffer the prompt  
is found and fontified in bold and some colour.

You could make tests without loading any customisation and with a  
different login shell ...


Could be it's worth to read the documentation on fish a few times  
during this so-called summer. When I do this on tcsh I get every time  
surprised ...


--
Mit friedvollen Grüßen

   Pete

Who the fsck is "General Failure," and why is she reading my disk?

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

* Re: weird emacs shell behavior
       [not found]           ` <mailman.4951.1187453499.32220.help-gnu-emacs@gnu.org>
@ 2007-08-18 16:30             ` Tassilo Horn
  0 siblings, 0 replies; 12+ messages in thread
From: Tassilo Horn @ 2007-08-18 16:30 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Dyballa <Peter_Dyballa@Web.DE> writes:

Hi Peter,

>>> After all: are you using GNU Emacs 22?
>>
>> Yes, a some hours old CVS checkout.
>
> I have set
>
> 	EMACS=t
>
> and I am using a regular shell, tcsh. In my *shell* buffer the prompt
> is found and fontified in bold and some colour.

Yes, with `shell-file-name' set to /usr/bash it works, too.

> Could be it's worth to read the documentation on fish a few times
> during this so-called summer.  When I do this on tcsh I get every time
> surprised ...

Yes, I'll do that and if I don't find anything I'll ask on the fish
mailing list.

Bye,
Tassilo
-- 
The  desire  to  be  rewarded  for one's  creativity  does  not  justify
depriving  the world  in  general of  all  or part  of that  creativity.
(Richard M. Stallman)

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

end of thread, other threads:[~2007-08-18 16:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.4916.1187369678.32220.help-gnu-emacs@gnu.org>
2007-08-17 17:36 ` weird emacs shell behavior Joel J. Adamson
2007-08-17 18:19   ` Emilio Lopes
2007-08-17 18:26     ` Joel J. Adamson
2007-08-17 18:38       ` Emilio Lopes
2007-08-17 19:40         ` Joel J. Adamson
2007-08-17 19:34     ` Tassilo Horn
2007-08-17 21:09       ` Peter Dyballa
     [not found]       ` <mailman.4930.1187384971.32220.help-gnu-emacs@gnu.org>
2007-08-18 14:36         ` Tassilo Horn
2007-08-18 16:11           ` Peter Dyballa
     [not found]           ` <mailman.4951.1187453499.32220.help-gnu-emacs@gnu.org>
2007-08-18 16:30             ` Tassilo Horn
2007-08-17 16:54 phundamental unaudio
2007-08-17 17:43 ` Peter Dyballa

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.