Commit 2784c434 authored by Chong Yidong's avatar Chong Yidong

Make sendmail-query-once update send-mail-function directly.

* mail/sendmail.el (sendmail-query-once-function): Deleted.
(sendmail-query-once): Save directly to send-mail-function.
Update message-send-mail-function too.

* mail/smtpmail.el (smtpmail-try-auth-methods): Clarify prompt.
parent 464cdf56
2011-09-03 Chong Yidong <cyd@stupidchicken.com>
* mail/sendmail.el (sendmail-query-once-function): Deleted.
(sendmail-query-once): Save directly to send-mail-function.
Update message-send-mail-function too.
* mail/smtpmail.el (smtpmail-try-auth-methods): Clarify prompt.
2011-09-03 Christoph Scholtes <cschol2112@googlemail.com>
* progmodes/python.el (python-mode-map): Use correct function to
......
......@@ -156,51 +156,6 @@ This is used by the default mail-sending commands. See also
:version "24.1"
:group 'sendmail)
(defvar sendmail-query-once-function 'query
"Either a function to send email, or the symbol `query'.")
;;;###autoload
(defun sendmail-query-once ()
"Send an email via `sendmail-query-once-function'.
If `sendmail-query-once-function' is `query', ask the user what
function to use, and then save that choice."
(when (equal sendmail-query-once-function 'query)
(let* ((mail-buffer (current-buffer))
(default
(cond
((or (and window-system (eq system-type 'darwin))
(eq system-type 'windows-nt))
'mailclient-send-it)
((and sendmail-program
(executable-find sendmail-program))
'sendmail-send-it)))
(function
(if (or (not default)
;; We have detected no OS-level mail senders, or we
;; have already configured smtpmail, so we use the
;; internal SMTP service.
(and (boundp 'smtpmail-smtp-server)
smtpmail-smtp-server))
'smtpmail-send-it
;; Query the user.
(unwind-protect
(progn
(pop-to-buffer "*Mail Help*")
(erase-buffer)
(insert "Sending mail from Emacs hasn't been set up yet.\n\n"
"Type `y' to configure outgoing SMTP, or `n' to use\n"
"the default mail sender on your system.\n\n"
"To change this again at a later date, customize the\n"
"`send-mail-function' variable.\n")
(goto-char (point-min))
(if (y-or-n-p "Configure outgoing SMTP in Emacs? ")
'smtpmail-send-it
default))
(kill-buffer (current-buffer))
(set-buffer mail-buffer)))))
(customize-save-variable 'sendmail-query-once-function function)))
(funcall sendmail-query-once-function))
;;;###autoload
(defcustom mail-header-separator (purecopy "--text follows this line--")
"Line used to separate headers from text in messages being composed."
......@@ -543,6 +498,51 @@ by Emacs.)")
"Additional expressions to highlight in Mail mode.")
;;;###autoload
(defun sendmail-query-once ()
"Query for `send-mail-function' and send mail with it.
This also saves the value of `send-mail-function' via Customize."
(let* ((mail-buffer (current-buffer))
;; Compute default mail sender, preferring smtpmail if it's
;; already configured.
(default (cond
((and (boundp 'smtpmail-smtp-server)
smtpmail-smtp-server)
'smtpmail-send-it)
((or (and window-system (eq system-type 'darwin))
(eq system-type 'windows-nt))
'mailclient-send-it)
((and sendmail-program
(executable-find sendmail-program))
'sendmail-send-it)))
(send-function (if (eq default 'smtpmail-send-it)
'smtpmail-send-it)))
(unless send-function
;; Query the user.
(with-temp-buffer
(rename-buffer "*Mail Help*" t)
(erase-buffer)
(insert "Emacs has not been set up for sending mail.\n
Type `y' to configure and use Emacs as a mail client,
or `n' to use your system's default mailer.\n
To change your decision later, customize `send-mail-function'.\n")
(goto-char (point-min))
(display-buffer (current-buffer))
(if (y-or-n-p "Set up Emacs for sending SMTP mail? ")
;; FIXME: We should check and correct the From: field too.
(setq send-function 'smtpmail-send-it)
(setq send-function default))))
(when send-function
(customize-save-variable 'send-mail-function send-function)
;; HACK: Message mode stupidly has `message-send-mail-function',
;; so we must update it too or sending again in the current
;; Emacs session will still call `sendmail-query-once'.
(and (boundp 'message-send-mail-function)
(eq message-send-mail-function 'sendmail-query-once)
(customize-set-variable 'message-send-mail-function
send-function))
(funcall send-function))))
(defun sendmail-sync-aliases ()
(when mail-personal-alias-file
(let ((modtime (nth 5 (file-attributes mail-personal-alias-file))))
......
......@@ -490,7 +490,7 @@ The list is in preference order.")
(let* ((mechs (cdr-safe (assoc 'auth supported-extensions)))
(mech (car (smtpmail-intersection mechs smtpmail-auth-supported)))
(auth-source-creation-prompts
'((user . "SMTP user at %h: ")
'((user . "SMTP user name for %h: ")
(secret . "SMTP password for %u@%h: ")))
(auth-info (car
(auth-source-search
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment