emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master b72de45 3/3: Only save the mailer choice after send


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master b72de45 3/3: Only save the mailer choice after sending the mail
Date: Sun, 15 Apr 2018 14:43:03 -0400 (EDT)

branch: master
commit b72de45eb00b6a1c35a3d11914fb862ebb30034a
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    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.
---
 lisp/mail/sendmail.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index cfbefd9..c9f8fec 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]