[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/undo-tree f93420b 038/195: Remap undo-only to undo-tree
From: |
Stefan Monnier |
Subject: |
[elpa] externals/undo-tree f93420b 038/195: Remap undo-only to undo-tree-undo in undo-tree-map. |
Date: |
Sat, 28 Nov 2020 13:41:16 -0500 (EST) |
branch: externals/undo-tree
commit f93420ba3d5608c1fa948f81835dd3c5efc7564c
Author: tsc25 <tsc25@cantab.net>
Commit: tsc25 <tsc25@cantab.net>
Remap undo-only to undo-tree-undo in undo-tree-map.
Remap all motion commands to undo commands in visualizer.
---
undo-tree.el | 47 ++++++++++++++++++++++++++++++-----------------
1 file changed, 30 insertions(+), 17 deletions(-)
diff --git a/undo-tree.el b/undo-tree.el
index 3f4753f..07a2bdf 100644
--- a/undo-tree.el
+++ b/undo-tree.el
@@ -132,8 +132,8 @@
;;
;;
;;
-;; Explanation
-;; ===========
+;; Undo Systems
+;; ============
;;
;; To understand the different undo systems, it's easiest to consider an
;; example. Imagine you make a few edits in a buffer. As you edit, you
@@ -320,13 +320,12 @@
;; state that you want. But whatever you do, don't move around in the buffer
;; to check you've got back to where you want! Because you'll break the undo
;; chain, and then you'll have to traverse the entire string of undos again to
-;; get back to the point at which you broke the chain. Commands such as
-;; `undo-only', and undo in region (in transient-mark-mode), help to make
-;; using Emacs' undo a little easier, but nonetheless it remains confusing for
-;; many people.
+;; get back to the point at which you broke the chain. Undo in region and
+;; commands such as `undo-only' help to make using Emacs' undo a little
+;; easier, but nonetheless it remains confusing for many people.
;;
;;
-;; So what does undo-tree mode do? Remember the diagram we drew to represent
+;; So what does `undo-tree-mode' do? Remember the diagram we drew to represent
;; the history we've been discussing (make a few edits, undo a couple of them,
;; and edit again)? The diagram that conceptually represented our undo
;; history, before we started discussing specific undo systems? It looked like
@@ -367,13 +366,13 @@
;; the other hand you redo the change, you'll end up back at the bottom of the
;; most recent branch:
;;
-;; o
+;; o (undo takes you here)
;; |
;; |
;; o (start here)
;; |\
;; | \
-;; o x (redo)
+;; o x (redo takes you here)
;; |
;; |
;; o
@@ -421,13 +420,18 @@
;; possibility of switching between branches and accessing the full undo
;; history is still there.
;;
-;; Actually, it gets better. You don't have to imagine all these diagrams,
-;; because `undo-tree-mode' includes an undo-tree visualizer which draws them
-;; for you! In fact, it draws even better diagrams: it highlights the node
-;; representing the current buffer state, it highlights the current branch,
-;; and it can optionally display time-stamps for each buffer state. (There's
-;; one other tiny difference: the visualizer puts the most recent branch on
-;; the left rather than the right.)
+;;
+;;
+;; The Undo-Tree Visualizer
+;; ========================
+;;
+;; Actually, it gets better. You don't have to imagine all these tree
+;; diagrams, because `undo-tree-mode' includes an undo-tree visualizer which
+;; draws them for you! In fact, it draws even better diagrams: it highlights
+;; the node representing the current buffer state, it highlights the current
+;; branch, and you can toggle the display of time-stamps for each buffer
+;; state. (There's one other tiny difference: the visualizer puts the most
+;; recent branch on the left rather than the right.)
;;
;;
;;
@@ -563,8 +567,9 @@ in visualizer."
(unless undo-tree-map
(setq undo-tree-map (make-sparse-keymap))
- ;; remap `undo' to `undo-tree-undo'
+ ;; remap `undo' and `undo-only' to `undo-tree-undo'
(define-key undo-tree-map [remap undo] 'undo-tree-undo)
+ (define-key undo-tree-map [remap undo-only] 'undo-tree-undo)
;; bind standard undo bindings (since these match redo counterparts)
(define-key undo-tree-map (kbd "C-/") 'undo-tree-undo)
(define-key undo-tree-map "\C-_" 'undo-tree-undo)
@@ -580,6 +585,10 @@ in visualizer."
(unless undo-tree-visualizer-map
(setq undo-tree-visualizer-map (make-keymap))
;; vertical motion keys undo/redo
+ (define-key undo-tree-visualizer-map [remap previous-line]
+ 'undo-tree-visualize-undo)
+ (define-key undo-tree-visualizer-map [remap next-line]
+ 'undo-tree-visualize-redo)
(define-key undo-tree-visualizer-map [up]
'undo-tree-visualize-undo)
(define-key undo-tree-visualizer-map "p"
@@ -593,6 +602,10 @@ in visualizer."
(define-key undo-tree-visualizer-map "\C-n"
'undo-tree-visualize-redo)
;; horizontal motion keys switch branch
+ (define-key undo-tree-visualizer-map [remap forward-char]
+ 'undo-tree-visualize-switch-branch-right)
+ (define-key undo-tree-visualizer-map [remap backward-char]
+ 'undo-tree-visualize-switch-branch-left)
(define-key undo-tree-visualizer-map [right]
'undo-tree-visualize-switch-branch-right)
(define-key undo-tree-visualizer-map "f"
- [elpa] externals/undo-tree fd3fc5c 046/195: Pass null argument to kill-buffer call in undo-tree-visualizer-quit,, (continued)
- [elpa] externals/undo-tree fd3fc5c 046/195: Pass null argument to kill-buffer call in undo-tree-visualizer-quit,, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 45751ef 050/195: Fixed bug in undo-tree-switch-branch., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree f454e88 001/195: Started project to add vim-like undo tree handling to emacs., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree b2eab5a 016/195: Made visualizer buffer read-only., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 4877b0f 008/195: Added markers to record positions of nodes in visualizer., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 7f3c87d 030/195: Added installation instructions to commentary, and keybinding documentation, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree c8b2659 032/195: Prevented undo-tree-kill-visualizer from killing visualizer when undoing/redoing, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree c041ce8 033/195: Added missing (eval-when-compile (require 'cl)) line., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 3b1a83f 036/195: Fixed undo-tree-visualizer-quit to make it remove kill visualizer hook, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree f3fc5cd 037/195: Modified undo-tree-undo/redo to always replace redo/undo entries, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree f93420b 038/195: Remap undo-only to undo-tree-undo in undo-tree-map.,
Stefan Monnier <=
- [elpa] externals/undo-tree f8c3abf 039/195: Replaced save-excursion's with with-current-buffer., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 723eeeb 040/195: Improved undo-tree-visualizer-quit behaviour, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 8871f91 041/195: Added header containing git repository URL., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 3f5cc71 045/195: Updated commentary to include register commands,, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 5176770 047/195: Added missing Change Log entry., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree f44688d 048/195: Prevent debugger being called on "No further redo information" error., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree bff9f31 049/195: Made undo-tree-visualizer-quit select window displaying parent buffer, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 04b1a6f 054/195: Fixed bugs in history-discarding logic., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 227473a 058/195: Modified undo-tree-node defstruct and macros to allow arbitrary meta-data, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 011e11e 061/195: Rebuild buffer-undo-list from tree when disabling undo-tree-mode., Stefan Monnier, 2020/11/28