Someone posted a link to an old Bozhidar Batsov post that discusses a nifty little function that automates a simple but annoying manual process. Those of you who use package.el
or the use-package
macro are probably familiar with the problem. You update a package but it doesn’t load or work correctly. Usually, this is the result of byte compilation problems.
The answer is to uninstall the package and then install it again. It’s not hard but it is a pain. Batsov’s solution is to simply capture the process in a small function. The whole thing amounts to:
- Unloading the package
- Reinstalling the package
- Requiring the package
To make things really easy, he also has an interactive version that does a completing read to specify the package to reinstall. The completing read is populated with the complete package list so it’s easy to get the name right.
If you handle your packages with package.el
you should definitely take a look at Batsov’s post. It’s short and easy to read and it’s also easy to just copy his code and insert it right into your init.el
.