Would Alfred Hitchcock use Emacs?


First you have to excuse the awful title, but a cinephile cannot resist the temptation of an easy reference when the Emacs package he is going to write about is called Vertico.

Daniel Mendler has become such a prolific contributor to our Emacs world. His work with Omar Antolín Camarena and Clemens Radermacher (to name a few!) has been showing me how much can be done with little improvements on Emacs default completion system. Actually, “little” is a bit unfair to them because they have been putting a lot of effort in their packages and contributions. What “little” stands for instead is the amount of code I had to add to my init.el to get a superb completion UI. I combine Vertico with Orderless and I didn’t have to do much beside this after the installation via package.el:

 (require 'orderless)
 (setq completion-styles '(orderless))
 
 (require 'vertico)
 (vertico-mode +1)

Well, to be fair I did something more, like binding vertico-exit-input to C-j and setting orderless-matching-styles to orderless-regexp, plus I am using Daniel’s consult to extend Vertico capabilities, but I guess you see where I am going by now. The combination of small packages makes for a modular system that I can interact with more easily. For instance, Daniel can go berserk and forget about the lovely 500 lines of code limit he set himself to with Vertico. Why should I trust this criminal mind, then? I can switch to Selectrum and keep using Consult and Orderless with it1.

The beauty of Vertico is that it is not about reinventing Emacs completion once again. By sticking to Emacs built-in commands and completion facilities, Vertico succeeds in staying close to the source without losing the chance to improve on it. On the one hand, moving to Vertico means it is up to the user to configure extra niceties. That is what packages like Consult, Orderless, Embark, and Marginalia aim for, but again, the user is in charge of the right setup for their needs, while a solution such as Helm offers a lot of functionalities out of the box. On the other hand, tools such as Helm, Ivy, and Selectrum are more complex than Vertico and may bring in code you do not necessarily need, which is something even Emacs itself doesn’t shy away from2.

I find it amazing that a seemingly simple and yet so central feature in my everyday Emacs such as the completion system has pushed people to create all these amazing packages. It seems to me that Helm has helped pave the way for a more powerful experience when it comes to completion and that by studying Emacs internals carefully one can achieve similar benefits with a different approach. As humble end-users of all this we really are a lucky bunch.

Notes

  1. The irony should be obvious. 

  2. I don’t really need games in my text editor.