Modern Emacsen understand colour codes in shell mode, so this is OK.
Also use tput to find the bolding codes, and add support for Emacs's
`eterm' terminal.
- if [ "$TERM" = "dumb" ]; then
- if (( EUID == 0 )); then PS1="# "; else PS1="\$ "; fi
- PS2="> "
- PS4="+ "
- else
+ case "$TERM" in
+ linux*|screen*|xterm*|vt100*|eterm*)
+ bold="\[$(tput bold)\]" unbold="\[$(tput sgr0)\]" nl="\[\r\]" ;;
+ *)
+ bold='' unbold='' nl='' ;;
+ esac
- case "$TERM" in
- linux*|screen*|xterm*|vt100*)
- bold='\[\e[1m\]' unbold='\[\e[m\]' nl='\[\r\]' ;;
+ if (( EUID == 0 )); then
+ left=`echo « | iconv -f utf8 -t //translit`
+ right=`echo » | iconv -f utf8 -t //translit`
+ else
+ case $USER in
+ mdw|mwooding)
+ u="" left="[" right="]"
+ ;;
- bold='' unbold='' nl='' ;;
+ u="\\u@" left="{" right="}"
+ ;;
-
- if (( EUID == 0 )); then
- left=`echo « | iconv -f utf8 -t //translit`
- right=`echo » | iconv -f utf8 -t //translit`
+ if [ "$__mdw_tty" = "`tty`" ]; then
+ left="<" right=">"
- case $USER in
- mdw|mwooding)
- u="" left="[" right="]"
- ;;
- *)
- u="\\u@" left="{" right="}"
- ;;
- esac
- if [ "$__mdw_tty" = "`tty`" ]; then
- left="<" right=">"
- else
- export __mdw_tty="`tty`"
- fi
- fi
-
- if [ -z "$SSH_CLIENT" ] &&
- [ "$__mdw_sechost" != "`hostname`" ]
- then
- sec_l='(' sec_r=')'
+ export __mdw_tty="`tty`"
- PS1="$nl$bold$left$sec_l$u\\h$sec_r \\w$right$unbold"
- PS2="$PS1 $bold>$unbold "
+ if [ -z "$SSH_CLIENT" ] &&
+ [ "$__mdw_sechost" != "`hostname`" ]
+ then
+ sec_l='(' sec_r=')'
+ PS1="$nl$bold$left$sec_l$u\\h$sec_r \\w$right$unbold"
+ PS2="$PS1 $bold>$unbold "
+
+# --- Pagers are less useful within Emacs ---
+
+case "$INSIDE_EMACS" in
+ 22.*,comint) export PAGER=cat ;;
+esac
+
# --- Little preferences ---
notify=1
# --- Little preferences ---
notify=1
# --- Some colour `ls' support ---
[ "${TMPDIR+yes}" ] || eval `tmpdir -b`
# --- Some colour `ls' support ---
[ "${TMPDIR+yes}" ] || eval `tmpdir -b`
-if [ -x /usr/bin/dircolors -o -x /usr/local/bin/dircolors ] &&
- [ "$TERM" != "dumb" ]; then
+if [ -x /usr/bin/dircolors -o -x /usr/local/bin/dircolors ]; then
eval `dircolors -b ~/.dircolors`
else
unset LS_COLORS
eval `dircolors -b ~/.dircolors`
else
unset LS_COLORS
# Below, there should be one TERM entry for each termtype that is colorizable
TERM linux
# Below, there should be one TERM entry for each termtype that is colorizable
TERM linux
+TERM dumb
+TERM eterm-color
TERM console
TERM con132x25
TERM con132x30
TERM console
TERM con132x25
TERM con132x30