This is an excerpt; see the full article for the Emacs Lisp and other nitty gritty details.
Mental context switches are evil. Some people handle them better than others, but not me. I handle them worse. I feel it, almost physically, when context switches whittle down my precious flow piece by piece. It hurts!
Even something as small as switching between Emacs and the shell can hurt, especially when I do it thousands of times a day. The physical movement isn’t so bad; it’s that they have different key bindings, different clipboards, and myriad deeper differences in behavior. What’s worse, only some parts are different, so my muscle memory is constantly seduced into a false sense of familiarity, only to have the rug yanked out from under it seconds later.
I put together various hacks to bring Emacs and my shell closer together, with some success, but it always felt like a chronic disease. Curing it completely was never on the table; I could only hope to manage it.
The holy grail, of course, was running shells inside Emacs. I had high hopes when I tried it eight years ago, but it didn’t work out. I tried it again recently though, and it’s still early days, but we’re pretty happy together this time. I think we might go the distance!