From cdbd39ba26481b3bced7f8bf180e00723742f2e8 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 12 Jul 2021 21:57:44 -0400 Subject: [PATCH] emacs/undo: increase undo-outer-limit Was missing a 0 (a typo), which meant it was less than its default value, thus having the opposite effect and making data loss *more* likely. Also got rid of outdated comments; I think those have been around since the sub-v2.0 days of Doom. --- modules/emacs/undo/config.el | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/modules/emacs/undo/config.el b/modules/emacs/undo/config.el index 2c84ba4c6..bfa98f4a7 100644 --- a/modules/emacs/undo/config.el +++ b/modules/emacs/undo/config.el @@ -4,10 +4,10 @@ :unless (featurep! +tree) :hook (doom-first-buffer . undo-fu-mode) :config - ;; Store more undo history to prevent loss of data - (setq undo-limit 400000 - undo-strong-limit 3000000 - undo-outer-limit 3000000) + ;; Increase undo history limits to reduce likelihood of data loss + (setq undo-limit 400000 ; 400kb (default is 160kb) + undo-strong-limit 3000000 ; 3mb (default is 240kb) + undo-outer-limit 48000000) ; 48mb (default is 24mb) (define-minor-mode undo-fu-mode "Enables `undo-fu' for the current session." @@ -60,12 +60,14 @@ (setq undo-tree-visualizer-diff t undo-tree-auto-save-history t undo-tree-enable-undo-in-region t - ;; Increase undo-limits by a factor of ten to avoid emacs prematurely - ;; truncating the undo history and corrupting the tree. See - ;; https://github.com/syl20bnr/spacemacs/issues/12110 - undo-limit 800000 - undo-strong-limit 12000000 - undo-outer-limit 120000000) + ;; Increase undo limits to avoid emacs prematurely truncating the undo + ;; history and corrupting the tree. This is larger than the undo-fu + ;; defaults because undo-tree trees consume exponentially more space, + ;; and then some when `undo-tree-enable-undo-in-region' is involved. See + ;; syl20bnr/spacemacs#12110 + undo-limit 800000 ; 800kb (default is 160kb) + undo-strong-limit 12000000 ; 12mb (default is 240kb) + undo-outer-limit 128000000) ; 128mb (default is 24mb) ;; Compress undo-tree history files with zstd, if available. File size isn't ;; the (only) concern here: the file IO barrier is slow for Emacs to cross;