summary refs log tree commit diff
path: root/nixos
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
parentf9670479e833c3da54a425a9df077f2d4b280965 (diff)
downloadnixpkgs-833a5971568f8b5ea189126d61d8461d039bb93c.tar
nixpkgs-833a5971568f8b5ea189126d61d8461d039bb93c.tar.gz
nixpkgs-833a5971568f8b5ea189126d61d8461d039bb93c.tar.bz2
nixpkgs-833a5971568f8b5ea189126d61d8461d039bb93c.tar.lz
nixpkgs-833a5971568f8b5ea189126d61d8461d039bb93c.tar.xz
nixpkgs-833a5971568f8b5ea189126d61d8461d039bb93c.tar.zst
nixpkgs-833a5971568f8b5ea189126d61d8461d039bb93c.zip
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')
-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 75efd5e2903..033de7a1d5c 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\] "