From: Mark Wooding Date: Thu, 16 Mar 2006 21:10:24 +0000 (+0000) Subject: bashrc, emacs, dot-emacs.el: Fix prompts for unusual user names. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/9a3fa88e036c5cf72051a9f289d3b4f28f38c5f6?ds=inline bashrc, emacs, dot-emacs.el: Fix prompts for unusual user names. This is a regression in the centralized configuration. --- diff --git a/bashrc b/bashrc index aa184ce..6fb97f4 100644 --- a/bashrc +++ b/bashrc @@ -30,11 +30,20 @@ if [ -t 0 ]; then if (( EUID == 0 )); then left="«" right="»" - elif [ "$__mdw_tty" = "`tty`" ]; then - left="<" right=">" else - left="[" right="]" - export __mdw_tty="`tty`" + 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" ] && @@ -43,7 +52,7 @@ if [ -t 0 ]; then sec_l='(' sec_r=')' fi - PS1="$nl$bold$left$sec_l\\h$sec_r \\w$right$unbold" + PS1="$nl$bold$left$sec_l$u\\h$sec_r \\w$right$unbold" PS2="$PS1 $bold>$unbold " fi diff --git a/dot-emacs.el b/dot-emacs.el index 0ff6020..8674c1a 100644 --- a/dot-emacs.el +++ b/dot-emacs.el @@ -1750,7 +1750,7 @@ (defun mdw-sh-mode-setup () 'comint-watch-for-password-prompt)) (defun mdw-term-mode-setup () - (setq term-prompt-regexp "^[^]#$%>»\n]*[]#$%>»] *") + (setq term-prompt-regexp "^[^]#$%>»}\n]*[]#$%>»}] *") (make-local-variable 'mouse-yank-at-point) (make-local-variable 'transient-mark-mode) (setq mouse-yank-at-point t) diff --git a/emacs b/emacs index 2b74aef..28b3334 100644 --- a/emacs +++ b/emacs @@ -483,7 +483,7 @@ ;; --- Make the shell mode aware of my prompt --- -(setq shell-prompt-pattern "^[^]#$%>»\n]*[]#$%>»] *") +(setq shell-prompt-pattern "^[^]#$%>»}\n]*[]#$%>»}] *") (setq comint-password-prompt-regexp (concat "\\(\\([Oo]ld \\|[Nn]ew \\|[a-zA-Z0-9_]*'s \\|^\\)" "[Pp]assword\\|pass phrase\\):\\s *\\'"))