Are there any options or packages which cause default-directory
to be updated if the working directory changes in shell-mode
and term-mode
? I.e. when using cd
, but the solution would have to be more robust than just look for this particular command and maybe a few others - it should actually check the value of $PWD
after every command, I would think.
More importantly though it should also work when connecting to a remote machine from inside a shell-mode
or term-mode
buffer which was first created with default-directory
being a local directory. That's actually the feature I really need: being able to tell programmatically whether the commands I type into such terminals are run on a remote machine. I would like to get that information in form of a properly set default-directory
and figure if there is a way to get that, then the tool doing this would also work locally as described above.
dirtrack-mode
? It has a hook that may do what you want.