complete-computing-environment/undo_tree.org

43 lines
1.8 KiB
Org Mode

:PROPERTIES:
:ID: cce/undo_tree
:ROAM_ALIASES: undo-tree
:END:
#+TITLE: Emacs Undo and Redo with a tree
#+PROPERTY: header-args :mkdirp yes :results none
#+PROPERTY: header-args:emacs-lisp :tangle undo-tree.el
#+ARROYO_EMACS_MODULE: undo-tree
#+ARROYO_MODULE_WANTS: cce/configure_packaging.org
#+ARROYO_MODULE_WANTS: cce/diminish.org
#+ARCOLOGY_KEY: cce/undo-tree
#+ARCOLOGY_ALLOW_CRAWL: t
#+begin_src emacs-lisp
(provide 'cce/undo-tree)
#+end_src
Undo Tree is a neat visualization and navigation [[id:cce/emacs][Emacs]] [[id:a7420bb9-395f-4afa-92fb-8eaa0b8a4cd8][Tool]] for walking through a tree history.
#+BEGIN_src emacs-lisp
(use-package undo-tree
:after evil
:config (global-undo-tree-mode 1)
:custom
(undo-tree-enable-undo-in-region t)
(evil-undo-system 'undo-tree)
:diminish)
#+END_SRC
If I make a mistake, I can visually navigate the history of the work by hitting =C-x u=, and navigating the history of the document visually. This is a feature that I don't use often, but it's super useful when I do. More concretely, this package provides a useful and reliable *redo* which it binds to =M-_=, a sister-key binding to =C-_=, and it's also used by [[file:../Evil Mode: Vim in Emacs.org][Evil Mode]]'s undo key =u= and =C-r= for redo. =C-x u= will show the history tree for exploration.
It's simple and having it around is cheap and easy.
#+CAPTION: a text-visualization of undo-tree's tree view. Four events sprout from a single point where I did multiple undo actions and I am partway down a new timeline.
[[file:../data/11/b9070e-f1ab-44b5-a204-9662cc146ace/undo-tree.png][file:data/11/b9070e-f1ab-44b5-a204-9662cc146ace/undo-tree.png]]
* Screenshots :ATTACH:
:PROPERTIES:
:ID: 11b9070e-f1ab-44b5-a204-9662cc146ace
:END: