help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to display that a term is inside emacs


From: Emanuel Berg
Subject: Re: how to display that a term is inside emacs
Date: Wed, 04 Dec 2013 21:54:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

"Pascal J. Bourguignon" <pjb@informatimago.com> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]