about summary refs log tree commit diff
path: root/nixos/modules/programs/bash
diff options
context:
space:
mode:
authorTad Fisher <tadfisher@gmail.com>2018-12-17 15:42:41 -0800
committerTad Fisher <tadfisher@gmail.com>2018-12-17 15:42:41 -0800
commitb4b67177b53c23c6fb77aea7f0bc5c559f8bebe5 (patch)
tree0c04762a42a16d9acc9294e4e04e456019441de5 /nixos/modules/programs/bash
parentcc1d13ae0f0d7c2bb6d6be9e64349a628ca0512f (diff)
downloadnixlib-b4b67177b53c23c6fb77aea7f0bc5c559f8bebe5.tar
nixlib-b4b67177b53c23c6fb77aea7f0bc5c559f8bebe5.tar.gz
nixlib-b4b67177b53c23c6fb77aea7f0bc5c559f8bebe5.tar.bz2
nixlib-b4b67177b53c23c6fb77aea7f0bc5c559f8bebe5.tar.lz
nixlib-b4b67177b53c23c6fb77aea7f0bc5c559f8bebe5.tar.xz
nixlib-b4b67177b53c23c6fb77aea7f0bc5c559f8bebe5.tar.zst
nixlib-b4b67177b53c23c6fb77aea7f0bc5c559f8bebe5.zip
nixos/bash: Fix prompt regression in Emacs term mode
Diffstat (limited to 'nixos/modules/programs/bash')
-rw-r--r--nixos/modules/programs/bash/bash.nix7
1 files changed, 6 insertions, 1 deletions
diff --git a/nixos/modules/programs/bash/bash.nix b/nixos/modules/programs/bash/bash.nix
index 2b01c9d26c41..d22f9dfa3199 100644
--- a/nixos/modules/programs/bash/bash.nix
+++ b/nixos/modules/programs/bash/bash.nix
@@ -98,7 +98,12 @@ in
           if [ "$TERM" != "dumb" -o -n "$INSIDE_EMACS" ]; then
             PROMPT_COLOR="1;31m"
             let $UID && PROMPT_COLOR="1;32m"
-            PS1="\n\[\033[$PROMPT_COLOR\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\$\[\033[0m\] "
+            if [ -n "$INSIDE_EMACS" ]; then
+              # Emacs term mode doesn't support xterm title escape sequence (\e]0;)
+              PS1="\n\[\033[$PROMPT_COLOR\][\u@\h:\w]\\$\[\033[0m\] "
+            else
+              PS1="\n\[\033[$PROMPT_COLOR\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\$\[\033[0m\] "
+            fi
             if test "$TERM" = "xterm"; then
               PS1="\[\033]2;\h:\u:\w\007\]$PS1"
             fi