From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: how to display that a term is inside emacs Date: Wed, 04 Dec 2013 21:54:06 +0100 Organization: Aioe.org NNTP Server Message-ID: <878uw0l4l4.fsf@nl106-137-194.student.uu.se> References: <87pppcef7j.fsf@bye.fritz.box> <87haao1ltu.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1386190523 11406 80.91.229.3 (4 Dec 2013 20:55:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 4 Dec 2013 20:55:23 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 04 21:55:30 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VoJTk-0004lu-Sz for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Dec 2013 21:55:29 +0100 Original-Received: from localhost ([::1]:50302 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoJTj-0005cK-RC for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Dec 2013 15:55:27 -0500 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 58 Original-NNTP-Posting-Host: VVbyYd/iFZoeWNmD9i++cQ.user.speranza.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:lTBjVg94aEYRNnbkIHsrcnZ4GDY= Mail-Copies-To: never Original-Xref: usenet.stanford.edu gnu.emacs.help:202565 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94833 Archived-At: "Pascal J. Bourguignon" writes: > TERM is probably different in the two terminal > emulators. > > in M-x shell, TERM=emacs > in M-x term, TERM=eterm-color > I don't have M-x multi-term > in xterm, TERM=xterm-256color > I don't have rxvt-unicode. > > so you could have: > > export PS1="${TERM} ${PS1}" > > in your ~/.bashrc etc. Yes. To the OP: In zsh, you could do it like this in .zshrc (it'll be similar in bash). I have a sort of similar setup [1], only I have some other stuff there as well, *and* I don't want those labels, so I provide them here so you can compare directly to this screenshot [2], to see how it works. CURRENT_VT=`tty` if [[ ${CURRENT_VT[6]} == "p" ]]; then if [[ `uname` == "SunOS" ]]; then # on a remote SunOS/Solaris system: # here, also setup aliases and so forth # used on that specific machine export VT="Sun" PROMPT_VT="%K{red}%F{yellow}$VT%f%k" elif [[ $TERM == "screen" ]]; then # I always use tmux both in the Linux VTs and # on top of urxvt (the same as you use) - # confusingly, this is called "screen" export VT="tmux" PROMPT_VT="%F{red}$VT%f" elif [[ $EMACS == "t" ]]; then # Emacs export VT="emacs" PROMPT_VT="%F{red}$VT%f" fi else # this will be the Linux VTs *without* tmux export VT=${CURRENT_VT: -1:1} PROMPT_VT="%F{red}$VT%f" fi PROMPT=" %B$PROMPT_VT %F{cyan}%(4~|../|)%3~%f%b " [1] http://user.it.uu.se/~embe8573/conf/.zshrc [2] http://user.it.uu.se/~embe8573/vt_id.png -- Emanuel Berg, programmer-for-rent. CV, projects, etc at uXu underground experts united: http://user.it.uu.se/~embe8573