From e20d4e3edb97b6c3719b9e4d1fe2d9795e06d178 Mon Sep 17 00:00:00 2001 From: Ravi R Kiran Date: Sun, 19 Oct 2014 15:25:47 -0700 Subject: Switch to existing mu4e window if possible diff --git a/ravi-init-mu.el b/ravi-init-mu.el index 3a2de1a..1477629 100644 --- a/ravi-init-mu.el +++ b/ravi-init-mu.el @@ -36,11 +36,23 @@ (when ravi/use-mu-for-email (use-package mu4e :load-path ,(ravi/emacs-file "site-lisp/mu/mu4e") - :bind (("C-'" . mu4e)) + :commands mu4e :init (progn (add-to-list 'Info-additional-directory-list (ravi/emacs-file "site-lisp/mu/mu4e")) - (unless ravi/mu4e-account-alist (error "Email account list not found"))) + (unless ravi/mu4e-account-alist (error "Email account list not found")) + (defun ravi/switch-to-mu4e () + (interactive) + (let ((buf (or (and (boundp 'mu4e~headers-buffer-name) + (get-buffer mu4e~headers-buffer-name)) + (get-buffer "*mu4e-main*")))) + (if buf + (if (get-buffer-window buf t) + (select-window (get-buffer-window buf t)) + (switch-to-buffer buf)) + (mu4e)))) + (bind-key "C-'" 'ravi/switch-to-mu4e) + ) :config (progn -- cgit v0.10.1