chiark / gitweb /
dot/emacs: Add a keybinding for `mdw-set-frame-width'.
[profile] / dot / shell-rc
index e990339d09c9217e760216e63eb99c8da4fc45e8..4538bc393f8d3afa737bcd1679d41f70ee6dbb6f 100644 (file)
@@ -74,20 +74,28 @@ __mdw_set_prompt_pieces () {
 }
 
 __mdw_set_prompt () {
-  __mdw_last_rc=$?
-  local git rc
-  if type __git_ps1 >/dev/null 2>&1; then
-    git="$__mdw_prompt_git_left$(__git_ps1)$__mdw_prompt_git_right"
-  else
-    git=""
-  fi
-  case $__mdw_last_rc in
-    0) rc="" ;;
-    *) rc="$__mdw_prompt_rc_left rc=$__mdw_last_rc$__mdw_prompt_rc_right" ;;
+  case "$TERM" in
+    dumb)
+      case $(id -u) in 0) PS1='# ' ;; *) PS1='$ ' ;; esac
+      PS2='> '
+      ;;
+    *)
+      __mdw_last_rc=$?
+      local git rc
+      if type __git_ps1 >/dev/null 2>&1; then
+       git="$__mdw_prompt_git_left$(__git_ps1)$__mdw_prompt_git_right"
+      else
+       git=""
+      fi
+      case $__mdw_last_rc in
+       0) rc="" ;;
+       *) rc="$__mdw_prompt_rc_left rc=$__mdw_last_rc$__mdw_prompt_rc_right" ;;
+      esac
+      PS1="$__mdw_prompt_left$git$rc$__mdw_prompt_right"
+      PS2="$PS1 $bold>$unbold "
+      unset __mdw_last_rc
+      ;;
   esac
-  PS1="$__mdw_prompt_left$git$rc$__mdw_prompt_right"
-  PS2="$PS1 $bold>$unbold "
-  unset __mdw_last_rc
 }
 
 __mdw_precmd () {
@@ -324,9 +332,15 @@ pathhack () {
 ###--------------------------------------------------------------------------
 ### Finishing touches.
 
+## Make sure `$HOME/bin' is on the path.
+path_add "$HOME/bin"
+
 ## Set the temporary directory again.  (A setuid or setgid program may have
 ## unhelpfully forgotten this for us.)
-case ${TMPDIR+t} in t) ;; *) eval $(tmpdir -b); esac
+case ${TMPDIR+t} in
+  t) ;;
+  *) if __mdw_programp tmpdir; then eval $(tmpdir -b); fi ;;
+esac
 
 ## For `root' use -- some simple molly-guards.
 case $(id -u) in