dot/shell-rc: Rearrange variable initialization to make space for later.
[profile] / dot / shell-rc
index 2478edb..c62471e 100644 (file)
@@ -67,28 +67,50 @@ __mdw_hqual=$__mdw_hqual${SCHROOT_CHROOT_NAME+/$SCHROOT_CHROOT_NAME}
 __mdw_hqual=$__mdw_hqual${CROSS_BUILDENV+/$CROSS_BUILDENV}
 __mdw_set_prompt_hacks () { host=$__mdw_host; dir=""; }
 
+__mdw_system=$(uname -s)
+: ${USER-${LOGNAME-$(id -un)}}
+__mdw_user=$USER
+
+case $(id -u) in
+  0)
+    __mdw_rootp=t
+    ;;
+  *)
+    case $__mdw_system in
+      CYGWIN_*)
+       case " $(id -G) " in
+         *" 544 "*) __mdw_rootp=t __mdw_user="$__mdw_user%admin" ;;
+         *) __mdw_rootp=nil ;;
+       esac
+       ;;
+      *)
+       __mdw_rootp=nil
+       ;;
+    esac
+esac
+
 __mdw_set_prompt_pieces () {
 
   ## Fancy highlighting in some terminals.
-  local bold unbold nl gitcolour rccolour uncolour
-  local host dir more
-  bold="" unbold="" nl="" gitcolour="" rccolour="" uncolour="" more=""
+  local bold unbold nl more host dir
+  local gitcolour rccolour uncolour
+  bold="" unbold="" nl="" more=""
+  gitcolour="" rccolour="" uncolour=""
   __mdw_set_prompt_hacks
 
   ## Choose the right delimiters.  Highlight root prompts specially;
   ## highlight when I'm running as some other user.  Highlight when this
   ## isn't the outermost shell on the terminal.
-  local left right user u tty
-  user=${USER-${LOGNAME-$(id -un)}}
-  case $(id -u) in
-    0)
+  local left right u tty
+  case $__mdw_rootp in
+    t)
       left=$(echo « | iconv -f UTF-8 -t //translit)
       right=$(echo » | iconv -f UTF-8 -t //translit)
       ;;
-    *)
-      case $user in
+    nil)
+      case $USER in
        mdw | mwooding | nemo) u="" left="[" right="]" ;;
-       *) u="$user@" left="{" right="}" ;;
+       *) u="$__mdw_user@" left="{" right="}" ;;
       esac
       tty=$(tty)
       case "$__mdw_tty" in
@@ -145,11 +167,22 @@ __mdw_set_prompt () {
   esac
 }
 
-__mdw_xterm_precmd () { printf >/dev/tty "\e]2;%s@%s:%s – %s\e\\" "$USER" "$__mdw_host" "$PWD" "$__mdw_shell"; }
-__mdw_xterm_preexec () { printf >/dev/tty "\e]2;%s@%s:%s – %s\e\\" "$USER" "$__mdw_host" "$PWD" "$1"; }
+__mdw_xterm_settitle () {
+  printf >/dev/tty \
+    "\e]2;%s@%s:%s – %s\e\\" \
+    "$__mdw_user" "$__mdw_host$__mdw_hqual" "$PWD" \
+    "$1"
+}
+__mdw_xterm_precmd () { __mdw_xterm_settitle "$__mdw_shell"; }
+__mdw_xterm_preexec () { __mdw_xterm_settitle "$1"; }
 
-__mdw_screen_precmd () { printf >/dev/tty "\ek%s\e\\" "$__mdw_shell"; }
-__mdw_screen_preexec () { printf >/dev/tty "\ek%s\e\\" "$1"; }
+__mdw_screen_settitle () {
+  printf >/dev/tty \
+    "\ek%s\e\\" \
+    "$1"
+}
+__mdw_screen_precmd () { __mdw_screen_settitle "$__mdw_shell"; }
+__mdw_screen_preexec () { __mdw_screen_settitle "$1"; }
 
 if [ -t 0 ]; then
   case ${STY+t},${__mdw_precmd_hook+t},${__mdw_preexec_hook+t},${TERM} in
@@ -189,6 +222,16 @@ alias make="nice make"
 alias cross-run="nice cross-run"
 alias gdb="gdb -q"
 
+## Shut up Lisp interpreters.
+alias clisp="clisp -q -q"
+alias cmucl="rlwrap cmucl -quiet"
+alias ecl="rlwrap ecl"
+alias sbcl="rlwrap sbcl --noinform"
+alias ccl="rlwrap ccl"
+alias ccl32="rlwrap ccl32"
+alias ccl64="rlwrap ccl64"
+alias abcl="rlwrap abcl --noinform"
+
 ###--------------------------------------------------------------------------
 ### Colour output.