💾 Archived View for carcosa.net › journal › 20230315-emacs-undo.gmi captured on 2023-03-20 at 17:27:50. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

Re: Emacs undo

Sandra writes: Emacs undo and me

I'm with you there on not fully trusting or being comfortable with Emacs' undo functionality. It's extremely powerful (unlimited undo AND redo), but it's also often hard to predict what the undo function and associated keybindings; it used to be worse when there was a difference between `undo' and `advertised-undo' and I couldn't remember which was on which key. The problem is that you have to keep a mental model of the buffer's undo state to do anything complex with `undo', and that's actually quite hard to do once the undo state is not linear.

The packages I've used to deal with this both deal with it by providing a visual representation of the undo state and a way to move around it. `undo-tree' was the first, and is probably still the most featureful, but I ended up often getting stuck in it somewhere and having to bail out. These days I am using `vundo', which provides the needed map, but is a lot simpler and gives you lots of previews of what it's going to do.

I also agree that killing hunks in magit (or excluding hunks from staging) is like a nuclear-powered undo. I had to do that with $DAYJOB work this week, after trying out a bunch of different ideas for fixing a problem and wanting to keep only one. It would have been extremely painful to have to make all those changes manually.