[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnus / message-send-mail-with-mailclient [patch]

From: Reiner Steib
Subject: Re: gnus / message-send-mail-with-mailclient [patch]
Date: Thu, 16 Mar 2006 22:27:43 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

On Thu, Feb 09 2006, David Reitter wrote:

> The send-mail-function defined specifically for the message package  
> doesn't work on systems where no sendmail is running.
> That's why we added the `mailclient' package a while ago.

`message.el' is supposed to work with Emacs 21 as well.  Do you know
whether `mailclient.el' works with Emacs 21?

> The patch below fixes the problem analogous to what has been done in
> the `sendmail' package.

Your patch contains several unrelated changes (make-frame-visible),
wrapped lines and mixed context/unified hunks which makes is hard to
read and to apply.

How about the attached patch.  It includes some additional checks
(partly taken from `message.el' in the development version of Gnus).

I'm not sure (and I can't test) if
  (custom-reevaluate-setting 'message-send-mail-function)
in `startup.el' is necessary.

Bye, Reiner.

Index: message.el
RCS file: /cvsroot/emacs/emacs/lisp/gnus/message.el,v
retrieving revision 1.102
diff -u -r1.102 message.el
--- message.el  24 Feb 2006 05:02:12 -0000      1.102
+++ message.el  16 Mar 2006 21:09:33 -0000
@@ -48,6 +48,7 @@
 (require 'mml)
 (require 'rfc822)
+  (autoload 'mailclient-send-it "mailclient") ;; Emacs 22 or contrib/
   (autoload 'gnus-find-method-for-group "gnus")
   (autoload 'nnvirtual-find-group-art "nnvirtual")
   (autoload 'gnus-group-decoded-name "gnus-group"))
@@ -584,16 +585,37 @@
   :link '(custom-manual "(message)Canceling News")
   :type 'string)
+(defun message-send-mail-function ()
+  "Return suitable value for the variable `message-send-mail-function'."
+  (cond ((and sendmail-program
+             (executable-find program))
+        'message-send-mail-with-sendmail)
+       ((and (locate-library "mailclient")
+             window-system
+             (memq system-type '(darwin windows-nt)))
+        'message-send-mail-with-mailclient)
+       (t
+        'message-smtpmail-send-it)))
+;; Prevent problems with `window-system' not having the correct value
+;; when loaddefs.el is loaded. `custom-reevaluate-setting' needs the
+;; standard value.
+(put 'message-send-mail-function 'standard-value
+     '((message-send-mail-function)))
 ;; Useful to set in site-init.el
-(defcustom message-send-mail-function 'message-send-mail-with-sendmail
+(defcustom message-send-mail-function (message-send-mail-function)
   "Function to call to send the current buffer as mail.
 The headers should be delimited by a line whose contents match the
 variable `mail-header-separator'.
-Valid values include `message-send-mail-with-sendmail' (the default),
+Valid values include `message-send-mail-with-sendmail',
 `message-send-mail-with-mh', `message-send-mail-with-qmail',
-`message-smtpmail-send-it', `smtpmail-send-it' and `feedmail-send-it'.
+`message-smtpmail-send-it', `smtpmail-send-it',
+`feedmail-send-it' and `message-send-mail-with-mailclient'.  The
+default is system dependent.
 See also `send-mail-function'."
   :type '(radio (function-item message-send-mail-with-sendmail)
@@ -602,8 +624,11 @@
                (function-item message-smtpmail-send-it)
                (function-item smtpmail-send-it)
                (function-item feedmail-send-it)
+               (function-item message-send-mail-with-mailclient
+                              :tag "Use Mailclient package")
                (function :tag "Other"))
   :group 'message-sending
+  :initialize 'custom-initialize-default
   :link '(custom-manual "(message)Mail Variables")
   :group 'message-mail)
@@ -3982,6 +4007,13 @@
   (run-hooks 'message-send-mail-hook)
+(defun message-send-mail-with-mailclient ()
+  "Send the prepared message buffer with `mailclient-send-it'.
+This only differs from `smtpmail-send-it' that this command evaluates
+`message-send-mail-hook' just before sending a message."
+  (run-hooks 'message-send-mail-hook)
+  (mailclient-send-it))
 (defun message-canlock-generate ()
   "Return a string that is non-trivial to guess.
 Do not use this for anything important, it is cryptographically weak."

reply via email to

[Prev in Thread] Current Thread [Next in Thread]