Maintaining an ever-growing Emacs configuration is both fun and exhausting. It is easy to forget why I picked that value for a variable or how in the name of Elisp that weird snippet ended up in my init.el. The more packages I install to extend my beloved text editor, the harder it is to keep track of all the changes the prolific authors put out every day.

Artur Malabarba must understand my frustration pretty well, or at least that was my first reaction to his recent validate library.

The library has a pretty neat API, which I am sure will turn out to come in handy for all the Elisp developers out there. However, so far I have been focusing on the validate-setq macro only. validate-setq adds validation to the regular setq, making it super-easy to catch mistakes that can be surprisingly hard to find.

An example:

(use-package nrepl-client               ; Client for Clojure nREPL
  :ensure cider
  :defer t
  :config (validate-setq nrepl-hide-special-buffers 'yes))

If I evaluate this expression, I get a clear error message:

Error (use-package): nrepl-client :config: Looking for ‘(boolean)' in
‘yes' failed because: not a boolean

I was setting a lot of variables before the related package was required. I also found settings for variables that do not exist any more. Why Emacs was not catching these errors upon loading is still an ongoing investigation.

validate is available on GNU ELPA. Do not miss it.