<<< Date Index >>>     <<< Thread Index >>>

Re: send-hook not setting $from



On Fri, Dec 05, 2003 at 07:28:11AM -0500, David Yitzchak Cohen wrote:
: On Thu, Dec 04, 2003 at 07:07:29PM -0600, Eugene Lee wrote:
: > On Thu, Dec 04, 2003 at 03:50:48PM +0100, Michael Tatge wrote:
: > : * On Thu, Dec 04, 2003 Eugene Lee (list-mutt@xxxxxxxx) muttered:
: > : >
: > : >         send-hook . 'set from=me@xxxxxxxxxx'
: > : >         send-hook '~C abuse@xxxxxxx' 'set from=me+aol@xxxxxxxxxx'
: > : 
: > :                                       use my_hdr
: > : 
: > :   set from = me@xxxxxxxxxx
: > :         send-hook . 'unmy_hdr from'
: > :   send-hook '~C abuse@xxxxxxx' 'my_hdr From: me+aol@xxxxxxxxxx'
: > 
: > Michael (and Noir), thanks for your comments.  I know that my_hdr works.
: > But I don't understand why "set $from" does not work in a send-hook.
: 
: In plain English, changing $from in a send-hook has no effect on the
: message being composed because Mutt has already set your From: header
: before it executes the send-hook (based on what $from was then - i.e.,
: before your hook was called).

This behavior is not explained in the normal HTML documentation.

: my_hdr works because it simply replaces
: any existing header by the same name - in this case, the "From: " header.
: 
: > The docs mention nothing.
: 
: The docs specifically mention that changing $from has no effect on the
: current message from within send-hooks.

I can't find anything in the docs that support this statement, even
though your statement is true.  :-(  In fact, the docs only have a
statement about using my_hdr:

        http://www.mutt.org/doc/manual/manual-3.html#send-hook

        Also note that my_hdr commands which modify recipient headers,
        or the message's subject, don't have any effect on the current
        message when executed from a send-hook.

: > The problem is, since setting $from is unreliable while "my_hdr From:"
: > always works, what's the point of keeping this configuration variable?
: > Get rid of what's broken and keep what works.
: 
: There, you have a feature request.  I'd rather keep both, but fix
: evaluation of send-hooks so they happen before the "From: " header is
: constructed.  The only problem is that doing so would prevent us from
: being able to match on the "From: " header in a send-hook (since the
: header wouldn't exist yet).  The "correct" solution is difficult to work
: out, IMHO.  There are too many overlapping feature requests, and many of
: them are incompatible by design.

I can see how it gets complicated.  Without looking into the bowels of
the source, I can't even imagine what the "correct" solution should be.
But I do know that setting $from in a send-hook seems to be a recurring
question.  I think it would be very useful if the official docs would 
specifically mention this caveat.

So what's the best way to request and correct a documentation bug?

: > Just a bit confused since the docs (short of parsing the source code)
: > doesn't match behavior.  Maybe I should file a bug report?
: 
: You can certainly file a wishlist, but since the docs _do_ predict this
: behavior, it's not technically a "bug" as such.  (It's simply a documented
: "feature" - and a rather annoying one, at that.)

I must be blind, because I cannot find anything in the docs that even
predicts this behavior.  Could you possible provide a link to the blurb
in the docs that says so?

BTW, David, thank you very much for your detailed reply.  :-)