I’m trying to use eshell more and more, it’s very cool being able to seamlessly switch between regular shell commands like cd, ls etc. and calling Emacs functions like find-file or compile.
I’m enjoying it so much that I’m starting to feel like the jj commands I typically use need to be tied into Emacs a bit more!
Thanks to this episode of Álvaro Ramírez’s Bending Emacs series, it turns out that it’s trivial to intercept commands before they are invoked as a subprocess - just define a function called eshell/<command name>!