all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Angelo Graziosi <angelo.graziosi@alice.it>
Cc: emacs-devel@gnu.org
Subject: Re: On prompt in shell mode
Date: Wed, 13 Aug 2008 18:37:25 -0400	[thread overview]
Message-ID: <jwvhc9o7doi.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <48A3585C.9010208@alice.it> (Angelo Graziosi's message of "Wed, 13 Aug 2008 23:55:40 +0200")

>>>>> The following regards Emacs (trunk) both on Linux and Cygwin. When
>>>>> I do: M-x shell, the prompt has garbage: ^[]0;~/downloads/cygwinports^G
>>>>> ^[[32mangelo@host ^[[33m~/downloads/cygwinports^[[0m $ being echo PS1
>>>>> \[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$
>>>> Doesn't look like garbage to me: it looks like the exact (garbage) codes
>>>> specified in your PS1.  After all \e is ^[ and \a
>>>> is ^G (IIRC).
>>>> 
>>>> You should be careful to choose the escape sequences in your PS1
>>>> according to the escape sequences accepted by the terminal emulator in
>>>> which the shell is running (which is reflected in the
>>>> $TERM envvar).
>> 
>>> Obviously, what you call "the exact (garbage) codes specified in your
>>> PS1" in RXVT, MRXVT, URXVT, (KDE)Konsole produces:
>> 
>>> angelo@host ~/downloads/cygwinports $
>> 
>> I do not doubt it.  They are codes meant specifically for those terminal
>> emulators so it's no wonder they do what you want there.

> No! They are codes (escape sequences) for BASH shell. Many people use
> different shells (zsh, tcsh,...) which have different syntax.

AFAIK, only the \[, \w, \u, \h, and \] escapes are bash escapes (and
they indeed show up fine in your M-x shell example).  The rest
(e.g. things like "\e]0;" and "\e[32m") are not handled by bash but just
passed blindly as is to the terminal.

>> Try it on a wyse terminal, or in the Linux console.  M-x shell is not
>> a terminal

> Sorry, but I have already cited GNU/Linux and KDE-Konsole! on which
> there is the same problem!... and have sent another post [1].

I'm not sure we talk about the same thing.  I'm talking about running
your shell in a Linux console, or within `screen', or inside a Wyse
terminal (if you can find one these days).  I.e. without involving Emacs
at all.

> I have pointed this problem because I think that M-x shell does not
> interpret correctly some escape/code; googling or searching in
> help-emacs, shows this is an acient problem whose workarounds do not
> seem to work with 23 (and 22?).

> Obviously that is only my opinion.

It's a problem indeed.  I do not deny it.  But your PS1 prompt setting
is still faulty regardless ;-)


        Stefan





  reply	other threads:[~2008-08-13 22:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-12 14:05 On prompt in shell mode Angelo Graziosi
2008-08-12 14:10 ` adg
2008-08-12 14:17   ` Angelo Graziosi
2008-08-12 18:19 ` Chong Yidong
2008-08-13 10:03   ` Angelo Graziosi
2008-08-12 19:46 ` Stefan Monnier
2008-08-12 20:49   ` Angelo Graziosi
2008-08-13 20:42     ` Stefan Monnier
2008-08-13 21:55       ` Angelo Graziosi
2008-08-13 22:37         ` Stefan Monnier [this message]
2008-08-13 23:02           ` Angelo Graziosi
2008-08-13 23:17             ` David Hansen
2008-08-13 23:55             ` Stefan Monnier
2008-08-14  1:24               ` Angelo Graziosi
2008-08-14  8:50                 ` Angelo Graziosi
2008-08-14 10:22                   ` David Hansen
2008-08-14 13:21                   ` Angelo Graziosi
2008-08-13  6:26 ` Richard M. Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvhc9o7doi.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=angelo.graziosi@alice.it \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.