I recently started using the fish shell. I tried using it in
term-mode in Emacs. One characteristic of this shell is that it shortens the current working directory before printing it as the prompt. For example, if the current directory is
/media, the prompt will contain
/media but if the current working directory is
/media/directory, the prompt will be
Because of this, Dirtrack mode in Emacs cannot keep track of the current directory, so
default-directory is not updated. This affects some commands like
C-c C-f which, as a prompt, suggests
default-directory. Since this variable is not updated, the prompt will be the directory from where I started
term-mode and not the current working directory in the shell.
default-directory to be updated when I change directory in the shell just like how it works with bash. How can I do this?
I like this shortening feature of
fish-shelland I don't want to change the prompt style.
Since Emacs sends every key-stroke to the shell (with some exceptions), I thought to run a function every time
<Ret>is pressed. But I couldn't find out how this can be done. Suggestions on this approach are welcome.