I spent a while updating my Emacs configuration, and this time nothing went wrong! I’m pleased with the refreshed and refactored setup. Everything looks the same as it did before, except for some colours in the dark Solarized theme, because I’m using a different package for that. Behind the scenes it’s all a lot tidier.
The main change is that everything now depends on John Wiegley’s use-package.
With that in place, for every package I want to use, I use
use-package to magically get it, install it and configure it. An average example is this, for the Emacs mode to use RuboCop, the Ruby syntax checker that tells you, as you’re writing, when you’ve made a mistake in your Ruby script.
diminish line keeps away some cruft that says “RuboCop mode is on,” which I don’t need reminding; and the
add-hook makes it so that whenever the editor is in Ruby mode (i.e., editing a Ruby script) then rubocop-mode is turned on automatically.
I’m now caught up to where a lot of other people were years ago. Next: moving it all into one big Org file!
One thing worth noting is that I fixed some problems I was having where
M-x package-autoremove kept removing packages I actually wanted. It turned out the problem was with the variable
package-selected-packages, which was introduced in 25.1 and is defined in
custom.el. It had a huge list of packages, many of which I don’t want any more, but some I do want weren’t in it. Just one of those things.
I fixed it by brute force. I deleted the line from
custom.el, quit Emacs, restarted, and ran
M-x package-autoremove. Emacs said, Do you really want to remove all the 57 packages you have installed? I said yes. They got wiped out. I quit again, restarted, and this time
use-package installed everything I wanted, updated
package-selected-packages, and now everything is working correctly.