Gnus development mailing list
 help / color / mirror / Atom feed
From: Wes Hardaker <wes@hardakers.net>
Cc: Michael Baer <baerm@tislabs.com>
Subject: message-send-mail-function, agent, and a day of work
Date: Thu, 15 Apr 2004 09:05:25 -0700	[thread overview]
Message-ID: <sd4qrl5ire.fsf@wes.hardakers.net> (raw)


I spent way too much time the other day figuring out why my simple
code to switch smtp servers was not working and all.  I was properly
setting every variable I could find documented, but the effect seemed
to be nothing.  The end result was because I was running with the
agent turned on, I was missing a variable that is not documented with
the rest of them (which makes some sense, as all the agents stuff is
in one place).

The problem is essentially this:

1) when you read about sending mail, the documentation says that the
   variable 'message-send-mail-function is consulted to figure out how
   to send mail.  This is what I was trying to modify.

2) However, the agent has his own variable for what to do when sending
   anything:  gnus-agent-send-mail-function.

The problem is twofold: first, there is no reference to the second
variable in least a warning in the documentation related to sending
mail.  Since the agent is turned on by default now, this will likely
confuse a lot of people.  Second, the second variable is independent
of the first.  This is part of the confusion.  I think the most simple
solution would be to make the second variable point to a different
function which checks the value of the first variable and uses that
at runtime.  By default they both point at the same value, however, if
the first one changes the second one never picks up that change in
value.

The gnus-agent-send-mail-function variable is set in gnus-agentize as
follows:

  (unless gnus-agent-send-mail-function
    (setq gnus-agent-send-mail-function
	  (or message-send-mail-real-function
	      message-send-mail-function)
	  message-send-mail-real-function 'gnus-agent-send-mail))

I'm suggesting this would be better:

  (defun gnus-agent-use-current-send-mail-function ()
         (funcall (or message-send-mail-real-function
                      message-send-mail-function)))

  (unless gnus-agent-send-mail-function
    (setq gnus-agent-send-mail-function
          'gnus-agent-use-current-send-mail-function))

This way dynamic changes to the message-send-mail-function are picked
up, but it still allows for customization of the agent specifically if
desired.

Thoughts?

-- 
"In the bathtub of history the truth is harder to hold than the soap,
 and much more difficult to find."  -- Terry Pratchett



             reply	other threads:[~2004-04-15 16:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-15 16:05 Wes Hardaker [this message]
2004-04-15 17:20 ` Kevin Greiner
2004-04-15 18:26   ` Wes Hardaker
2004-04-15 20:28     ` Kevin Greiner
2004-04-15 20:35       ` Wes Hardaker
2004-04-15 23:50         ` Kevin Greiner
2004-04-16  4:09           ` Wes Hardaker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sd4qrl5ire.fsf@wes.hardakers.net \
    --to=wes@hardakers.net \
    --cc=baerm@tislabs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).