[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/undo-tree 17454bd 084/195: Improved undo-tree-switch-br
From: |
Stefan Monnier |
Subject: |
[elpa] externals/undo-tree 17454bd 084/195: Improved undo-tree-switch-branch behaviour. |
Date: |
Sat, 28 Nov 2020 13:41:27 -0500 (EST) |
branch: externals/undo-tree
commit 17454bd8de832ae8b67a468635ec30c7646f37c3
Author: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>
Commit: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>
Improved undo-tree-switch-branch behaviour.
---
undo-tree.el | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/undo-tree.el b/undo-tree.el
index db09227..ce8a802 100644
--- a/undo-tree.el
+++ b/undo-tree.el
@@ -4,7 +4,7 @@
;; Copyright (C) 2009-2012 Toby Cubitt
;; Author: Toby Cubitt <toby-undo-tree@dr-qubit.org>
-;; Version: 0.3.4
+;; Version: 0.3.5
;; Keywords: convenience, files, undo, redo, history, tree
;; URL: http://www.dr-qubit.org/emacs.php
;; Git Repository: http://www.dr-qubit.org/git/undo-tree.git
@@ -605,6 +605,11 @@
;;; Change Log:
;;
+;; Version 0.3.5
+;; * improved `undo-tree-switch-branch': display current branch number in
+;; prompt, switch to other branch without prompting when there are only two,
+;; and display message indicating new branch number after switching
+;;
;; Version 0.3.4
;; * set `permanent-local' property on `buffer-undo-tree', to prevent history
;; being discarded when switching major-mode
@@ -2558,10 +2563,18 @@ using `undo-tree-redo'."
(interactive (list (or (and prefix-arg (prefix-numeric-value prefix-arg))
(and (not (eq buffer-undo-list t))
(or (undo-list-transfer-to-tree) t)
- (> (undo-tree-num-branches) 1)
- (read-number
- (format "Branch (0-%d): "
- (1- (undo-tree-num-branches))))))))
+ (let ((b (undo-tree-node-branch
+ (undo-tree-current
+ buffer-undo-tree))))
+ (cond
+ ;; switch to other branch if only 2
+ ((= (undo-tree-num-branches) 2) (- 1 b))
+ ;; prompt if more than 2
+ ((> (undo-tree-num-branches) 2)
+ (read-number
+ (format "Branch (0-%d, on %d): "
+ (1- (undo-tree-num-branches)) b)))
+ ))))))
;; throw error if undo is disabled in buffer
(when (eq buffer-undo-list t) (error "No undo information in this buffer"))
;; sanity check branch number
@@ -2572,7 +2585,8 @@ using `undo-tree-redo'."
(undo-list-transfer-to-tree)
;; switch branch
(setf (undo-tree-node-branch (undo-tree-current buffer-undo-tree))
- branch))
+ branch)
+ (message "Switched to branch %d" branch))
(defun undo-tree-set (node)
- [elpa] externals/undo-tree ea165ed 174/195: Refactor undo-list-transfer-to-tree to not act directly on buffer-undo-list., (continued)
- [elpa] externals/undo-tree ea165ed 174/195: Refactor undo-list-transfer-to-tree to not act directly on buffer-undo-list., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 8842bb5 176/195: More undo-tree GC corruption mitigations., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree f6f557c 178/195: Fix various bugs in undo history loading/saving., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree b8652b4 180/195: Null undo-tree-limit attemps to preserve all undo history., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree f0a6192 184/195: Proper fix to copy-undo-tree by writing bespoke copier., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 3090c4f 185/195: Temporarily increase max-lisp-eval-depth and max-specpdl-size when copying undo-trees., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 8cf384f 187/195: Redraw visualizer when history-discarding invalidates it., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree d79fab9 193/195: Switch from cl to cl-lib., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree bd65bb0 192/195: Fix hook function issue in Emacs 27., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree e01a3e7 191/195: Fix some byte-compilation warnings., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 17454bd 084/195: Improved undo-tree-switch-branch behaviour.,
Stefan Monnier <=
- [elpa] externals/undo-tree f16ab5f 067/195: Trivial fix in Commentary., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree e8215a7 078/195: Minor typo fixes in comments., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 8697a0b 077/195: Clear registers referring to nodes being discarded from undo history., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree f956d55 074/195: Added autoload cookies, and other tweaks to prepare for ELPA packaging., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 4e558f8 088/195: Make various interactive commands signal an error if buffer is read-only., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree e001bd5 091/195: Implemented diff display in visualizer., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 1229460 095/195: Make visualizer diff buffer name into a defconst., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 7fef53f 092/195: Display diff with current node in visualizer selection mode., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree f3e7324 090/195: Use undo-tree-inhibit-kill-visualizer to inhibit undo-tree-kill-visualizer., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree bb92692 093/195: Don't override diff-switches customization option in visualizer diff display., Stefan Monnier, 2020/11/28