This is a bit confusing question, but nothing happens here! I recently updated the bash prompt to a nice version that appeared in the last post of this thread: Bash: a custom PS1 with a good working directory . The corresponding bash code (from this stream entry) is copied here:
# define the awk script using heredoc notation for easy modification MYPSDIR_AWK=$(cat << 'EOF' BEGIN { FS = OFS = "/" } { if (length($0) > 16 && NF > 4) print $1,$2,".." NF-4 "..",$(NF-1),$NF else print $0 } EOF )
This prompt looks something like this (in terminals without emacs):
[0 user@host ~/my_dir]%
If "0" is higher than green and "user @host" is in bold. (Note that "0" can be all kinds of numbers and represents the return value of the last command.)
The problem I am experiencing is specific to shells running in emacs (and this happens for most terminal interaction options inside emacs: "term", "ansi-term", "shell" and "eshell"). The request appears twice (and slightly broken) in emacs terminals, for example:
0; user@host ~/my_dir[0 user@host ~/my_dir]%
The "second" version of the tooltip, starting with and including "[", looks just fine. This is the preceding text that appears without any style (i.e., Without green and without courage). So, emacs should interpret some part of the prompt as input, and my guess is the colored or bold shielded indicators attached to the parts of the string β0β and βuser hostβ?
Can anyone know how to tell emacs to correctly interpret escape? Or, alternatively, how to change the hint configuration commands so that both emacs do not hate it, and it will still work on terminals without emacs? And perhaps another alternative: how to add a test for terminal type ('eterm-color' in emacs) with a modified line that is emacs-friendly?