Henrik Lissner 2023-02-18 15:52:45 -05:00
parent 7c1c1f52bb
commit 81268cc5cf
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
4 changed files with 15 additions and 18 deletions

View file

@ -31,6 +31,11 @@
:config
(setq undo-fu-session-incompatible-files '("\\.gpg$" "/COMMIT_EDITMSG\\'" "/git-rebase-todo\\'"))
(when (executable-find "zstd")
;; There are other algorithms available, but zstd is the fastest, and speed
;; is our priority within Emacs
(setq undo-fu-session-compression 'zst))
;; HACK Fix #4993: we've advised `make-backup-file-name-1' to produced SHA1'ed
;; filenames to prevent file paths that are too long, so we force
;; `undo-fu-session--make-file-name' to use it instead of its own
@ -38,17 +43,9 @@
;; TODO PR this upstream; should be a universal issue
(defadvice! +undo-fu-make-hashed-session-file-name-a (file)
:override #'undo-fu-session--make-file-name
(let ((backup-directory-alist `(("." . ,undo-fu-session-directory))))
(concat (make-backup-file-name-1 file)
(if undo-fu-session-compression ".gz" ".el"))))
;; 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))))
(concat (let ((backup-directory-alist `(("." . ,undo-fu-session-directory))))
(make-backup-file-name-1 file))
(undo-fu-session--file-name-ext))))
(use-package! undo-tree