Can someone provide a hook to change directory into the current directory of emacsclient when exiting emacsclient?
I often navigate to some files via terminal, pop open emacsclient to edit some files, then exit emacsclient to run some shell commands on files in the same directory. I find this more satisfactory than some other options that involve opening a terminal inside emacs (including popshell, M-x !, multi term, etc)
However, I also sometimes visit files in other directories while using emacsclient, then want to exit emacsclient to run some shell commands from the same directory where I was just editing files. However, when I exit emacsclient, I return to the original directory where I opened emacsclient, then have to navigate to the same directory using cd. This is inconvenient & leads to errors when I do not notice since the file structure within directories is similar/identical.
More background info: I start emacs --daemon, then open emacsclient -nw in a terminal when I have some quick files to edit in or near my current working directory. I've found that 'C-x C-c' will exit emacsclient but also kill the emacs daemon, so I use 'C-x 5 0' or 'C-x #' to exit just the client.