From 33e93de7e3675fc77b513916738101b620b6d10b Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Thu, 23 Apr 2020 09:47:29 -0400 Subject: [PATCH] Disable global-wakatime-mode when recovering files --- emacs/init.org | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/emacs/init.org b/emacs/init.org index 21838a3..cae43a2 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -4006,7 +4006,16 @@ It needs a helper script to work properly. (setq wakatime-api-key (password-store-get "wakatime-api-key") wakatime-cli-path (executable-find "wakatime")) :config - (global-wakatime-mode)) + (global-wakatime-mode) + ;; global-wakatime-mode breaks recovering autosaves for some reason + (advice-add 'recover-this-file :around + (lambda (oldfn &rest args) + (let ((wakatime-was-enabled global-wakatime-mode)) + (when wakatime-was-enabled + (global-wakatime-mode -1)) + (apply oldfn args) + (when wakatime-was-enabled + (global-wakatime-mode)))))) #+END_SRC * Elfeed