diff options
| author | Lars Magne Ingebrigtsen | 2011-06-29 22:21:29 +0200 |
|---|---|---|
| committer | Lars Magne Ingebrigtsen | 2011-06-29 22:21:29 +0200 |
| commit | 2f31f37ab7cf4a29f9b5fbe68b5f18cad7db00ba (patch) | |
| tree | 3c18e19c7cb600957846279da4b08eb050f32bcb | |
| parent | faf2a1741dfebf7446a37376e26aeb0533a3cac7 (diff) | |
| download | emacs-2f31f37ab7cf4a29f9b5fbe68b5f18cad7db00ba.tar.gz emacs-2f31f37ab7cf4a29f9b5fbe68b5f18cad7db00ba.zip | |
Add the new `sendmail-query-once' function to sendmail.el.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/mail/sendmail.el | 43 |
2 files changed, 48 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7ed6073339d..62fbf813ce2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-06-29 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * mail/sendmail.el (sendmail-query-once): New function. | ||
| 4 | (sendmail-query-once-function): New variable. | ||
| 5 | |||
| 1 | 2011-06-29 Glenn Morris <rgm@gnu.org> | 6 | 2011-06-29 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * files.el (auto-mode-alist): Add .f03, .f08 for f90-mode. | 8 | * files.el (auto-mode-alist): Add .f03, .f08 for f90-mode. |
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index c1405ec5ff3..13da0627fff 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el | |||
| @@ -164,6 +164,7 @@ that matches the variable `mail-header-separator'. | |||
| 164 | This is used by the default mail-sending commands. See also | 164 | This is used by the default mail-sending commands. See also |
| 165 | `message-send-mail-function' for use with the Message package." | 165 | `message-send-mail-function' for use with the Message package." |
| 166 | :type '(radio (function-item sendmail-send-it :tag "Use Sendmail package") | 166 | :type '(radio (function-item sendmail-send-it :tag "Use Sendmail package") |
| 167 | (function-item sendmail-query-once :tag "Query the user") | ||
| 167 | (function-item smtpmail-send-it :tag "Use SMTPmail package") | 168 | (function-item smtpmail-send-it :tag "Use SMTPmail package") |
| 168 | (function-item feedmail-send-it :tag "Use Feedmail package") | 169 | (function-item feedmail-send-it :tag "Use Feedmail package") |
| 169 | (function-item mailclient-send-it :tag "Use Mailclient package") | 170 | (function-item mailclient-send-it :tag "Use Mailclient package") |
| @@ -171,6 +172,48 @@ This is used by the default mail-sending commands. See also | |||
| 171 | :initialize 'custom-initialize-delay | 172 | :initialize 'custom-initialize-delay |
| 172 | :group 'sendmail) | 173 | :group 'sendmail) |
| 173 | 174 | ||
| 175 | (defvar sendmail-query-once-function 'query | ||
| 176 | "Either a function to send email, or the symbol `query'.") | ||
| 177 | |||
| 178 | (defun sendmail-query-once () | ||
| 179 | "Send an email via `sendmail-query-once-function'. | ||
| 180 | If `sendmail-query-once-function' is `query', ask the user what | ||
| 181 | function to use, and then save that choice." | ||
| 182 | (when (equal sendmail-query-once-function 'query) | ||
| 183 | (let ((default | ||
| 184 | (cond | ||
| 185 | ((or (and window-system (eq system-type 'darwin)) | ||
| 186 | (eq system-type 'windows-nt)) | ||
| 187 | 'mailclient-send-it) | ||
| 188 | ((and sendmail-program | ||
| 189 | (executable-find sendmail-program)) | ||
| 190 | 'sendmail-send-it)))) | ||
| 191 | (customize-save-variable | ||
| 192 | 'sendmail-query-once-function | ||
| 193 | (if (or (not default) | ||
| 194 | ;; We have detected no OS-level mail senders, or we | ||
| 195 | ;; have already configured smtpmail, so we use the | ||
| 196 | ;; internal SMTP service. | ||
| 197 | (and (boundp 'smtpmail-smtp-server) | ||
| 198 | smtpmail-smtp-server)) | ||
| 199 | 'smtpmail-send-it | ||
| 200 | ;; Query the user. | ||
| 201 | (unwind-protect | ||
| 202 | (progn | ||
| 203 | (pop-to-buffer "*Mail Help*") | ||
| 204 | (erase-buffer) | ||
| 205 | (insert "Sending mail from Emacs hasn't been set up yet.\n\n" | ||
| 206 | "Type `y' to configure outgoing SMTP, or `n' to use\n" | ||
| 207 | "the default mail sender on your system.\n\n" | ||
| 208 | "To change this again at a later date, customize the\n" | ||
| 209 | "`send-mail-function' variable.\n") | ||
| 210 | (goto-char (point-min)) | ||
| 211 | (if (y-or-n-p "Configure outgoing SMTP in Emacs? ") | ||
| 212 | 'smtpmail-send-it | ||
| 213 | default)) | ||
| 214 | (kill-buffer (current-buffer))))))) | ||
| 215 | (funcall sendmail-query-once-function)) | ||
| 216 | |||
| 174 | ;;;###autoload(custom-initialize-delay 'send-mail-function nil) | 217 | ;;;###autoload(custom-initialize-delay 'send-mail-function nil) |
| 175 | 218 | ||
| 176 | ;;;###autoload | 219 | ;;;###autoload |