aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-09-03 16:24:12 -0400
committerChong Yidong2011-09-03 16:24:12 -0400
commit2784c43403c278a542a9f930a4da07a4a2ca284c (patch)
tree3c0b78d7e34c53b89dcb6020c66140979a7cc3ce
parent464cdf568e3dd67373afa67c56dc763240eac083 (diff)
downloademacs-2784c43403c278a542a9f930a4da07a4a2ca284c.tar.gz
emacs-2784c43403c278a542a9f930a4da07a4a2ca284c.zip
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.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/mail/sendmail.el90
-rw-r--r--lisp/mail/smtpmail.el2
3 files changed, 54 insertions, 46 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3c27b51dfdf..c1d943ccaf0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12011-09-03 Chong Yidong <cyd@stupidchicken.com>
2
3 * mail/sendmail.el (sendmail-query-once-function): Deleted.
4 (sendmail-query-once): Save directly to send-mail-function.
5 Update message-send-mail-function too.
6
7 * mail/smtpmail.el (smtpmail-try-auth-methods): Clarify prompt.
8
12011-09-03 Christoph Scholtes <cschol2112@googlemail.com> 92011-09-03 Christoph Scholtes <cschol2112@googlemail.com>
2 10
3 * progmodes/python.el (python-mode-map): Use correct function to 11 * progmodes/python.el (python-mode-map): Use correct function to
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index 158435de86b..cb02a4b374d 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -156,51 +156,6 @@ This is used by the default mail-sending commands. See also
156 :version "24.1" 156 :version "24.1"
157 :group 'sendmail) 157 :group 'sendmail)
158 158
159(defvar sendmail-query-once-function 'query
160 "Either a function to send email, or the symbol `query'.")
161
162;;;###autoload
163(defun sendmail-query-once ()
164 "Send an email via `sendmail-query-once-function'.
165If `sendmail-query-once-function' is `query', ask the user what
166function to use, and then save that choice."
167 (when (equal sendmail-query-once-function 'query)
168 (let* ((mail-buffer (current-buffer))
169 (default
170 (cond
171 ((or (and window-system (eq system-type 'darwin))
172 (eq system-type 'windows-nt))
173 'mailclient-send-it)
174 ((and sendmail-program
175 (executable-find sendmail-program))
176 'sendmail-send-it)))
177 (function
178 (if (or (not default)
179 ;; We have detected no OS-level mail senders, or we
180 ;; have already configured smtpmail, so we use the
181 ;; internal SMTP service.
182 (and (boundp 'smtpmail-smtp-server)
183 smtpmail-smtp-server))
184 'smtpmail-send-it
185 ;; Query the user.
186 (unwind-protect
187 (progn
188 (pop-to-buffer "*Mail Help*")
189 (erase-buffer)
190 (insert "Sending mail from Emacs hasn't been set up yet.\n\n"
191 "Type `y' to configure outgoing SMTP, or `n' to use\n"
192 "the default mail sender on your system.\n\n"
193 "To change this again at a later date, customize the\n"
194 "`send-mail-function' variable.\n")
195 (goto-char (point-min))
196 (if (y-or-n-p "Configure outgoing SMTP in Emacs? ")
197 'smtpmail-send-it
198 default))
199 (kill-buffer (current-buffer))
200 (set-buffer mail-buffer)))))
201 (customize-save-variable 'sendmail-query-once-function function)))
202 (funcall sendmail-query-once-function))
203
204;;;###autoload 159;;;###autoload
205(defcustom mail-header-separator (purecopy "--text follows this line--") 160(defcustom mail-header-separator (purecopy "--text follows this line--")
206 "Line used to separate headers from text in messages being composed." 161 "Line used to separate headers from text in messages being composed."
@@ -543,6 +498,51 @@ by Emacs.)")
543 "Additional expressions to highlight in Mail mode.") 498 "Additional expressions to highlight in Mail mode.")
544 499
545 500
501;;;###autoload
502(defun sendmail-query-once ()
503 "Query for `send-mail-function' and send mail with it.
504This also saves the value of `send-mail-function' via Customize."
505 (let* ((mail-buffer (current-buffer))
506 ;; Compute default mail sender, preferring smtpmail if it's
507 ;; already configured.
508 (default (cond
509 ((and (boundp 'smtpmail-smtp-server)
510 smtpmail-smtp-server)
511 'smtpmail-send-it)
512 ((or (and window-system (eq system-type 'darwin))
513 (eq system-type 'windows-nt))
514 'mailclient-send-it)
515 ((and sendmail-program
516 (executable-find sendmail-program))
517 'sendmail-send-it)))
518 (send-function (if (eq default 'smtpmail-send-it)
519 'smtpmail-send-it)))
520 (unless send-function
521 ;; Query the user.
522 (with-temp-buffer
523 (rename-buffer "*Mail Help*" t)
524 (erase-buffer)
525 (insert "Emacs has not been set up for sending mail.\n
526Type `y' to configure and use Emacs as a mail client,
527or `n' to use your system's default mailer.\n
528To change your decision later, customize `send-mail-function'.\n")
529 (goto-char (point-min))
530 (display-buffer (current-buffer))
531 (if (y-or-n-p "Set up Emacs for sending SMTP mail? ")
532 ;; FIXME: We should check and correct the From: field too.
533 (setq send-function 'smtpmail-send-it)
534 (setq send-function default))))
535 (when send-function
536 (customize-save-variable 'send-mail-function send-function)
537 ;; HACK: Message mode stupidly has `message-send-mail-function',
538 ;; so we must update it too or sending again in the current
539 ;; Emacs session will still call `sendmail-query-once'.
540 (and (boundp 'message-send-mail-function)
541 (eq message-send-mail-function 'sendmail-query-once)
542 (customize-set-variable 'message-send-mail-function
543 send-function))
544 (funcall send-function))))
545
546(defun sendmail-sync-aliases () 546(defun sendmail-sync-aliases ()
547 (when mail-personal-alias-file 547 (when mail-personal-alias-file
548 (let ((modtime (nth 5 (file-attributes mail-personal-alias-file)))) 548 (let ((modtime (nth 5 (file-attributes mail-personal-alias-file))))
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 69c49c471c0..544570a1bc3 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -490,7 +490,7 @@ The list is in preference order.")
490 (let* ((mechs (cdr-safe (assoc 'auth supported-extensions))) 490 (let* ((mechs (cdr-safe (assoc 'auth supported-extensions)))
491 (mech (car (smtpmail-intersection mechs smtpmail-auth-supported))) 491 (mech (car (smtpmail-intersection mechs smtpmail-auth-supported)))
492 (auth-source-creation-prompts 492 (auth-source-creation-prompts
493 '((user . "SMTP user at %h: ") 493 '((user . "SMTP user name for %h: ")
494 (secret . "SMTP password for %u@%h: "))) 494 (secret . "SMTP password for %u@%h: ")))
495 (auth-info (car 495 (auth-info (car
496 (auth-source-search 496 (auth-source-search