Back to the roots


Last time I left straight for the built-in package.el, a choice I have not had the pleasure to regret so far. Now I am going to reason about a more ambitious change in my Emacs configuration: I am not using use-package any more.

Before answering your concerned why!? let me just say that if you are happy with use-package you should stay with it. By wrapping all the settings for a built-in feature or an external package with use-package you can easily notice what you are doing wrong when tweaking something, while having control over the installation and the loading of your favourite library as well. Despite some unhappiness around the web1, use-package is just a great tool that any serious Emacs hacker should consider when digging deep into their .emacs.d.

As for my choice to move away from it, it all started as an experiment. I wanted to see if I could have the same amount of control and readability over my init.el without an extra package. You see, most of the recent changes to my setup involved trying to rely on Emacs own facilities to answer my needs, and I am glad to say vanilla Emacs has been really a surprise in this regard. My liaisons with project.el and Flymake are nice examples of this.

Removing use-package has meant rethinking the way I install packages, especially if I want my setup to be ready to go any time I upgrade to a newer version of Ubuntu. My solution was adding the packages I use to package-selected-packages and have a check on startup to make sure they are installed. This works very well combined with package-autoremove: if a package is not listed under package-selected-packages, Emacs takes care of the mess.

All the use-package blocks have been replaced with a combination of with-eval-after-load, define-key, and add-hook, which was not as complicated as it might sound, and more often than not was similar to what I had in my days before the use-package takeover. True, I lost the nice readability of use-package with this massive edit. For example, its keywords have the benefit of grouping settings together and clearly indicate when a new group starts, but on the other hand now there is less macro-magic masking package-related operations involved. As a result I have a more detailed insight of what is really going on with my Emacs Lisp. For instance, I have gained a better knowledge of what run-with-idle-timer actually does.

Again, it is a matter of personal preferences. By now the beauty of use-package is well-known in the Emacs world and all the praises are well-deserved. Let me stress it again: use-package makes your configuration simpler to manage and easier to read. Those were the main reasons I switched to it years ago, anyway.

However, if you know what you are doing you can achieve a clean and pleasant init.el with what Emacs already offers. Does it take more effort? Yes, it probably does. Is it really worth it? It’s up to you, mate. Am I just showing off? No, come on, don’t be rude.

Notes

  1. See for instance here or here