I wish there was a hook, that every time I did
M-x shell it would send "cd " . (pwd) . "\n" to an already running M-x shell, and then switch windows to that shell.
That way I wouldn't need to kill a running *shell* buffer first, just so it would cd to where I now want to use it.
Note I am not talking about tracking. Tracking is not a problem.
You see, it's all about me being lazy.
Let's say I do M-x shell, use it for five minutes, then forget about it.
OK, now 1/2 an hour later, in a different directory, I do M-x shell again.
But then I need to do
$ cd ../newdir/blurp there in the shell, to change its current directory to here, where I plan to use it.
Or I can do C-x C-k *shell* and then do M-x shell to start a fresh one, already cd'ed to $PWD. But that is rather "wasteful", killing a shell just because I was too lazy to type "cd ../newdir/blurp" into it.
C-u M-x shellhelp when it comes to opening a different buffer?*shell*buffer. I need to "advise" the M-x shell function to simply type in that cd pwd line each time I call it. In case I don't want it to run my line, I can instead just use C-x C-b to go to it.