[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/undo-tree 897f2ff 089/195: Let-bind inhibit-read-only i
From: |
Stefan Monnier |
Subject: |
[elpa] externals/undo-tree 897f2ff 089/195: Let-bind inhibit-read-only instead of setting and restoring buffer-read-only. |
Date: |
Sat, 28 Nov 2020 13:41:28 -0500 (EST) |
branch: externals/undo-tree
commit 897f2ffbb2d6a5975fc4a47fc4abe90573737001
Author: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>
Commit: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>
Let-bind inhibit-read-only instead of setting and restoring
buffer-read-only.
---
undo-tree.el | 48 ++++++++++++++++++++++--------------------------
1 file changed, 22 insertions(+), 26 deletions(-)
diff --git a/undo-tree.el b/undo-tree.el
index aea56ae..7f01755 100644
--- a/undo-tree.el
+++ b/undo-tree.el
@@ -616,6 +616,8 @@
;; `undo-tree-restore-state-from-register')
;; * suppress branch point messages when undo/redoing from `undo-tree-set'
;; * make various interactive commands signal an error if buffer is read-only
+;; * let-bind `inhibit-read-only' instead of setting and restoring
+;; `buffer-read-only'
;;
;; Version 0.3.5
;; * improved `undo-tree-switch-branch': display current branch number in
@@ -2855,9 +2857,7 @@ signaling an error if file is not found."
(undo-tree-visualizer-mode)
(setq undo-tree-visualizer-parent-buffer buff)
(setq buffer-undo-tree undo-tree)
- (setq buffer-read-only nil)
- (undo-tree-draw-tree undo-tree)
- (setq buffer-read-only t)))
+ (let ((inhibit-read-only t)) (undo-tree-draw-tree undo-tree))))
(defun undo-tree-kill-visualizer (&rest dummy)
@@ -3197,23 +3197,23 @@ Within the undo-tree visualizer, the following keys are
available:
(defun undo-tree-visualize-undo (&optional arg)
"Undo changes. A numeric ARG serves as a repeat count."
(interactive "p")
- (setq buffer-read-only nil)
- (let ((undo-tree-insert-face 'undo-tree-visualizer-active-branch-face))
+ (let ((undo-tree-insert-face 'undo-tree-visualizer-active-branch-face)
+ (inhibit-read-only t))
(undo-tree-draw-node (undo-tree-current buffer-undo-tree)))
(switch-to-buffer-other-window undo-tree-visualizer-parent-buffer)
(deactivate-mark)
(unwind-protect
(undo-tree-undo arg)
(switch-to-buffer-other-window undo-tree-visualizer-buffer-name)
- (undo-tree-draw-node (undo-tree-current buffer-undo-tree) 'current)
- (setq buffer-read-only t)))
+ (let ((inhibit-read-only t))
+ (undo-tree-draw-node (undo-tree-current buffer-undo-tree) 'current))))
(defun undo-tree-visualize-redo (&optional arg)
"Redo changes. A numeric ARG serves as a repeat count."
(interactive "p")
- (setq buffer-read-only nil)
- (let ((undo-tree-insert-face 'undo-tree-visualizer-active-branch-face))
+ (let ((undo-tree-insert-face 'undo-tree-visualizer-active-branch-face)
+ (inhibit-read-only t))
(undo-tree-draw-node (undo-tree-current buffer-undo-tree)))
(switch-to-buffer-other-window undo-tree-visualizer-parent-buffer)
(deactivate-mark)
@@ -3221,8 +3221,8 @@ Within the undo-tree visualizer, the following keys are
available:
(undo-tree-redo arg)
(switch-to-buffer-other-window undo-tree-visualizer-buffer-name)
(goto-char (undo-tree-node-marker (undo-tree-current buffer-undo-tree)))
- (undo-tree-draw-node (undo-tree-current buffer-undo-tree) 'current)
- (setq buffer-read-only t)))
+ (let ((inhibit-read-only t))
+ (undo-tree-draw-node (undo-tree-current buffer-undo-tree) 'current))))
(defun undo-tree-visualize-switch-branch-right (arg)
@@ -3231,9 +3231,9 @@ This will affect which branch to descend when *redoing*
changes
using `undo-tree-redo' or `undo-tree-visualizer-redo'."
(interactive "p")
;; un-highlight old active branch below current node
- (setq buffer-read-only nil)
(goto-char (undo-tree-node-marker (undo-tree-current buffer-undo-tree)))
- (let ((undo-tree-insert-face 'undo-tree-visualizer-default-face))
+ (let ((undo-tree-insert-face 'undo-tree-visualizer-default-face)
+ (inhibit-read-only t))
(undo-tree-highlight-active-branch (undo-tree-current buffer-undo-tree)))
;; increment branch
(let ((branch (undo-tree-node-branch (undo-tree-current buffer-undo-tree))))
@@ -3243,13 +3243,13 @@ using `undo-tree-redo' or `undo-tree-visualizer-redo'."
(1- (undo-tree-num-branches)))
((<= (+ branch arg) 0) 0)
(t (+ branch arg))))
- ;; highlight new active branch below current node
- (goto-char (undo-tree-node-marker (undo-tree-current buffer-undo-tree)))
- (let ((undo-tree-insert-face 'undo-tree-visualizer-active-branch-face))
- (undo-tree-highlight-active-branch (undo-tree-current buffer-undo-tree)))
- ;; re-highlight current node
- (undo-tree-draw-node (undo-tree-current buffer-undo-tree) 'current)
- (setq buffer-read-only t)))
+ (let ((inhibit-read-only t))
+ ;; highlight new active branch below current node
+ (goto-char (undo-tree-node-marker (undo-tree-current buffer-undo-tree)))
+ (let ((undo-tree-insert-face 'undo-tree-visualizer-active-branch-face))
+ (undo-tree-highlight-active-branch (undo-tree-current buffer-undo-tree)))
+ ;; re-highlight current node
+ (undo-tree-draw-node (undo-tree-current buffer-undo-tree) 'current))))
(defun undo-tree-visualize-switch-branch-left (arg)
@@ -3287,10 +3287,8 @@ at POS, or point if POS is nil."
(set-buffer undo-tree-visualizer-parent-buffer)
(undo-tree-set node)
(set-buffer undo-tree-visualizer-buffer-name)
- (setq buffer-read-only nil)
;; re-draw undo tree
- (undo-tree-draw-tree buffer-undo-tree)
- (setq buffer-read-only t))))
+ (let ((inhibit-read-only t)) (undo-tree-draw-tree buffer-undo-tree)))))
(defun undo-tree-visualizer-mouse-set (pos)
@@ -3310,9 +3308,7 @@ at mouse event POS."
(max 13 (default-value 'undo-tree-visualizer-spacing))
(default-value 'undo-tree-visualizer-spacing)))
;; redraw tree
- (setq buffer-read-only nil)
- (undo-tree-draw-tree buffer-undo-tree)
- (setq buffer-read-only t))
+ (let ((inhibit-read-only t)) (undo-tree-draw-tree buffer-undo-tree)))
(defun undo-tree-visualizer-scroll-left (&optional arg)
- [elpa] externals/undo-tree 3255044 065/195: Fixed bugs in undo-list-transfer-to-tree and undo-list-rebuild-from-tree, (continued)
- [elpa] externals/undo-tree 3255044 065/195: Fixed bugs in undo-list-transfer-to-tree and undo-list-rebuild-from-tree, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 07e934a 080/195: Added term-mode to undo-tree-incompatible-major-modes., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree acd7549 070/195: Prevent global-undo-tree-mode being enabled in incompatible major-modes., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 79b382b 083/195: Fixed bug in undo-list-pop-changeset when called with non-null DISCARD-POS., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 6680aab 086/195: Create proper registerv structure when storing undo state in register., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree cd06456 073/195: Modified slightly misleading message in turn-on-undo-tree-mode., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 98170c6 075/195: Added additional check to more reliably identify marker undo elements., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 89bf725 081/195: Prevent undo history being discarded on major-mode switch, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 2b0395a 096/195: Added called-interactively-p compatibility hack for Emacs <= 23.1, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree b42fe10 076/195: Fixed bug in undo-list-transfer-to-tree., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 897f2ff 089/195: Let-bind inhibit-read-only instead of setting and restoring buffer-read-only.,
Stefan Monnier <=
- [elpa] externals/undo-tree adca566 094/195: Allow undo-tree-visualizer-diff variable to be customized., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree da54994 117/195: When discarding root, erase previous link of new root., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 4c6280b 101/195: Fixed bug preventing registers being displayed in visualizer., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 3ab4581 107/195: Avoid error if point was moved manually in visualizer selection mode, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 824b904 129/195: Preparatory changes for lazy tree drawing., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 40c7065 108/195: Added undo-tree-visualizer-abort command, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 107d4c8 102/195: Allow visualizer to display relative timestamps., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 1561d8f 099/195: Preserve timestamps when generating diff for visualizer diff view., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 08db836 123/195: Fix bug in undo-tree-visualizer-select-left/right., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 6e5cc0f 104/195: Generate history save filename using a function, to allow customization., Stefan Monnier, 2020/11/28