[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/undo-tree 19baf49 158/195: Fix undo/redo-in-region tree
From: |
Stefan Monnier |
Subject: |
[elpa] externals/undo-tree 19baf49 158/195: Fix undo/redo-in-region tree diagrams in Commentary. |
Date: |
Sat, 28 Nov 2020 13:41:43 -0500 (EST) |
branch: externals/undo-tree
commit 19baf498ed005331be846ebd8d60851cf10e9545
Author: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>
Commit: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>
Fix undo/redo-in-region tree diagrams in Commentary.
---
undo-tree.el | 108 +++++++++++++++++++++++++++++++++++------------------------
1 file changed, 65 insertions(+), 43 deletions(-)
diff --git a/undo-tree.el b/undo-tree.el
index 166c079..0820389 100644
--- a/undo-tree.el
+++ b/undo-tree.el
@@ -625,24 +625,37 @@
;; o x (undo the undo-in-region)
;;
;;
-;; In `undo-tree-mode', undo-in-region works similarly: when there's an active
-;; region, undoing only undoes changes that affect that region. However, the
-;; way these undos-in-region are recorded in the undo history is quite
-;; different. In `undo-tree-mode', undo-in-region creates a new branch in the
-;; undo history. The new branch consists of an undo step that undoes some of
-;; the changes that affect the current region, and another step that undoes
-;; the remaining changes needed to rejoin the previous undo history.
+;; In `undo-tree-mode', undo-in-region works much the same way: when there's
+;; an active region, undoing only undoes changes that affect that region. In
+;; `undo-tree-mode', redoing when there's an active region similarly only
+;; redoes changes that affect that region.
+;;
+;; However, the way these undo- and redo-in-region changes are recorded in the
+;; undo history is quite different. The good news is, you don't need to
+;; understand this to use undo- and redo-in-region in `undo-tree-mode' - just
+;; go ahead and use them! They'll probably work as you expect. But if you're
+;; masochistic enough to want to understand conceptually what's happening to
+;; the undo tree as you undo- and redo-in-region, then read on...
+;;
+;;
+;; Undo-in-region creates a new branch in the undo history. The new branch
+;; consists of an undo step that undoes some of the changes that affect the
+;; current region, and another step that undoes the remaining changes needed
+;; to rejoin the previous undo history.
;;
;; Previous undo history Undo-in-region
;;
;; o o
;; | |
;; | |
+;; | |
;; o o
-;; | |\
+;; | |
+;; | |
+;; | |
+;; o o_
;; | | \
-;; o o x (undo-in-region)
-;; | | |
+;; | | x (undo-in-region)
;; | | |
;; x o o
;;
@@ -655,48 +668,57 @@
;; First undo-in-region Second undo-in-region
;;
;; o o
-;; | |\
+;; | |
+;; | |
+;; | |
+;; o o_
;; | | \
-;; o o x (undo-in-region)
-;; |\ | |
+;; | | x (undo-in-region)
+;; | | |
+;; o_ o |
;; | \ | |
-;; o x o o
-;; | | | |
-;; | | | |
-;; o o o o
+;; | x | o
+;; | | | |
+;; o o o o
;;
;; Redoing takes you back down the undo tree, as usual (as long as you haven't
;; changed the active region after undoing-in-region, it doesn't matter if it
;; is still active):
;;
;; o
-;; |\
+;; |
+;; |
+;; |
+;; o_
;; | \
-;; o o
+;; | o
;; | |
+;; o |
;; | |
-;; o o (redo)
-;; | |
+;; | o (redo)
;; | |
;; o x (redo)
;;
;;
-;; What about redo-in-region? Obviously, this only makes sense if you have
-;; already undone some changes, so that there are some changes to redo!
-;; Redoing-in-region splits off a new branch of the undo history below your
-;; current location in the undo tree. This time, the new branch consists of a
-;; redo step that redoes some of the redo changes that affect the current
-;; region, followed by all the remaining redo changes.
+;; What about redo-in-region? Obviously, redo-in-region only makes sense if
+;; you have already undone some changes, so that there are some changes to
+;; redo! Redoing-in-region splits off a new branch of the undo history below
+;; your current location in the undo tree. This time, the new branch consists
+;; of a first redo step that redoes some of the redo changes that affect the
+;; current region, followed by *all* the remaining redo changes.
;;
;; Previous undo history Redo-in-region
;;
;; o o
;; | |
;; | |
-;; x o
-;; | |\
+;; | |
+;; x o_
;; | | \
-;; o o x (redo-in-region)
+;; | | x (redo-in-region)
+;; | | |
+;; o o |
+;; | | |
;; | | |
;; | | |
;; o o o
@@ -708,19 +730,19 @@
;;
;; First redo-in-region Second redo-in-region
;;
-;; o o
-;; | |
-;; | |
-;; o o
-;; |\ |\
-;; | \ | \
-;; o x (redo-in-region) o o
-;; | | | |
-;; | | | |
-;; o o o x (redo-in-region)
-;; |
-;; |
-;; o
+;; o o
+;; | |
+;; | |
+;; | |
+;; o_ o_
+;; | \ | \
+;; | x | o
+;; | | | |
+;; o | o |
+;; | | | |
+;; | | | x (redo-in-region)
+;; | | | |
+;; o o o o
;;
;; Note that undo-in-region and redo-in-region only ever add new changes to
;; the undo tree, they *never* modify existing undo history. So you can always
- [elpa] externals/undo-tree c638cbd 051/195: General code tidying and reorganisation., (continued)
- [elpa] externals/undo-tree c638cbd 051/195: General code tidying and reorganisation., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree caa3bd0 082/195: Added new customization option to allow undo-in-region to be disabled., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 8972e4d 069/195: Use get-buffer-create when creating the visualizer buffer in undo-tree-visualize., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree d7c1b2c 118/195: "De-circle" undo-tree when saving to file, restore when loading., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 121cab9 136/195: Trivial typo fixes in comments., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 18754c1 114/195: Use with-temp-buffer instead of with-temp-file when saving undo history., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree c9f78c3 137/195: Use new user-error instead of error for expected undo errors., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 1114679 135/195: Fix bugs in binding of undo-tree-insert-face., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 5d19d4e 155/195: Bump version number and copyright year., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree ffb346a 157/195: Install undo-tree undo/redo Edit menu bar items., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 19baf49 158/195: Fix undo/redo-in-region tree diagrams in Commentary.,
Stefan Monnier <=
- [elpa] externals/undo-tree 22d6c01 153/195: Fix bug that cleared tree when enabling undo-tree-mode., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 46639dd 154/195: Tweak undo history file names to match Emacs backup file names., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree fba51e6 146/195: Add undo-tree-visualizer[-mouse]-select functions to select node at pos or click., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 43663f6 159/195: Fix bug in menu entries that triggered error on null buffer-undo-tree., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 133b439 148/195: Set protected-local property on various visualizer variables., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree bc9d095 156/195: Clear undo-tree-visualizer-needs-extending-[up|down] before drawing tree., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree b35a6af 160/195: Bump copyright year and version number., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree a3e81b6 161/195: Fix bug that caused undo-tree to hang when undoing in region (bug#16377)., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 2947d7c 169/195: Add hooks to transform/discard undo elements on saving/loading., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree c3d04ea 165/195: Change obsolete subtract-time -> time-subtract., Stefan Monnier, 2020/11/28