Add comments for undo-tree advice
Describes why we try to compress undo-tree history data. I'm aware that undo-tree-auto-save-history is disabled, but that may change in the near future.
This commit is contained in:
parent
f68203c2ef
commit
ed96d60e2c
1 changed files with 9 additions and 0 deletions
|
@ -426,11 +426,20 @@ files, so we replace calls to `pp' with the much faster `prin1'."
|
||||||
undo-tree-history-directory-alist
|
undo-tree-history-directory-alist
|
||||||
`(("." . ,(concat doom-cache-dir "undo-tree-hist/"))))
|
`(("." . ,(concat doom-cache-dir "undo-tree-hist/"))))
|
||||||
|
|
||||||
|
;; 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;
|
||||||
|
;; reading a tiny file and piping it in-memory through zstd is *slightly*
|
||||||
|
;; faster than Emacs reading the entire undo-tree file from the get go (on
|
||||||
|
;; 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")
|
(when (executable-find "zstd")
|
||||||
(defadvice! doom--undo-tree-make-history-save-file-name-a (file)
|
(defadvice! doom--undo-tree-make-history-save-file-name-a (file)
|
||||||
:filter-return #'undo-tree-make-history-save-file-name
|
:filter-return #'undo-tree-make-history-save-file-name
|
||||||
(concat file ".zst")))
|
(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! doom--undo-tree-strip-text-properties-a (&rest _)
|
||||||
:before #'undo-list-transfer-to-tree
|
:before #'undo-list-transfer-to-tree
|
||||||
(dolist (item buffer-undo-list)
|
(dolist (item buffer-undo-list)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue