diff --git a/modules/emacs/undo/config.el b/modules/emacs/undo/config.el index 2bb118284..31deb4d2d 100644 --- a/modules/emacs/undo/config.el +++ b/modules/emacs/undo/config.el @@ -27,33 +27,29 @@ (use-package! undo-fu-session :unless (featurep! +tree) :hook (undo-fu-mode . global-undo-fu-session-mode) - :preface - (setq undo-fu-session-directory (concat doom-cache-dir "undo-fu-session/") - undo-fu-session-incompatible-files '("\\.gpg$" "/COMMIT_EDITMSG\\'" "/git-rebase-todo\\'")) + :custom (undo-fu-session-directory (concat doom-cache-dir "undo-fu-session/")) + :config + (setq undo-fu-session-incompatible-files '("\\.gpg$" "/COMMIT_EDITMSG\\'" "/git-rebase-todo\\'")) ;; HACK Fix #4993: prevent file names that are too long for the filesystem. ;; TODO PR this upstream; should be a universal issue (advice-add #'undo-fu-session--make-file-name :filter-args #'doom-make-hashed-backup-file-name-a) - ;; HACK We avoid `:config' here because `use-package's `:after' complicates - ;; the load order of a package's `:config' block and makes it impossible - ;; for the user to override its settings with merely `after!' (or - ;; `eval-after-load'). See jwiegley/use-package#829. - (after! undo-fu-session - ;; HACK Use the faster zstd to compress undo files instead of gzip - (when (executable-find "zstd") - (defadvice! doom--undo-fu-session-use-zstd-a (filename) - :filter-return #'undo-fu-session--make-file-name - (if undo-fu-session-compression - (concat (file-name-sans-extension filename) ".zst") - filename))))) + ;; HACK Use the faster zstd to compress undo files instead of gzip + (when (executable-find "zstd") + (defadvice! +undo--append-zst-extension-to-file-name-a (filename) + :filter-return #'undo-fu-session--make-file-name + (if undo-fu-session-compression + (concat (file-name-sans-extension filename) ".zst") + filename)))) (use-package! undo-tree :when (featurep! +tree) ;; Branching & persistent undo :hook (doom-first-buffer . global-undo-tree-mode) + :custom (undo-tree-history-directory-alist `(("." . ,(concat doom-cache-dir "undo-tree-hist/")))) :config (setq undo-tree-visualizer-diff t undo-tree-auto-save-history t @@ -63,9 +59,7 @@ ;; https://github.com/syl20bnr/spacemacs/issues/12110 undo-limit 800000 undo-strong-limit 12000000 - undo-outer-limit 120000000 - undo-tree-history-directory-alist - `(("." . ,(concat doom-cache-dir "undo-tree-hist/")))) + undo-outer-limit 120000000) ;; 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; @@ -74,14 +68,14 @@ ;; SSDs). Whether or not that's true in practice, we still enjoy zstd's ~80% ;; file savings (these files add up over time and zstd is so incredibly fast). (when (executable-find "zstd") - (defadvice! doom--undo-tree-make-history-save-file-name-a (file) + (defadvice! +undo--append-zst-extension-to-file-name-a (file) :filter-return #'undo-tree-make-history-save-file-name (concat file ".zst"))) ;; Strip text properties from undo-tree data to stave off bloat. File size ;; isn't the concern here; undo cache files bloat easily, which can cause ;; freezing, crashes, GC-induced stuttering or delays when opening files. - (defadvice! doom--undo-tree-strip-text-properties-a (&rest _) + (defadvice! +undo--strip-text-properties-a (&rest _) :before #'undo-list-transfer-to-tree (dolist (item buffer-undo-list) (and (consp item) diff --git a/modules/emacs/undo/packages.el b/modules/emacs/undo/packages.el index 3d60d0526..e80e7dad2 100644 --- a/modules/emacs/undo/packages.el +++ b/modules/emacs/undo/packages.el @@ -3,5 +3,5 @@ (if (featurep! +tree) (package! undo-tree :pin "e326c6135e62f5fe8536528d3acd5e798f847407") - (package! undo-fu :pin "f4db4c9b9875134df6f5279281099361ae11c2e9") - (package! undo-fu-session :pin "a0389147365c10c974ad68b797b185affb935fe3")) + (package! undo-fu :pin "e0ad06b5ef2ac2733dad2ad48e3957b5c36edfa5") + (package! undo-fu-session :pin "243d93b4c7c1224e7067cd323f64d23dfdfe7c0e"))