[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/undo-tree c8b2659 032/195: Prevented undo-tree-kill-vis
From: |
Stefan Monnier |
Subject: |
[elpa] externals/undo-tree c8b2659 032/195: Prevented undo-tree-kill-visualizer from killing visualizer when undoing/redoing |
Date: |
Sat, 28 Nov 2020 13:41:15 -0500 (EST) |
branch: externals/undo-tree
commit c8b26597fa11849a4ddada1d58f1d4ed5284bf1e
Author: tsc25 <tsc25@cantab.net>
Commit: tsc25 <tsc25@cantab.net>
Prevented undo-tree-kill-visualizer from killing visualizer when
undoing/redoing
from the visualizer, which completely broke the visualizer!
Changed C-+ redo binding to M-_, so that at least one set of undo/redo
bindings works in a terminal.
Bound vertical scrolling commands in undo-tree-visualizer-map, in case they
aren't bound globally.
Added missing :group argument to defface's.
---
undo-tree.el | 57 ++++++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 44 insertions(+), 13 deletions(-)
diff --git a/undo-tree.el b/undo-tree.el
index 2479447..0cddbd6 100644
--- a/undo-tree.el
+++ b/undo-tree.el
@@ -5,7 +5,7 @@
;; Copyright (C) 2009 Toby Cubitt
;; Author: Toby Cubitt <toby-undo-tree@dr-qubit.org>
-;; Version: 0.1
+;; Version: 0.1.1
;; Keywords: undo, redo, history, tree
;; URL: http://www.dr-qubit.org/emacs.php
@@ -83,7 +83,7 @@
;; C-_ C-/ (`undo-tree-undo')
;; Undo changes.
;;
-;; C-+ C-? (`undo-tree-redo')
+;; M-_ C-? (`undo-tree-redo')
;; Redo changes.
;;
;; `undo-tree-switch-branch'
@@ -455,6 +455,16 @@
;;; Change Log:
;;
+;; Version 0.1.1
+;; * prevented `undo-tree-kill-visualizer' from killing visualizer when
+;; undoing/redoing from the visualizer, which completely broke the
+;; visualizer!
+;; * changed one redo binding, so that at least one set of undo/redo bindings
+;; works in a terminal
+;; * bound vertical scrolling commands in `undo-tree-visualizer-map', in case
+;; they aren't bound globally
+;; * added missing :group argument to `defface's
+;;
;; Version 0.1
;; * initial release
@@ -487,17 +497,20 @@ Must be a postivie odd integer."
(defface undo-tree-visualizer-default-face
'((((class color)) :foreground "gray"))
- "*Face used to draw undo-tree in visualizer.")
+ "*Face used to draw undo-tree in visualizer."
+ :group 'undo-tree)
(defface undo-tree-visualizer-current-face
'((((class color)) :foreground "red"))
"*Face used to highlight current undo-tree node
-in visualizer.")
+in visualizer."
+ :group 'undo-tree)
(defface undo-tree-visualizer-active-branch-face
'((((class color)) :foreground "white" :weight bold))
"*Face used to highlight active undo-tree branch
-in visualizer.")
+in visualizer."
+ :group 'undo-tree)
(defvar undo-tree-visualizer-map nil
"Keymap used in undo-tree visualizer.")
@@ -521,9 +534,12 @@ in visualizer.")
(setq undo-tree-map (make-sparse-keymap))
;; remap `undo' to `undo-tree-undo'
(define-key undo-tree-map [remap undo] 'undo-tree-undo)
+ ;; bind standard undo bindings (since these match redo counterparts)
+ (define-key undo-tree-map "C-/" 'undo-tree-undo)
+ (define-key undo-tree-map "C-_" 'undo-tree-undo)
;; redo doesn't exist normally, so define out own keybindings
(define-key undo-tree-map (kbd "C-?") 'undo-tree-redo)
- (define-key undo-tree-map (kbd "C-+") 'undo-tree-redo)
+ (define-key undo-tree-map (kbd "M-_") 'undo-tree-redo)
;; just in case something has defined it...
(define-key undo-tree-map [remap redo] 'undo-tree-redo)
;; we use "C-x u" for the undo-tree visualizer
@@ -573,6 +589,9 @@ in visualizer.")
'undo-tree-visualizer-scroll-left)
(define-key undo-tree-visualizer-map ">"
'undo-tree-visualizer-scroll-right)
+ ;; vertical scrolling may be needed if the tree is very tall
+ (define-key undo-tree-visualizer-map [next] 'scroll-up)
+ (define-key undo-tree-visualizer-map [prior] 'scroll-down)
;; quit visualizer
(define-key undo-tree-visualizer-map "q"
'undo-tree-visualizer-quit)
@@ -1247,12 +1266,13 @@ using `undo-tree-redo'."
(defun undo-tree-kill-visualizer (&rest dummy)
;; Kill visualizer. Added to `before-change-functions' hook of original
;; buffer when visualizer is invoked.
- (unwind-protect
- (save-excursion
- (set-buffer " *undo-tree*")
- (undo-tree-visualizer-quit))
- ;; remove hook now that visualizer has been killed
- (remove-hook 'before-change-functions 'undo-tree-kill-visualizer t)))
+ (unless undo-in-progress
+ (unwind-protect
+ (save-excursion
+ (set-buffer " *undo-tree*")
+ (undo-tree-visualizer-quit))
+ ;; remove hook now that visualizer has been killed
+ (remove-hook 'before-change-functions 'undo-tree-kill-visualizer t))))
@@ -1525,7 +1545,17 @@ using `undo-tree-redo'."
;;; Visualizer mode commands
(defun undo-tree-visualizer-mode ()
- "Major mode used in undo-tree visualizer."
+ "Major mode used in undo-tree visualizer.
+
+The undo-tree visualizer can only be invoked from a buffer in
+which `undo-tree-mode' is enabled. The visualizer displays the
+undo history tree graphically, and allows you to browse around
+the undo history, undoing or redoing the corresponding changes in
+the parent buffer.
+
+Within the undo-tree visualizer, the following keys are available:
+
+ \\{undo-tree-visualizer-map}"
(kill-all-local-variables)
(setq major-mode 'undo-tree-visualizer-mode)
(setq mode-name "undo-tree-visualizer-mode")
@@ -1534,6 +1564,7 @@ using `undo-tree-redo'."
(setq buffer-read-only t))
+
(defun undo-tree-visualize-undo (&optional arg)
"Undo changes. A numeric ARG serves as a repeat count."
(interactive "p")
- [elpa] externals/undo-tree 86fb076 034/195: Fixed keybindings., (continued)
- [elpa] externals/undo-tree 86fb076 034/195: Fixed keybindings., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 948386b 035/195: Modified undo-tree-visualizer-active-branch-face, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree bca52bf 042/195: Added undo-tree-mode-lighter customization option, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 50ccefd 043/195: Fixed bug in undo-tree-discard-node., Stefan Monnier, 2020/11/28
- [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 <=
- [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, 2020/11/28
- [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