Emacs: Save, Not Search!

I’m a compulsive saver. No, not with money–files. It probably comes from using Photoshop in the 90s, but regardless, I probably save hundreds of times a day.

Sometimes in Emacs I fat-finger C-x C-s (save-buffer) and end up landing in search mode instead (C-sisearch-forward). Then I have to C-g or ESC ESC ESC my way out before actually saving.

I recently learned (again, from having clumsy fingers) that isearch-mode actually understands C-x C-s, so you can just hit it to save the file and exit search mode in one go. In fact, it actually seems to be pretty clever about only eating keystrokes it understands and otherwise exiting isearch-mode and passing them along. Check out the docs for isearch-other-meta-char for details.