A haphazard Doom upgrade
Last night, just before midnight, I thought I would do a “quick” upgrade of Doom Emacs on the M1 Max MacBook, since it had been well over a year since I’d upgraded. It’s a dumb choice for someone who knows, say, what a bad idea it is to do a deployment to prod on a Friday afternoon. This is the same thing at home. Here’s what I did, and I’m not saying any of it is recommended, but it’s what got things working again.
It all started when I did this in Terminal:
doom upgrade
And got:
> Upgrading Doom Emacs...
> Cleaning .elc files
- No elc files to clean
x There was an unexpected error
Message: File is missing
Error: (file-missing "Opening input file" "No such file or directory" "/Users/phil/.emacs.d/core/packages.el")
Backtrace:
etc.
So I googled that and found on the Doom Discourse site:
Breaking change on b9933e663771
A heads up to Doom users:
doom upgrade
will break itself when updating Doom past b9933e6
A-ha!
So I tried these lines in The workaround section:
cd ~/.emacs.d
git reset --hard a9866e37e45b43785116ef474c8cd6aa9b5185dd
git pull origin master
doom sync -u
And got this:
x There was an unexpected runtime error
Message: Symbol's function definition is void
Details: (straight-recipes-nongnu-elpa-retrieve)
Backtrace:
etc.
I thought maybe I needed to follow the advice here:
https://github.com/doomemacs/doomemacs/issues/4950
You need to manually upgrade straight :
So I did what they suggested:
cd ~/.emacs.d
rm -r .local/straight/repos/straight.el
./bin/doom sync -up
That seemed to go mostly ok but I got a handful of warnings about branches being ahead/behind, so I went with the options it suggested to follow when you’re “unsure”.
And then at the end it said:
! Wrote extended straight log to ~/.emacs.d/.local/state/logs/cli.doom.230627002937.13605.error
! Script was abruptly aborted, leaving Doom in an incomplete state!
- Run 'doom sync' to repair it.
So I ran:
doom sync
and that seemed to go ok.
And then I tried to manually upgrade Doom again:
cd ~/.emacs.d
git reset --hard a9866e37e45b43785116ef474c8cd6aa9b5185dd
git pull origin master
doom sync -u
Got a few more prompts to “pick this if unsure”, followed those, and got:
! Wrote extended straight log to ~/.emacs.d/.local/state/logs/cli.doom.230627003634.17287.error
! Script was abruptly aborted, leaving Doom in an incomplete state!
- Run 'doom sync' to repair it.
So I again did:
doom sync
Ran Emacs and got some errors like this. You know you’re in trouble when you can’t even get a clean launch:
Error (doom-after-init-hook): Error running hook "doom-modeline-mode" because: (void-variable doom-modeline-mode-alist)
Ran this:
doom doctor
And oh lord, lots of problems, starting with:
> Checking your Emacs version...
! Emacs 27 is supported, but consider upgrading to 28.1
Emacs 28.1 is better supported, faster, and more stable. Plus, Doom
will drop 27.x support sometime mid-2022.
Ok, then! Might as well upgrade Emacs, too.
brew update
brew upgrade
doom sync
And it ran forever, updating tons of things I probably will never use, and then I launched Emacs and thank heaven it worked ok. Whew. Now I’m on Emacs 28.2 and Doom 3.0.0.
And this is something I do for fun?