email/mu4e: restore window config when mu4e quit

- see https://github.com/hlissner/doom-emacs/pull/2123#issuecomment-560010891
This commit is contained in:
Yiming Chen 2019-12-01 09:30:33 +08:00
parent 4126d3be81
commit a7eef56b9d

View file

@ -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))))