From 833a5971568f8b5ea189126d61d8461d039bb93c Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 18 Nov 2015 16:24:14 +0100 Subject: 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. --- nixos/modules/programs/bash/bash.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'nixos') 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\] " -- cgit 1.4.1