This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+email/mu4e/funcs.el

37 lines
1.2 KiB
EmacsLisp
Raw Normal View History

2015-08-02 05:30:30 +00:00
;;; funcs.el --- mu4e Layer extensions File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun 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))
(helm-comp-read
"Compose with account:"
(mapcar (lambda (var) (car var)) mu4e-account-alist))))
(account-vars (cdr (assoc account mu4e-account-alist))))
(if account-vars
(mu4e//map-set account-vars)
(error "No email account found"))))
(defun mu4e//map-set (vars)
"Setq an alist VARS of variables and values."
(mapc (lambda (var) (set (car var) (cadr var)))
vars))
(defun mu4e/mail-account-reset ()
"Reset mail account info to first."
(mu4e//map-set (cdar mu4e-account-alist)))