We all know that one of the chief—if not the chief—benefit of Emacs is its extensibility. We say it all the time. Irreal says it all the time. But every once in a while the truth of that statement comes crashing down on us in a particularly compelling way. Here’s a case in point:
I’m listening to a Visual Studio live video that was live 15h ago. There is a big deal of a new feature that was introduced: Save on window focus change
Here is the same feature for #emacs
(add-hook ‘focus-out-hook (lambda () (interactive) (save-some-buffers t))) pic.twitter.com/nW0ee0HA4c— Emad Elsaid (@emad__elsaid) February 9, 2022
It can, I guess, seem like a cheap shot to make fun of another editor’s feature addition but the reality is that while the VSCode community was celebrating a brand new capability, Elmad Elsaid provided a one-line implementation of the same feature for Emacs that anyone could apply and enjoy right now without waiting for a new release.
All open source editors have this capability in some sense because, after all, you have the source and can make whatever changes you like but Emacs is running on Lisp so you can make changes without recompiling everything and the liberal use of hooks makes adding a feature like the one discussed here trivial.
With Emacs, there’s no begging the implementers for a change and waiting for the next version. Most of the time it’s a simple matter of writing just a bit of Elisp, adding it to your init.el
, and enjoying your new powers.