Fix advice for `undo-tree-make-history-save-file-name'

Inspired by #786: `:filter-return' expects a function to be given. If neither
"zstd" or "gzip" are found on the executable path, then it gets given nil
instead, which results in sadness when trying to save files.
This commit is contained in:
Henrik Lissner
2018-08-07 03:14:28 +02:00
parent e266ec9eec
commit c45e563453

View File

@ -221,13 +221,16 @@ savehist file."
`(("." . ,(concat doom-cache-dir "undo-tree-hist/"))))
(global-undo-tree-mode +1)
;; compress undo with xz
(advice-add #'undo-tree-make-history-save-file-name :filter-return
(cond ((executable-find "zstd") (lambda (file) (concat file ".zst")))
((executable-find "gzip") (lambda (file) (concat file ".gz")))))
(advice-add #'undo-tree-load-history :around #'doom*shut-up)
;; compress undo history with xz
(defun doom*undo-tree-make-history-save-file-name (file)
(cond ((executable-find "zstd") (concat file ".zst"))
((executable-find "gzip") (concat file ".gz"))
(file)))
(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 (orig-fn &rest args)
(dolist (item buffer-undo-list)
(and (consp item)