reddit / emacs

The lazy way to "downgrade brew" to an earlier version of Emacs on MacOS

Cyberthal · 2022-07-24 09:47
I updated my brew packages yesterday, thereby inadvertently updating Emacs to version 28, which proved incompatible with my v26 configuration. Emacs started up in an unusable state, with multiple errors. This brought my workflow to a grinding halt. I should really have a backup Textmind instance for such situations. (Maybe I do somewhere.) I googled how to downgrade the package in brew, but that appeared needlessly complicated. Brew did not have alternative versions of Emacs. Instead I downloaded Emacs 26.3 from [Emacs for Macos X](https://emacsformacosx.com/builds/all). I installed it as Emacs 3 (and Emacs 27 as Emacs 2). I ran Emacs 3, and everything worked fine. Now I can upgrade my configuration at my leisure, and my workflow is uninterrupted. My googling didn't highlight this easy answer, causing me to waste time doing questionable things at the Terminal. I have a complicated setup with Chemacs profiles etc, and it somewhat surprised me when everything just worked. That's why I use MacOS. Best practices are good, but fast food is forever! [Here's Why McDonald's Burgers Don't Rot | The Food Lab](https://www.seriouseats.com/the-food-lab-why-mcdonalds-burgers-never-rot) Edit: There was a voice in my head telling me this post was too stupid and obvious to write, and now I'm glad I ignored it. Boldly dumbing is an important IT skill, voice!
WaitingForEmacs · 2022-07-24 13:20
>I googled how to downgrade the package in brew, but that appeared needlessly complicated. Brew did not have alternative versions of Emacs. Just an FYI, you can often install previous versions using brew. For example: ` ~/ brew search '/emacs/'` `==> Formulae` `daviderestivo/emacs-head/emacs-head@26 emacs ✔` `daviderestivo/emacs-head/emacs-head@27 emacs-clang-complete-async` `daviderestivo/emacs-head/emacs-head@28 emacs-dracula` `daviderestivo/emacs-head/emacs-head@29` ` ~/ brew install daviderestivo/emacs-head/emacs-head@26`
mtndewforbreakfast · 2022-07-24 13:21
This is one of the largest flaws of Homebrew. If you can't solve your issues with `brew install path-or-url-to-old-formula` there are basically no workarounds that include "still using homebrew for that concern". They do have pinning commands but they only work to freeze an existing package you have successfully installed. If you didn't use the pinning ahead of time and got yourself into a bad state there's no straightforward undo or downgrade. Projects like Nix solve this flaw but have plenty of their own downsides and a large adoption/education cost.
Cyberthal · 2022-07-24 14:04
I tried that search but didn't get any versioned results
WaitingForEmacs · 2022-07-24 14:16
Apologies. I seem to remember that I had actually added that tap a while ago when I was experimenting with a few features. They are quite helpful though if you want to give them a try: https://github.com/daviderestivo/homebrew-emacs-head
jimehgeek · 2022-07-24 16:38
Issues like these with Homebrew was one of the main reasons I created my own build script for Emacs nearly 10 years ago. It builds a completely self-contained Emacs.app bundle. So even when using nightly builds, I can rollback by simply launching an older Emacs.app.
DrReadIt · 2022-07-24 17:08
Use Nix, it’s better. Especially when paired with home-manager.
SickMoonDoe · 2022-07-24 17:32
Even without home-manager `nix profile install nixpkgs#emacs` just works out of the box.
your_sweetpea · 2022-07-24 18:17
Do you use emacs-style (default) bindings? If so it's probably honestly the easiest (and best) to simply `emacs -Q` and update your emacs config with a default emacs in this kind of case. At least for emacs lisp (and C, if you end up in emacs' C source while investigating changes you'll need to make to your config), unconfigured emacs is a perfectly competent editor IMO. I admit if you use Evil or highly specialized bindings such as xah fly keys this may be less practical, though.
Cyberthal · 2022-07-24 19:08
I use Spacemacs with Emacs default keybinds. Default Emacs is barely usable on my high-dpi iMac. Might take me a week of extreme masochism to do what you describe.
donio · 2022-07-24 19:38
To me Emacs is too important to leave to an external build system so I always build it myself. I have a small shell script to `./configure` with the right (for me) options. The binaries and lisp dirs are versioned so I can always bring up a previous one by running `emacs-27.2` and the like when needed.
your_sweetpea · 2022-07-24 21:11
that's a shame, if you ever wanted to try it out I imagine the functions in the replies here would help: https://emacs.stackexchange.com/questions/28390/quickly-adjusting-text-to-dpi-changes the first function needs zoom-frm, but the second should work completely vanilla obviously you wouldn't be able to do so with just `emacs -Q` though, i'd probably end up just `C-x C-+ + + + + +` on any new buffers i opened until they were big enough, but the minibuffer would still be tiny lol
your_sweetpea · 2022-07-24 21:16
I have emacs checked in a submodule to my emacs config so I update my config alongside it. It probably gives me a couple of bad habits with regards to just patching upstream with wild abandon, but it's nice to always have my config in sync with the exact emacs revision I'm using.
Atemu12 · 2022-07-24 21:55
(After you enable the `nix-command` and `flakes` experimental features.)