From a7eef56b9d3b2a77fc83b2194bd8f19baaad8588 Mon Sep 17 00:00:00 2001 From: Yiming Chen Date: Sun, 1 Dec 2019 09:30:33 +0800 Subject: [PATCH] email/mu4e: restore window config when mu4e quit - see https://github.com/hlissner/doom-emacs/pull/2123#issuecomment-560010891 --- modules/email/mu4e/autoload/email.el | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/email/mu4e/autoload/email.el b/modules/email/mu4e/autoload/email.el index 171e989a1..ebd81aa61 100644 --- a/modules/email/mu4e/autoload/email.el +++ b/modules/email/mu4e/autoload/email.el @@ -44,6 +44,7 @@ default/fallback account." (defvar +mu4e-workspace-name "*mu4e*" "TODO") +(defvar +mu4e--old-wconf nil) (add-hook 'mu4e-main-mode-hook #'+mu4e-init-h) @@ -53,7 +54,8 @@ default/fallback account." (interactive) (require 'mu4e) (if (featurep :ui 'workspaces) - (+workspace-switch +mu4e-workspace-name t)) + (+workspace-switch +mu4e-workspace-name t) + (setq +mu4e--old-wconf (current-window-configuration))) (delete-other-windows) (switch-to-buffer (doom-fallback-buffer)) (mu4e~start 'mu4e~main-view) @@ -77,6 +79,10 @@ default/fallback account." (defun +mu4e-kill-mu4e-h () ;; (prolusion-mail-hide) - (when (and (featurep :ui 'workspaces) - (+workspace-exists-p +mu4e-workspace-name)) - (+workspace/delete +mu4e-workspace-name))) + (cond + ((and (featurep :ui 'workspaces) (+workspace-exists-p +mu4e-workspace-name)) + (+workspace/delete +mu4e-workspace-name)) + + (+mu4e--old-wconf + (set-window-configuration +mu4e--old-wconf) + (setq +mu4e--old-wconf nil))))