Bump :emacs undo

ideasman42/emacs-undo-fu@f4db4c9 -> ideasman42/emacs-undo-fu@e0ad06b
ideasman42/emacs-undo-fu-session@a038914 -> ideasman42/emacs-undo-fu-session@243d93b

Also refactors module to conform to conventions.
This commit is contained in:
Henrik Lissner 2021-05-06 15:34:06 -04:00
parent 9831642a02
commit b12a0c02b3
2 changed files with 16 additions and 22 deletions

View file

@ -27,33 +27,29 @@
(use-package! undo-fu-session (use-package! undo-fu-session
:unless (featurep! +tree) :unless (featurep! +tree)
:hook (undo-fu-mode . global-undo-fu-session-mode) :hook (undo-fu-mode . global-undo-fu-session-mode)
:preface :custom (undo-fu-session-directory (concat doom-cache-dir "undo-fu-session/"))
(setq undo-fu-session-directory (concat doom-cache-dir "undo-fu-session/") :config
undo-fu-session-incompatible-files '("\\.gpg$" "/COMMIT_EDITMSG\\'" "/git-rebase-todo\\'")) (setq undo-fu-session-incompatible-files '("\\.gpg$" "/COMMIT_EDITMSG\\'" "/git-rebase-todo\\'"))
;; HACK Fix #4993: prevent file names that are too long for the filesystem. ;; HACK Fix #4993: prevent file names that are too long for the filesystem.
;; TODO PR this upstream; should be a universal issue ;; TODO PR this upstream; should be a universal issue
(advice-add #'undo-fu-session--make-file-name (advice-add #'undo-fu-session--make-file-name
:filter-args #'doom-make-hashed-backup-file-name-a) :filter-args #'doom-make-hashed-backup-file-name-a)
;; HACK We avoid `:config' here because `use-package's `:after' complicates ;; HACK Use the faster zstd to compress undo files instead of gzip
;; the load order of a package's `:config' block and makes it impossible (when (executable-find "zstd")
;; for the user to override its settings with merely `after!' (or (defadvice! +undo--append-zst-extension-to-file-name-a (filename)
;; `eval-after-load'). See jwiegley/use-package#829. :filter-return #'undo-fu-session--make-file-name
(after! undo-fu-session (if undo-fu-session-compression
;; HACK Use the faster zstd to compress undo files instead of gzip (concat (file-name-sans-extension filename) ".zst")
(when (executable-find "zstd") filename))))
(defadvice! doom--undo-fu-session-use-zstd-a (filename)
:filter-return #'undo-fu-session--make-file-name
(if undo-fu-session-compression
(concat (file-name-sans-extension filename) ".zst")
filename)))))
(use-package! undo-tree (use-package! undo-tree
:when (featurep! +tree) :when (featurep! +tree)
;; Branching & persistent undo ;; Branching & persistent undo
:hook (doom-first-buffer . global-undo-tree-mode) :hook (doom-first-buffer . global-undo-tree-mode)
:custom (undo-tree-history-directory-alist `(("." . ,(concat doom-cache-dir "undo-tree-hist/"))))
:config :config
(setq undo-tree-visualizer-diff t (setq undo-tree-visualizer-diff t
undo-tree-auto-save-history t undo-tree-auto-save-history t
@ -63,9 +59,7 @@
;; https://github.com/syl20bnr/spacemacs/issues/12110 ;; https://github.com/syl20bnr/spacemacs/issues/12110
undo-limit 800000 undo-limit 800000
undo-strong-limit 12000000 undo-strong-limit 12000000
undo-outer-limit 120000000 undo-outer-limit 120000000)
undo-tree-history-directory-alist
`(("." . ,(concat doom-cache-dir "undo-tree-hist/"))))
;; Compress undo-tree history files with zstd, if available. File size isn't ;; 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; ;; the (only) concern here: the file IO barrier is slow for Emacs to cross;
@ -74,14 +68,14 @@
;; SSDs). Whether or not that's true in practice, we still enjoy zstd's ~80% ;; 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). ;; 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! +undo--append-zst-extension-to-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 ;; 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 ;; isn't the concern here; undo cache files bloat easily, which can cause
;; freezing, crashes, GC-induced stuttering or delays when opening files. ;; freezing, crashes, GC-induced stuttering or delays when opening files.
(defadvice! doom--undo-tree-strip-text-properties-a (&rest _) (defadvice! +undo--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)
(and (consp item) (and (consp item)

View file

@ -3,5 +3,5 @@
(if (featurep! +tree) (if (featurep! +tree)
(package! undo-tree :pin "e326c6135e62f5fe8536528d3acd5e798f847407") (package! undo-tree :pin "e326c6135e62f5fe8536528d3acd5e798f847407")
(package! undo-fu :pin "f4db4c9b9875134df6f5279281099361ae11c2e9") (package! undo-fu :pin "e0ad06b5ef2ac2733dad2ad48e3957b5c36edfa5")
(package! undo-fu-session :pin "a0389147365c10c974ad68b797b185affb935fe3")) (package! undo-fu-session :pin "243d93b4c7c1224e7067cd323f64d23dfdfe7c0e"))