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

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

[elpa] externals/undo-tree e6f31a0 179/195: Use custom undo-[strong-|out


From: Stefan Monnier
Subject: [elpa] externals/undo-tree e6f31a0 179/195: Use custom undo-[strong-|outer]-limit values in undo-tree-mode.
Date: Sat, 28 Nov 2020 13:41:48 -0500 (EST)

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

    Use custom undo-[strong-|outer]-limit values in undo-tree-mode.
    
    By default, these are larger than Emacs default values, to avoid history 
being
    discarded as aggressively by Emacs.
---
 undo-tree.el | 46 +++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 5 deletions(-)

diff --git a/undo-tree.el b/undo-tree.el
index 0ee30b8..b1c6612 100644
--- a/undo-tree.el
+++ b/undo-tree.el
@@ -4,7 +4,7 @@
 
 ;; Author: Toby Cubitt <toby-undo-tree@dr-qubit.org>
 ;; Maintainer: Toby Cubitt <toby-undo-tree@dr-qubit.org>
-;; Version: 0.6.7
+;; Version: 0.7
 ;; Keywords: convenience, files, undo, redo, history, tree
 ;; URL: http://www.dr-qubit.org/emacs.php
 ;; Repository: http://www.dr-qubit.org/git/undo-tree.git
@@ -874,6 +874,31 @@
   "Tree undo/redo."
   :group 'undo)
 
+(defcustom undo-tree-limit 80000000
+  "Value of `undo-limit' used in `undo-tree-mode'.
+
+If `undo-limit' is larger than `undo-tree-limit', the larger of
+the two values will be used."
+  :group 'undo-tree
+  :type 'integer)
+
+(defcustom undo-tree-strong-limit 120000000
+  "Value of `undo-strong-limit' used in `undo-tree-mode'.
+
+If `undo-strong-limit' is larger than `undo-tree-strong-limit'
+the larger of the two values will be used."
+  :group 'undo-tree
+  :type 'integer)
+
+(defcustom undo-tree-outer-limit 360000000
+  "Value of `undo-outer-limit' used in `undo-tree-mode'.
+
+If `undo-outer-limit' is larger than `undo-tree-outer-limit' the
+larger of the two values will be used."
+  :group 'undo-tree
+  :type 'integer)
+
+
 (defcustom undo-tree-mode-lighter " Undo-Tree"
   "Lighter displayed in mode line
 when `undo-tree-mode' is enabled."
@@ -1818,7 +1843,7 @@ Comparison is done with `eq'."
          (setf (undo-tree-size buffer-undo-tree) size)
          (setf (undo-tree-count buffer-undo-tree) count)
          (setq undo-list '(nil undo-tree-canary))))))
-  
+
   ;; discard undo history if necessary
   (undo-tree-discard-history))
 
@@ -2690,11 +2715,22 @@ Within the undo-tree visualizer, the following keys are 
available:
 
   ;; if disabling `undo-tree-mode', rebuild `buffer-undo-list' from tree so
   ;; Emacs undo can work
-  (if undo-tree-mode
-      (add-hook 'post-gc-hook #'undo-tree-post-gc nil )
+  (cond
+   (undo-tree-mode
+    (set (make-local-variable 'undo-limit)
+        (max undo-limit undo-tree-limit))
+    (set (make-local-variable 'undo-strong-limit)
+        (max undo-strong-limit undo-tree-strong-limit))
+    (set (make-local-variable 'undo-outer-limit)
+        (max undo-outer-limit undo-tree-outer-limit))
+    (add-hook 'post-gc-hook #'undo-tree-post-gc nil))
+   (t
     (undo-list-rebuild-from-tree)
     (setq buffer-undo-tree nil)
-    (remove-hook 'post-gc-hook #'undo-tree-post-gc 'local)))
+    (remove-hook 'post-gc-hook #'undo-tree-post-gc 'local)
+    (kill-local-variable 'undo-limit)
+    (kill-local-variable 'undo-strong-limit)
+    (kill-local-variable 'undo-outer-limit))))
 
 
 (defun turn-on-undo-tree-mode (&optional print-message)



reply via email to

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