On Fri, Aug 07, 2009 at 07:21:22AM -0500, Kyle Wheeler wrote:
> On Friday, August  7 at 08:09 PM, quoth Erik Christiansen:
> Hmmm. I think there must be a misunderstanding between us somewhere 
> here. If you're happy, that's great, and nevermind the rest. But 
> unless I misunderstand how mutt works, this:
> 
> > Defaulting to a reply to self, each list can then instead be covered 
> > with e.g.:
> >
> > send-hook '~C [email protected]' 'my_hdr  Reply-To: [email protected]'
> 
> ...should only work for the *second* message sent to 
> [email protected].

Well, I've gone back for the third time, to check what happens on
compose (m), and list reply (L). In my now disused cross-gcc mailbox,
with no send-hook and no "Reply-To:" in the test email, both cases follow
the default:

send-hook .    'my_hdr  Reply-To: [email protected]'

Doing it on this email doesn't prove anything, because there's a list
Reply-To: on your mail, but there's none for this lot:

send-hook '~C [email protected]' 'my_hdr  Reply-To: 
[email protected]'

In the mailbox for that list, m sets Reply-To: to me, and L sets it to
the list. That is already visible in vim. It seems to work repeatably.

Just in case I suffer a Wile E. Coyote moment and it stops working once
you convince me it can't, what about this manual text?:

"reply-hook is matched against the message you are replying to, instead
of the message you are sending. send-hook is matched against all
messages, both new and replies."

During list reply, is the send-hook just acting as a reply hook,
triggering on the message to which I'm replying? Then it's only the
coincidence that a list post must have a list recipient which makes it
overlap my address trigger, intended to be satisfied by my reply. Yuck. 

> The reason is because my_hdr doesn't modify a message that's already 
> been built, but instead merely modifies mutt's internal message 
> template. Thus, if my_hdr is called after mutt builds a message (i.e. 
> at a point where ~C has something to match against), it won't affect 
> that message. But having modified the internal template, WILL affect 
> the next message, no matter who it is sent to.

I have used nothing but mutt for mail for about a decade now, but
there must be something major that I do not grok, because that
behaviour seems so deeply flawed as to be dangerous. The reasons are:

   a) A send-hook (compose-hook) triggerable only by a random prior
      message can be expected to have a random impact on the composed
      message.

   b) A send-hook (compose-hook), even if it were triggered on the
      current message, is a boobytrap if its effect lasts beyond the
      current message. e.g if a list Reply-To: remains in effect for a
      following private message, much dignity, or even employment could
      be lost. OK, the default allows us to fix that.

Maybe one day I'll be able to imagine a use for such remote and
disconnected triggering, or even a reason for doing it that way, but
both elude me still.

It shouldn't take too much effort for me to write an awk post-edit
filter, to modify received and composed headers, using list addresses or
even aliases and groups internalised in awk as associative arrays. The
current-message-triggers can be kept in .muttrc, disguised as comments.

> Yes, send2-hook would be the way to go *IF* my_hdr affected the 
> message currently being edited. But it doesn't, so send2-hook won't 
> work.

I still don't understand why mutt developers would want to set the
Reply-To: header of a new message, based on the last one sent, perhaps
yesterday, with triggerings that the user is now unaware of.

> > In the case of "Reply-To:", it finally dawned on me that it's easier to 
> > match one List-Post address than a large set of non-list addresses. 
> > Turning off my folder-hooks was then the biggest step forward.
> 
> The way this is usually done is something like this:
> 
>      ## First, set the default:
>      folder-hook . 'my_hdr Reply-To: [email protected]'
>      ## Or, an alternative default:
>      # folder-hook . 'unmy_hdr Reply-To'
>      ## Now, set the header when I enter a list mailbox:
>      folder-hook =Listbox 'my_hdr Reply-To: [email protected]'

That is what I had been doing for the last few years, but it is also
dangerous. If I compose a private message while in the mailbox, it will
bear a list Reply-To: header. A reply by the off-list recipient will go
back to the list. A better method is required.

> Note that the ORDER OF HOOKS is important, because mutt triggers them 
> in the order they're found. Thus, when entering a non-list mailbox, no 
> matter what it is, it will match the first ("default") hook, and will 
> get the [email protected] header. The non-list mailbox won't match the 
> second hook, so the previous header will remain. Upon entering 
> "Listbox", however, the first hook will match again, and will reset 
> the Reply-To header, but immediately after that, the second hook will 
> match, and will change that header to [email protected]. Moving to 
> another mailbox will, again, trigger the first hook, which will reset 
> the Reply-To header, but won't trigger the second hook. If you need to 
> add additional mailing list mailboxes, add those hooks AFTER the 
> default hook.
> 
> Does that make sense?

Yes, many thanks for the explanation. That's what I probably cribbed
from the list some years back. But users always want more. :-)

> Hopefully my explanation of folder-hooks above helps?

It helps my understanding. It can't make me more comfortable with
my send-hook working by accident. So I may just have to lash a little awk
together, to provide compose-hooks which can be triggered by the
composed message, not just unrelated past events.

Erik

Reply via email to