commit 35b59b202d15bf7e11305a36b84927b3baed6d5c parent 2317bccbe58a507b019f12312f2fb34f003af0f3 Author: Anders Damsgaard <anders.damsgaard@geo.au.dk> Date: Thu, 1 May 2014 21:10:17 +0200 Merge branch 'master' of github.com:anders-dc/dotfiles Diffstat:
M | .emacs.d/init.el | | | 20 | ++++++++++++++++++++ |
1 file changed, 20 insertions(+), 0 deletions(-)
diff --git a/.emacs.d/init.el b/.emacs.d/init.el @@ -271,6 +271,26 @@ org-beamer-sectioning)) ;; allow for updating mail using 'U' in the main view: (setq mu4e-get-mail-command "offlineimap") +; Set the account for composing a message +(defun my-mu4e-set-account () + "Set the account for composing a message." + (let* ((account + (if mu4e-compose-parent-message + (let ((maildir (mu4e-message-field mu4e-compose-parent-message :maildir))) + (string-match "/\\(.*?\\)/" maildir) + (match-string 1 maildir)) + (completing-read (format "Compose with account: (%s) " + (mapconcat #'(lambda (var) (car var)) my-mu4e-account-alist "/")) + (mapcar #'(lambda (var) (car var)) my-mu4e-account-alist) + nil t nil nil (caar my-mu4e-account-alist)))) + (account-vars (cdr (assoc account my-mu4e-account-alist)))) + (if account-vars + (mapc #'(lambda (var) + (set (car var) (cadr var))) + account-vars) + (error "No email account found")))) +(add-hook 'mu4e-compose-pre-hook 'my-mu4e-set-account) + ;; enable inline images (setq mu4e-view-show-images t) ;; use imagemagick, if available