diff options
author | Lars Magne Ingebrigtsen <larsi@gnus.org> | 2011-07-08 09:42:21 +0200 |
---|---|---|
committer | Lars Magne Ingebrigtsen <larsi@gnus.org> | 2011-07-08 09:42:21 +0200 |
commit | d760b73104d0533a222adb058f48da3e4ca61f3f (patch) | |
tree | 60023af6e5de887b55f1ddbf899396599fbb7c1f /lisp/mail/smtpmail.el | |
parent | 47588180c91d0f150a5baa73c0461ebaa5f1b5ce (diff) | |
download | emacs-d760b73104d0533a222adb058f48da3e4ca61f3f.tar.gz |
Allow sending mail in "emacs -Q" by not calling customize-save-variable
* mail/smtpmail.el (smtpmail-query-smtp-server): Ditto.
* mail/sendmail.el (sendmail-query-once): If we aren't allowed to
save customizations (with "emacs -Q"), just set the variable
instead of erroring out.
Diffstat (limited to 'lisp/mail/smtpmail.el')
-rw-r--r-- | lisp/mail/smtpmail.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index 073e2fa4a3c..57356f3315b 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -587,6 +587,8 @@ The list is in preference order.") (defun smtpmail-response-text (response) (mapconcat 'identity (cdr response) "\n")) +(autoload 'custom-file "cus-edit") + (defun smtpmail-query-smtp-server () (let ((server (read-string "Outgoing SMTP mail server: ")) (ports '(587 "smtp")) @@ -598,8 +600,12 @@ The list is in preference order.") (setq port (pop ports))) (when (setq stream (ignore-errors (open-network-stream "smtp" nil server port))) - (customize-save-variable 'smtpmail-smtp-server server) - (customize-save-variable 'smtpmail-smtp-service port) + (if (ignore-errors (custom-file)) + (progn + (customize-save-variable 'smtpmail-smtp-server server) + (customize-save-variable 'smtpmail-smtp-service port)) + (setq smtpmail-smtp-server server + smtpmail-smtp-service port)) (delete-process stream))) (unless smtpmail-smtp-server (error "Couldn't contact an SMTP server")))) |