Re: rerunning hooks
- To: mutt-users@xxxxxxxx
- Subject: Re: rerunning hooks
- From: Kyle Wheeler <kyle-mutt@xxxxxxxxxxxxxx>
- Date: Wed, 24 Sep 2008 09:23:42 -0500
- Comment: DomainKeys? See http://domainkeys.sourceforge.net/
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=memoryhole.net; h=date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; s=default; bh=Iutypmc+oxDBedu+F3Cfb4q5st4=; b=cQKU nmFHuiABGzG3jmSirw7TH5DmeCg1n290h/rFaj9dGERU1XvMTpNz68oGzVdpGS5O ZmH6pDKS6P3YMdheu2/PGYlGD/3TYOUjxc7O1Wk4EryVVdWUmTGbAN4b4V2Ce4V2 QS7IbjJcJ9NZo1oW2MHCVAWa9hQMfKLXL23A2TU=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=memoryhole.net; b=jSPzFsY5nIjmvRKdhspKBaofXYo2NIrrmybwdw90AE9e8ICYUwnZah3W8LPec+QgyM1afLO/njbA4zcXpBMgzeXi+PpWz9ylc2tBJxhWr/I1tU9VFup2EQMJwfmJNb4018n9FutuNuHvtx73ggc3Vo450pFtoGbxHKtaIGg3iHY=; h=Received:Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:OpenPGP:User-Agent;
- In-reply-to: <20080924112212.GB14841@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- List-post: <mailto:mutt-users@mutt.org>
- List-unsubscribe: send mail to majordomo@mutt.org, body only "unsubscribe mutt-users"
- Mail-followup-to: mutt-users@xxxxxxxx
- Openpgp: id=CA8E235E; url=http://www.memoryhole.net/~kyle/kyle-pgp.asc; preference=signencrypt
- References: <20080923085826.GA17527@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20080923132308.GH38461@xxxxxxxxxxxxx> <20080924112212.GB14841@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Sender: owner-mutt-users@xxxxxxxx
- User-agent: Mutt/1.5.18 (2008-08-31)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wednesday, September 24 at 01:22 PM, quoth martin f krafft:
> also sprach Kyle Wheeler <kyle-mutt@xxxxxxxxxxxxxx> [2008.09.23.1523 +0200]:
>> Not really, because it's impossible to know which hooks "apply".
>> Hooks are associated with actions, not with states. The send-hook
>> applies whenever you attempt to *send* a message, the message-hook
>> applies whenever you attempt to *view* a message, and so forth. If
>> you are currently sending a message, but are relying on a setting
>> that was set by viewing a message (or perhaps are relying on the
>> fact that the last message you sent triggered a hook), how is mutt
>> to know?
>
> It could pretend that it's reopening the folder, or reviewing
> a message, or restarting the composing of an email, etc.
Since *you* know which of those hooks are important, *you* can tell it
to do that. Something I do a lot in my pager macros is the
<exit><display-message> combo, which (as it happens) will re-trigger
any hooks involved in viewing that particular message and doesn't
require an extra screen redraw (i.e. it doesn't ever actually display
the index). Something else you could try (from the pager) would be
this:
<exit><change-folder>^<enter><display-message>
You may have to do some extra work to make sure that the message you
display is the same one that you're currently on, but that would
reopen the folder and review the message.
But Rocco is absolutely right: many people build up a bit of a history
with their hook settings *intentionally*, and figuring out the exact
history would require, at minimum, re-triggering every hook that's
been triggered (and maintaining all the message state) since mutt
began.
For example, imagine that I had the following in my muttrc:
set sendmail=oldsendmail
message-hook '=b foo' 'set sendmail=newsendmail'
After you've been running mutt for a while, you now want to re-trigger
all the hooks that "apply". So here's the question: what should the
value of $sendmail be, and how can mutt ensure that it's correct?
Notice that I didn't say whether you'd read a message that had foo in
the body... is that important? How is mutt to know whether you've read
a message that had foo in the body since mutt was first launched?
Let's add another twist:
set sendmail=oldsendmail
send-hook . 'set sendmail=newsendmail'
message-hook '=b foo' 'unhook send-hook'
message-hook '=b bar' 'send-hook "=b foo" "set sendmail=oldsendmail"'
NOW what is the correct value of $sendmail? How much state does mutt
have to remember in order to figure out the correct value?
And we're not even considering issues like Rocco brought up, such as:
send-hook . 'source genconfig.sh|'
~Kyle
- --
No one loves armed missionaries.
-- Maximilien Robespierre
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!
iEYEARECAAYFAkjaTW4ACgkQBkIOoMqOI15nbACdHD/mdG6QnMhH5WX76OD/IDAQ
jPkAoLoUN8ioWdzLSLIncLTYlBkqoGWx
=hkeH
-----END PGP SIGNATURE-----