What's the best way to use undo-redo on emacs? reddit / emacs ---------------------------------------------------------------------- lord4ris · 2022-06-08 22:05 I lost my progress on an org document twice, and I used tons of undo- redo commands, but none of them worked, so now, even though I really like org mode and emacs, I'm kind of disappointed. Is there a safe way to create documents without the risk of lose everything because of a simple error like using undo-redo commands the wrong way? I read about version control, but still don't know how to use it. ---------------------------------------------------------------------- Relative_Tap5915 · 2022-06-08 22:40 You can try out undo-tree package which offers a more intuitive interface (like you would normally C-z and C-y in other contexts) and much more ---------------------------------------------------------------------- MitchellMarquez42 · 2022-06-08 22:51 Undo-redo is for quick changes and doesn't persist between sessions (by default). Emacs should be creating backup files ending in `~`. Those might be useful for you. To save your files and their old contents: 1. Make backups. The easiest way is just a copy of the file, maybe put the date in the filename. 2. Learn some basic version control, such as `git`. To start tracking files in a folder: git init && git add . To save changes: git commit -am "message" (the message can be anything; I recommend something descriptive). To restore everything to the last commit: git checkout -f ---------------------------------------------------------------------- lord4ris · 2022-06-08 23:33 I already installed it using package-install, but It's not appearing in the M-x list. ---------------------------------------------------------------------- 00-11 · 2022-06-08 23:34 https://emacs.stackexchange.com/q/72085/105 ---------------------------------------------------------------------- dpoggio · 2022-06-08 23:41 Adding: In some way, undo-tree is a very basic version control using backups (*~). It can be combined with git to store intermediate steps and avoid a fine grained git log needing maintenance. ---------------------------------------------------------------------- Relative_Tap5915 · 2022-06-09 00:09 Do you have the command undo-tree-mode? If so, you can turn it on and see if there are commands like undo-tree-undo and undo-tree-redo ---------------------------------------------------------------------- lord4ris · 2022-06-09 00:36 It doesn't appear on my commands list. If I uninstall and reinstall it, it appears on that list, but if I restart emacs, it won't. ---------------------------------------------------------------------- Relative_Tap5915 · 2022-06-09 00:57 Well, you need to load it from your .emacs file... something like (require 'undo-tree) ---------------------------------------------------------------------- Danrobi1 · 2022-06-09 01:08 You could try [vundo](https://github.com/casouri/vundo) ---------------------------------------------------------------------- the2bears · 2022-06-09 01:42 Just use magit for the git commands. ---------------------------------------------------------------------- MitchellMarquez42 · 2022-06-09 02:00 That's step 3 ---------------------------------------------------------------------- lord4ris · 2022-06-09 04:30 It looks pretty good! I'll try it! ---------------------------------------------------------------------- [deleted] · 2022-06-09 05:43 To me undo-tree-visualize is the killer feature. ---------------------------------------------------------------------- pwnedary · 2022-06-09 07:47 Configuring autoloads so that they work is the proper solution. ---------------------------------------------------------------------- ideasman_42 · 2022-06-09 10:50 - [Undo-fu](https://codeberg.org/ideasman42/emacs-undo-fu), simple undo/redo. - [Undo-fu-session](https://codeberg.org/ideasman42/emacs-undo-fu- session), for storing undo on file save. - [Vundo](https://github.com/casouri/vundo), for the rare occasions I need a tree. ---------------------------------------------------------------------- Faerryn · 2022-06-10 00:02 Consider binding `C-/` to `undo-only`. Since `C-?` is bound to `undo- redo` this allows for behavior similar to C-z and C-r in other editors, instead of spending eons undoing undos. ---------------------------------------------------------------------- lord4ris · 2022-06-10 01:03 thank you so much!