From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: On prompt in shell mode Date: Wed, 13 Aug 2008 19:55:20 -0400 Message-ID: References: <48A198B6.4080206@alice.it> <48A1F73E.4040504@alice.it> <48A3585C.9010208@alice.it> <48A36803.6020908@alice.it> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1218671741 6689 80.91.229.12 (13 Aug 2008 23:55:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Aug 2008 23:55:41 +0000 (UTC) Cc: emacs-devel@gnu.org To: Angelo Graziosi Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 14 01:56:33 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KTQCb-0006qQ-R5 for ged-emacs-devel@m.gmane.org; Thu, 14 Aug 2008 01:56:30 +0200 Original-Received: from localhost ([127.0.0.1]:40514 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KTQBf-00055e-K2 for ged-emacs-devel@m.gmane.org; Wed, 13 Aug 2008 19:55:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KTQBa-00055R-Ph for emacs-devel@gnu.org; Wed, 13 Aug 2008 19:55:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KTQBY-00055D-BG for emacs-devel@gnu.org; Wed, 13 Aug 2008 19:55:26 -0400 Original-Received: from [199.232.76.173] (port=41061 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KTQBY-00055A-5l for emacs-devel@gnu.org; Wed, 13 Aug 2008 19:55:24 -0400 Original-Received: from smtp-02.arnet.com.ar ([200.45.191.22]:56455) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1KTQBW-0006HN-Ms for emacs-devel@gnu.org; Wed, 13 Aug 2008 19:55:23 -0400 Original-Received: (qmail 27282 invoked from network); 13 Aug 2008 23:53:34 -0000 Original-Received: from unknown (HELO ceviche.home) (190.30.131.157) by 0 with SMTP; 13 Aug 2008 23:53:33 -0000 Original-Received: by ceviche.home (Postfix, from userid 20848) id 1345C7004D; Wed, 13 Aug 2008 19:55:20 -0400 (EDT) In-Reply-To: <48A36803.6020908@alice.it> (Angelo Graziosi's message of "Thu, 14 Aug 2008 01:02:27 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:102426 Archived-At: >> 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. > As I have written [1], defining > PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ ' > in /etc/profile or .bashrc works fine in RXVT, MRXVT, URXVT, XTERM, > (KDE)Konsole WITHOUT Emacs. Indeed, since all those terminal emulators basically emulate each-other (or even share the underlying code). > i.e. the code '\[\e]0;\w\a\]' prints the working directory as title of > RXVT, MRXVT... window; the remains gives the terminal prompt in the form I know (I use it in my own PS1 setting as well). > In any case, have you some comment on how to solve the other question I > pointed out in [2], i.e. setting in .emacs > (setenv "PS1" "prompt>") > works, but > (setenv "PS1" "address@hidden \w\n$ ") You need to escape the backslashes since they're otherwise interpreted as escape sequences for Emacs's string literals (and there's no such thing as a \w escape sequence for Emacs string literals). In any case a better solution is to change your .bashrc (or wherever you set your PS1 prompt) so as to check the value of $TERM and use different settings depending on the features suppported by the corresponding terminal. I personally only use `xterm', so I use code like: if [[ $TERM == xterm* ]]; then PROMPT=$(print -n "%{\033]0;%m%${my_uid}(#..-%n)\007%}%B%2c-%?%#%b ") else PS1="%B%${my_uid}(#..%n@)%m-%2c-%?%#%b " fi in my .zshrc, tho this is for Zsh so it won't work as is for you. Stefan