Merge pull request #2123 from dsdshcym/fix-mu4e-when-workspace-module-is-not-enabled

email/mu4e: add featurep check for workspaces
This commit is contained in:
Henrik Lissner 2019-12-08 01:02:01 -05:00 committed by GitHub
commit 385ff35ad8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,6 +44,7 @@ default/fallback account."
(defvar +mu4e-workspace-name "*mu4e*" (defvar +mu4e-workspace-name "*mu4e*"
"TODO") "TODO")
(defvar +mu4e--old-wconf nil)
(add-hook 'mu4e-main-mode-hook #'+mu4e-init-h) (add-hook 'mu4e-main-mode-hook #'+mu4e-init-h)
@ -52,7 +53,11 @@ default/fallback account."
"Start email client." "Start email client."
(interactive) (interactive)
(require 'mu4e) (require 'mu4e)
(+workspace-switch +mu4e-workspace-name t) (if (featurep :ui 'workspaces)
(+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) (mu4e~start 'mu4e~main-view)
;; (save-selected-window ;; (save-selected-window
;; (prolusion-mail-show)) ;; (prolusion-mail-show))
@ -74,5 +79,10 @@ default/fallback account."
(defun +mu4e-kill-mu4e-h () (defun +mu4e-kill-mu4e-h ()
;; (prolusion-mail-hide) ;; (prolusion-mail-hide)
(when (+workspace-exists-p +mu4e-workspace-name) (cond
(+workspace/delete +mu4e-workspace-name))) ((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))))