From c45e5634533fa19530eb8942d7a5325a4d36e471 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 7 Aug 2018 03:14:28 +0200 Subject: [PATCH] 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. --- core/core-editor.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/core-editor.el b/core/core-editor.el index f198f89ec..3a42c8609 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -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)