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:
parent
3399580647
commit
646cba3f68
1 changed files with 14 additions and 0 deletions
|
@ -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))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue