I am trying to make undo-tree
auto compress the history save file. The document suggests adding the following advice
(defadvice undo-tree-make-history-save-file-name
(after undo-tree activate)
(setq ad-return-value (concat ad-return-value ".gz")))
This works as expected, but defadvice
is now obsolete, so I want rewrite this piece of code with advice-add
. Here is what I've done
(defun undo-tree-advice-history-save-file-name (history-save-file-name)
(concat history-save-file-name ".gz"))
(advice-add #'undo-tree :filter-return #'undo-tree-advice-history-save-file-name)
This doesn't produce any error or warning, but it has no effect: save files were not compressed into a .gz
archive, but were left as plain text files instead. So I took this answer as reference and tried
(defun undo-tree-advice-history-save-file-name (old-function &rest arguments)
(concat (apply old-function arguments) ".gz"))
(advice-add #'undo-tree :around #'undo-tree-advice-history-save-file-name)
Again, this advice is ignored. What am I doing wrong?