I use the following prompt for my Emacs shell:
PS1='\n\[\e[33m\]\w\033[36m\]$(parse_git_branch)\[\033[00m\]\n$ '
The output looks like this:
I tried to use the regexp "(^[^\\(]*)"
to match the path and set it in dirtrack-list:
(setq-default dirtrack-list '("(^[^\\(]*)" 1 1))
But due to the colors, the shell never matches (so it can't track my cwd). Is it possible to extend my regexp to include the colors?
Including @tripleee's regexp works:
(setq-default dirtrack-list '("\\s-\\(\033\\[[0-9]+m\\)*\\([^\033\\(]+\\)" 2 1))
But now when I cd
I randomly get the following error in a *Warnings*
buffer:
Warning (emacs):
/ does not exist