From 6291cb1979b49ede8c220885ffef567412e0f2fb Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 18 Feb 2018 03:09:39 -0500 Subject: [PATCH] app/email: improve mu4e lifetime management & fix =email --- modules/app/email/autoload/email.el | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/modules/app/email/autoload/email.el b/modules/app/email/autoload/email.el index 284792762..49a51727a 100644 --- a/modules/app/email/autoload/email.el +++ b/modules/app/email/autoload/email.el @@ -1,10 +1,19 @@ ;;; app/email/autoload/email.el -*- lexical-binding: t; -*- +(defvar +email-workspace-name "*mu4e*" + "TODO") + +(add-hook 'mu4e-main-mode-hook #'+email|init) + ;;;###autoload (defun =email () "Start email client." (interactive) - (call-interactively #'mu4e)) + (+workspace-switch +email-workspace-name t) + (mu4e~start 'mu4e~main-view) + ;; (save-selected-window + ;; (prolusion-mail-show)) + ) ;;;###autoload (defun +email/compose () @@ -13,3 +22,16 @@ ;; TODO Interactively select email account (call-interactively #'mu4e-compose-new)) + +;; +;; Hooks +;; + +(defun +email|init () + (add-hook 'kill-buffer-hook #'+email|kill-mu4e nil t)) + +(defun +email|kill-mu4e () + ;; (prolusion-mail-hide) + (when (+workspace-exists-p +email-workspace-name) + (+workspace/delete +email-workspace-name))) +