[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/undo-tree b2eab5a 016/195: Made visualizer buffer read-
From: |
Stefan Monnier |
Subject: |
[elpa] externals/undo-tree b2eab5a 016/195: Made visualizer buffer read-only. |
Date: |
Sat, 28 Nov 2020 13:41:11 -0500 (EST) |
branch: externals/undo-tree
commit b2eab5a897f48ae641b7dda3a5abc45494f79085
Author: tsc25 <tsc25@cantab.net>
Commit: tsc25 <tsc25@cantab.net>
Made visualizer buffer read-only.
---
undo-tree.el | 33 +++++++++++++++++++++++++++------
1 file changed, 27 insertions(+), 6 deletions(-)
diff --git a/undo-tree.el b/undo-tree.el
index ae4d988..c960c30 100644
--- a/undo-tree.el
+++ b/undo-tree.el
@@ -102,6 +102,15 @@ in visualizer.")
;; mouse sets buffer state to node at click
(define-key undo-tree-visualizer-map [mouse-1]
'undo-tree-visualizer-set)
+ ;; horizontal scrolling may be needed if tree is very wide
+ (define-key undo-tree-visualizer-map ","
+ (lambda () (interactive) "Scroll right." (scroll-right 1 t)))
+ (define-key undo-tree-visualizer-map "."
+ (lambda () (interactive) "Scroll left." (scroll-left 1 t)))
+ (define-key undo-tree-visualizer-map "<"
+ (lambda () (interactive) "Scroll right." (scroll-right 1 t)))
+ (define-key undo-tree-visualizer-map ">"
+ (lambda () (interactive) "Scroll left." (scroll-left 1 t)))
;; quit visualizer
(define-key undo-tree-visualizer-map "q"
'undo-tree-visualizer-quit)
@@ -516,7 +525,9 @@ using `undo-tree-redo'."
(setq undo-tree-visualizer-buffer buff)
(setq buffer-undo-tree undo-tree)
(setq cursor-type nil)
- (undo-tree-draw-tree undo-tree)))
+ (setq buffer-read-only nil)
+ (undo-tree-draw-tree undo-tree)
+ (setq buffer-read-only t)))
(defun undo-tree-draw-tree (undo-tree)
@@ -709,13 +720,16 @@ using `undo-tree-redo'."
(kill-all-local-variables)
(setq major-mode 'undo-tree-visualizer-mode)
(setq mode-name "undo-tree-visualizer-mode")
- (use-local-map undo-tree-visualizer-map))
+ (use-local-map undo-tree-visualizer-map)
+ (setq truncate-lines t)
+ (setq buffer-read-only t))
(defun undo-tree-visualize-undo (&optional arg)
"Undo changes. A numeric ARG serves as a repeat count."
(interactive "p")
(goto-char (undo-tree-node-marker (undo-tree-current buffer-undo-tree)))
+ (setq buffer-read-only nil)
(put-text-property (point) (1+ (point)) 'face 'default)
(switch-to-buffer-other-window undo-tree-visualizer-buffer)
(unwind-protect
@@ -723,13 +737,15 @@ using `undo-tree-redo'."
(switch-to-buffer-other-window " *undo-tree*")
(goto-char (undo-tree-node-marker (undo-tree-current buffer-undo-tree)))
(put-text-property (point) (1+ (point))
- 'face 'undo-tree-visualizer-current-face)))
+ 'face 'undo-tree-visualizer-current-face)
+ (setq buffer-read-only t)))
(defun undo-tree-visualize-redo (&optional arg)
"Redo changes. A numeric ARG serves as a repeat count."
(interactive "p")
(goto-char (undo-tree-node-marker (undo-tree-current buffer-undo-tree)))
+ (setq buffer-read-only nil)
(put-text-property (point) (1+ (point)) 'face 'default)
(switch-to-buffer-other-window undo-tree-visualizer-buffer)
(unwind-protect
@@ -737,7 +753,8 @@ using `undo-tree-redo'."
(switch-to-buffer-other-window " *undo-tree*")
(goto-char (undo-tree-node-marker (undo-tree-current buffer-undo-tree)))
(put-text-property (point) (1+ (point))
- 'face 'undo-tree-visualizer-current-face)))
+ 'face 'undo-tree-visualizer-current-face)
+ (setq buffer-read-only t)))
(defun undo-tree-visualize-switch-next-branch (arg)
@@ -748,6 +765,7 @@ using `undo-tree-redo' or `undo-tree-visualizer-redo'."
(switch-to-buffer-other-window undo-tree-visualizer-buffer)
(switch-to-buffer-other-window " *undo-tree*")
;; 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))
(save-excursion
@@ -766,7 +784,8 @@ using `undo-tree-redo' or `undo-tree-visualizer-redo'."
(undo-tree-draw-subtree (undo-tree-current buffer-undo-tree) 'active)))
;; re-highlight current node
(put-text-property (point) (1+ (point))
- 'face 'undo-tree-visualizer-current-face)))
+ 'face 'undo-tree-visualizer-current-face)
+ (setq buffer-read-only t)))
(defun undo-tree-visualize-switch-previous-branch (arg)
@@ -795,4 +814,6 @@ at POS."
(set-buffer undo-tree-visualizer-buffer)
(undo-tree-set node)
(set-buffer " *undo-tree*")
- (undo-tree-draw-tree buffer-undo-tree))))
+ (setq buffer-read-only nil)
+ (undo-tree-draw-tree buffer-undo-tree)
+ (setq buffer-read-only t))))
- [elpa] externals/undo-tree aaa4c6d 012/195: Don't create new marker each time we draw a node., (continued)
- [elpa] externals/undo-tree aaa4c6d 012/195: Don't create new marker each time we draw a node., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 159c9b4 005/195: Implemented undo-tree branch switching., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 0bbfa5c 026/195: Tweaked commentary., Stefan Monnier, 2020/11/28
- [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 <=
- [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, 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