summaryrefslogtreecommitdiffstats
path: root/nixos/modules/programs/bash
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2015-11-18 16:24:14 +0100
committerPeter Simons <simons@cryp.to>2015-11-18 16:27:41 +0100
commit833a5971568f8b5ea189126d61d8461d039bb93c (patch)
tree6e09d32ef47ba77303e4e0222b3e4591c294dfea /nixos/modules/programs/bash
parentf9670479e833c3da54a425a9df077f2d4b280965 (diff)
nixos: configure bash prompt in Emacs' shell-mode, even if TERM=dumb
The idea that the interactive bash prompt isn't set in case of TERM=dumb is intended to fix problems when other machines log remotely into a NixOS installation via Tramp. A side-effect that change was, however, that Emacs' shell-mode no longer had a correct prompt. I suppose the presence of INSIDE_EMACS=24.5.2,comint is a sufficiently unique indication that the current interactive shell is running inside of an Emacs and that the prompt can thus be configured safely.
Diffstat (limited to 'nixos/modules/programs/bash')
-rw-r--r--nixos/modules/programs/bash/bash.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/nixos/modules/programs/bash/bash.nix b/nixos/modules/programs/bash/bash.nix
index 75efd5e29039..033de7a1d5c9 100644
--- a/nixos/modules/programs/bash/bash.nix
+++ b/nixos/modules/programs/bash/bash.nix
@@ -90,8 +90,9 @@ in
promptInit = mkOption {
default = ''
- if test "$TERM" != "dumb"; then
- # Provide a nice prompt.
+ # Provide a nice prompt if the terminal supports it.
+ if [ "$TERM" != "dumb" -o -n "$INSIDE_EMACS" ]; then
+ echo "Set prompt!"
PROMPT_COLOR="1;31m"
let $UID && PROMPT_COLOR="1;32m"
PS1="\n\[\033[$PROMPT_COLOR\][\u@\h:\w]\\$\[\033[0m\] "