diff --git a/core/core-editor.el b/core/core-editor.el index a70163462..215e9c3d0 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -263,6 +263,20 @@ savehist file." undo-tree-enable-undo-in-region nil undo-tree-history-directory-alist `(("." . ,(concat doom-cache-dir "undo-tree-hist/")))) + + (when (executable-find "zstd") + (defun doom*undo-tree-make-history-save-file-name (file) + (concat file ".zst")) + (advice-add #'undo-tree-make-history-save-file-name :filter-return + #'doom*undo-tree-make-history-save-file-name)) + + (defun doom*strip-text-properties-from-undo-history (&rest _) + (dolist (item buffer-undo-list) + (and (consp item) + (stringp (car item)) + (setcar item (substring-no-properties (car item)))))) + (advice-add #'undo-list-transfer-to-tree :before #'doom*strip-text-properties-from-undo-history) + (global-undo-tree-mode +1))