mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
Bring back undo history compression
But only if zstd is available. Also strips text properties from the undo list. This often provides a 30-50% size benefit, with a negligible performance impact.
This commit is contained in:
@ -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))
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user