Mu4e: try to be pick a good account to send from
This commit is contained in:
parent
c73e903c0d
commit
e3a926946e
1 changed files with 20 additions and 0 deletions
|
@ -287,6 +287,26 @@ is tomorrow. With two prefixes, select the deadline."
|
||||||
:v "u" #'mu4e-headers-mark-for-unmark
|
:v "u" #'mu4e-headers-mark-for-unmark
|
||||||
:vn "l" #'mu4e-msg-to-agenda))
|
:vn "l" #'mu4e-msg-to-agenda))
|
||||||
|
|
||||||
|
;;----------------
|
||||||
|
;; Sending mail
|
||||||
|
;;----------------
|
||||||
|
|
||||||
|
(defun my-mu4e-set-account ()
|
||||||
|
"Set the account for composing a message. If a 'To' header is present,
|
||||||
|
and correspands to an email account, this account will be selected.
|
||||||
|
Otherwise, the user is prompted for the accound they wish to use."
|
||||||
|
(unless (and mu4e-compose-parent-message
|
||||||
|
(let ((to (cdr (car (mu4e-message-field mu4e-compose-parent-message :to))))
|
||||||
|
(from (cdr (car (mu4e-message-field mu4e-compose-parent-message :from)))))
|
||||||
|
(if (member to (plist-get mu4e~server-props :personal-addresses))
|
||||||
|
(setq user-mail-address to)
|
||||||
|
(if (member from (plist-get mu4e~server-props :personal-addresses))
|
||||||
|
(setq user-mail-address from)
|
||||||
|
nil))))
|
||||||
|
(ivy-read "Account: " (plist-get mu4e~server-props :personal-addresses) :action (lambda (candidate) (setq user-mail-address candidate)))))
|
||||||
|
|
||||||
|
(add-hook 'mu4e-compose-pre-hook 'my-mu4e-set-account)
|
||||||
|
|
||||||
;;----------------
|
;;----------------
|
||||||
;; Prettifying mu4e:main
|
;; Prettifying mu4e:main
|
||||||
;;----------------
|
;;----------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue