emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/undo-tree caa3bd0 082/195: Added new customization opti


From: Stefan Monnier
Subject: [elpa] externals/undo-tree caa3bd0 082/195: Added new customization option to allow undo-in-region to be disabled.
Date: Sat, 28 Nov 2020 13:41:26 -0500 (EST)

branch: externals/undo-tree
commit caa3bd00d93d7ecbd52231a0185088f4a2c6f603
Author: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>
Commit: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>

    Added new customization option to allow undo-in-region to be disabled.
---
 undo-tree.el | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/undo-tree.el b/undo-tree.el
index 5151845..ffa590b 100644
--- a/undo-tree.el
+++ b/undo-tree.el
@@ -608,6 +608,8 @@
 ;; Version 0.3.4
 ;; * set `permanent-local' property on `buffer-undo-tree', to prevent history
 ;;   being discarded when switching major-mode
+;; * added `undo-tree-enabled-undo-in-region' customization option to allow
+;;   undo-in-region to be disabled.
 ;;
 ;; Version 0.3.3;
 ;; * added `term-mode' to `undo-tree-incompatible-major-modes'
@@ -746,6 +748,16 @@ when `undo-tree-mode' is enabled."
   :group 'undo-tree
   :type 'string)
 
+(defcustom undo-tree-enable-undo-in-region t
+  "When non-nil, enable undo-in-region.
+
+When undo-in-region is enabled, undoing or redoing when the
+region is active (in `transient-mark-mode') or with a prefix
+argument (not in `transient-mark-mode') only undoes changes
+within the current region."
+  :group 'undo-tree
+  :type 'boolean)
+
 (defcustom undo-tree-incompatible-major-modes '(term-mode)
   "List of major-modes in which `undo-tree-mode' should not be enabled.
 \(See `turn-on-undo-tree-mode'.\)"
@@ -2354,7 +2366,9 @@ undoing."
   (when (eq buffer-undo-list t) (error "No undo information in this buffer"))
 
   (let ((undo-in-progress t)
-       (undo-in-region (or (region-active-p) (and arg (not (numberp arg)))))
+       (undo-in-region (and undo-tree-enable-undo-in-region
+                            (or (region-active-p)
+                                (and arg (not (numberp arg))))))
        pos current)
     ;; transfer entries accumulated in `buffer-undo-list' to
     ;; `buffer-undo-tree'
@@ -2451,7 +2465,9 @@ redoing."
   (when (eq buffer-undo-list t) (error "No undo information in this buffer"))
 
   (let ((undo-in-progress t)
-       (redo-in-region (or (region-active-p) (and arg (not (numberp arg)))))
+       (redo-in-region (and undo-tree-enable-undo-in-region
+                            (or (region-active-p)
+                                (and arg (not (numberp arg))))))
        pos current)
     ;; transfer entries accumulated in `buffer-undo-list' to
     ;; `buffer-undo-tree'



reply via email to

[Prev in Thread] Current Thread [Next in Thread]