I use emacs but tend to just find another way to do things (e.g. grep, & other shell things) when I run into a stumbling block like this; believe it or not, not everyone wants to start debugging their text editor when they run into trouble. Admittedly I wish I would spend a bit of time in emacs internals sometimes just so I could learn to approach similar issues, but it's just never much of a priority when I'm trying…
> TRAMP is pretty great, I wish it would not make a new connection for every network interaction though Same. One of my wishes for Emacs in "From caching up to getting ahead" is for Tramp improvements. These days I went back to TUI Emacs via SSH for work.
Open up your ~/.ssh/config file and set "ControlMaster yes", "ControlPersist yes" and "ControlPath ~/.ssh/cp-%C" and ssh will multiplex all of your ssh sessions across as few unique tcp connections as possible. This will speed up scp and sftp connections as well.