[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing the default for `send-mail-function'
From: |
Lars Magne Ingebrigtsen |
Subject: |
Re: Changing the default for `send-mail-function' |
Date: |
Tue, 28 Jun 2011 20:47:32 +0200 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) |
I've now implemented the query-the-user-and-then-save-the-default
idea.
The default of `send-mail-function' changes to `sendmail-query-once',
which will query and then save and set the
`sendmail-query-once-function' variable via customize.
=== modified file 'lisp/mail/sendmail.el'
*** lisp/mail/sendmail.el 2011-06-22 23:39:29 +0000
--- lisp/mail/sendmail.el 2011-06-28 18:45:08 +0000
***************
*** 142,162 ****
;; when loaddefs.el is loaded. `custom-reevaluate-setting' needs the
;; standard value.
;;;###autoload
! (put 'send-mail-function 'standard-value
! ;; MS-Windows can access the clipboard even under -nw.
! '((if (or (and window-system (eq system-type 'darwin))
! (eq system-type 'windows-nt))
! 'mailclient-send-it
! 'sendmail-send-it)))
;; Useful to set in site-init.el
;;;###autoload
! (defcustom send-mail-function
! (if (or (and window-system (eq system-type 'darwin))
! ;; MS-Windows can access the clipboard even under -nw.
! (eq system-type 'windows-nt))
! 'mailclient-send-it
! 'sendmail-send-it)
"Function to call to send the current buffer as mail.
The headers should be delimited by a line which is
not a valid RFC822 header or continuation line,
--- 142,152 ----
;; when loaddefs.el is loaded. `custom-reevaluate-setting' needs the
;; standard value.
;;;###autoload
! (put 'send-mail-function 'standard-value 'sendmail-query-once)
;; Useful to set in site-init.el
;;;###autoload
! (defcustom send-mail-function 'sendmail-query-once
"Function to call to send the current buffer as mail.
The headers should be delimited by a line which is
not a valid RFC822 header or continuation line,
***************
*** 164,169 ****
--- 154,160 ----
This is used by the default mail-sending commands. See also
`message-send-mail-function' for use with the Message package."
:type '(radio (function-item sendmail-send-it :tag "Use Sendmail package")
+ (function-item sendmail-query-once :tag "Query the user")
(function-item smtpmail-send-it :tag "Use SMTPmail package")
(function-item feedmail-send-it :tag "Use Feedmail package")
(function-item mailclient-send-it :tag "Use Mailclient package")
***************
*** 171,176 ****
--- 162,206 ----
:initialize 'custom-initialize-delay
:group 'sendmail)
+ (defvar sendmail-query-once-function 'query
+ "Either a function to send email, or the symbol `query'.")
+
+ (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 ((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))))
+ (customize-save-variable
+ 'sendmail-query-once-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.
+ 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")
+ (goto-char (point-min))
+ (if (y-or-n-p "Configure outgoing SMTP in Emacs? ")
+ 'smtpmail-send-it
+ default))
+ (kill-buffer (current-buffer)))))))
+ (funcall sendmail-query-once-function))
+
;;;###autoload(custom-initialize-delay 'send-mail-function nil)
;;;###autoload
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
- Re: Changing the default for `send-mail-function', (continued)
- Re: Changing the default for `send-mail-function', Christoph Scholtes, 2011/06/27
- Re: Changing the default for `send-mail-function', Eli Zaretskii, 2011/06/27
- Re: Changing the default for `send-mail-function', Bill Wohler, 2011/06/27
- Re: Changing the default for `send-mail-function', Eli Zaretskii, 2011/06/28
- Re: Changing the default for `send-mail-function', Lars Magne Ingebrigtsen, 2011/06/28
- Re: Changing the default for `send-mail-function', Eli Zaretskii, 2011/06/28
- Re: Changing the default for `send-mail-function',
Lars Magne Ingebrigtsen <=
- Re: Changing the default for `send-mail-function', Lars Magne Ingebrigtsen, 2011/06/29
- Re: Changing the default for `send-mail-function', Bill Wohler, 2011/06/28
- Re: Changing the default for `send-mail-function', Lars Magne Ingebrigtsen, 2011/06/26
- Re: Changing the default for `send-mail-function', David De La Harpe Golden, 2011/06/26
- Re: Changing the default for `send-mail-function', Lars Magne Ingebrigtsen, 2011/06/26
- Re: Changing the default for `send-mail-function', David De La Harpe Golden, 2011/06/26
- Re: Changing the default for `send-mail-function', Lars Magne Ingebrigtsen, 2011/06/26
- Re: Changing the default for `send-mail-function', David De La Harpe Golden, 2011/06/26
- Re: Changing the default for `send-mail-function', Lars Magne Ingebrigtsen, 2011/06/26
- Re: Changing the default for `send-mail-function', David De La Harpe Golden, 2011/06/26