diff options
| author | Lars Ingebrigtsen | 2018-04-15 20:42:44 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2018-04-15 20:42:44 +0200 |
| commit | b72de45eb00b6a1c35a3d11914fb862ebb30034a (patch) | |
| tree | 40c116e1f8a3f2bca4ec2a23571ce3ac39275a0a | |
| parent | 54f7ec01c336d315c3b9e69c60ef18100840dd54 (diff) | |
| download | emacs-b72de45eb00b6a1c35a3d11914fb862ebb30034a.tar.gz emacs-b72de45eb00b6a1c35a3d11914fb862ebb30034a.zip | |
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.
| -rw-r--r-- | lisp/mail/sendmail.el | 14 |
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." | |||
| 505 | ;; If send-mail-function is already setup, we're incorrectly called | 505 | ;; If send-mail-function is already setup, we're incorrectly called |
| 506 | ;; a second time, probably because someone's using an old value | 506 | ;; a second time, probably because someone's using an old value |
| 507 | ;; of send-mail-function. | 507 | ;; of send-mail-function. |
| 508 | (when (eq send-mail-function 'sendmail-query-once) | 508 | (if (not (eq send-mail-function 'sendmail-query-once)) |
| 509 | (sendmail-query-user-about-smtp)) | 509 | (funcall send-mail-function) |
| 510 | (funcall send-mail-function)) | 510 | (let ((function (sendmail-query-user-about-smtp))) |
| 511 | (funcall function) | ||
| 512 | (when (y-or-n-p "Save this mail sending choice?") | ||
| 513 | (setq send-mail-function function) | ||
| 514 | (customize-save-variable 'send-mail-function function))))) | ||
| 511 | 515 | ||
| 512 | (defun sendmail-query-user-about-smtp () | 516 | (defun sendmail-query-user-about-smtp () |
| 513 | (let* ((options `(("mail client" . mailclient-send-it) | 517 | (let* ((options `(("mail client" . mailclient-send-it) |
| @@ -552,8 +556,8 @@ This also saves the value of `send-mail-function' via Customize." | |||
| 552 | (completing-read | 556 | (completing-read |
| 553 | (format "Send mail via (default %s): " (caar options)) | 557 | (format "Send mail via (default %s): " (caar options)) |
| 554 | options nil 'require-match nil nil (car options)))))) | 558 | options nil 'require-match nil nil (car options)))))) |
| 555 | (customize-save-variable 'send-mail-function | 559 | ;; Return the choice. |
| 556 | (cdr (assoc-string choice options t))))) | 560 | (cdr (assoc-string choice options t)))) |
| 557 | 561 | ||
| 558 | (defun sendmail-sync-aliases () | 562 | (defun sendmail-sync-aliases () |
| 559 | (when mail-personal-alias-file | 563 | (when mail-personal-alias-file |