summaryrefslogtreecommitdiff
path: root/lisp/mail/sendmail.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2018-04-15 20:42:44 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2018-04-15 20:42:44 +0200
commitb72de45eb00b6a1c35a3d11914fb862ebb30034a (patch)
tree40c116e1f8a3f2bca4ec2a23571ce3ac39275a0a /lisp/mail/sendmail.el
parent54f7ec01c336d315c3b9e69c60ef18100840dd54 (diff)
downloademacs-b72de45eb00b6a1c35a3d11914fb862ebb30034a.tar.gz
Only save the mailer choice after sending the mail
* lisp/mail/sendmail.el (sendmail-query-once): Only save the mailer choice after we've sent the mail, so that if that fails, the user has an easy way to back out of the choice and make another (bug#14487). (sendmail-query-user-about-smtp): Return the choice; don't save it.
Diffstat (limited to 'lisp/mail/sendmail.el')
-rw-r--r--lisp/mail/sendmail.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index cfbefd91d93..c9f8fec1e1b 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -505,9 +505,13 @@ This also saves the value of `send-mail-function' via Customize."
;; If send-mail-function is already setup, we're incorrectly called
;; a second time, probably because someone's using an old value
;; of send-mail-function.
- (when (eq send-mail-function 'sendmail-query-once)
- (sendmail-query-user-about-smtp))
- (funcall send-mail-function))
+ (if (not (eq send-mail-function 'sendmail-query-once))
+ (funcall send-mail-function)
+ (let ((function (sendmail-query-user-about-smtp)))
+ (funcall function)
+ (when (y-or-n-p "Save this mail sending choice?")
+ (setq send-mail-function function)
+ (customize-save-variable 'send-mail-function function)))))
(defun sendmail-query-user-about-smtp ()
(let* ((options `(("mail client" . mailclient-send-it)
@@ -552,8 +556,8 @@ This also saves the value of `send-mail-function' via Customize."
(completing-read
(format "Send mail via (default %s): " (caar options))
options nil 'require-match nil nil (car options))))))
- (customize-save-variable 'send-mail-function
- (cdr (assoc-string choice options t)))))
+ ;; Return the choice.
+ (cdr (assoc-string choice options t))))
(defun sendmail-sync-aliases ()
(when mail-personal-alias-file