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

Re: message-hook in index mode?



On 15Jan2009 16:45, Gary Johnson <garyjohn@xxxxxxxxxx> wrote:
| On 2009-01-16, Cameron Simpson <cs@xxxxxxxxxx> wrote:
| > I would like to do some per-message pattern matching using a hook
| > to adjust a macro on a per-message basis.
| > 
| > My mail filer delivers messages I need to see and (possibly) read to my
| > "=me" mailbox. I have 'd' mapped to a macro that feeds the message to my
| > "non-spam" bogofilter counter and saves the message to "=OLD/YYYY/me".
[...]
| > However, because my "=me" folder is something of a catch-all for
| > messages I should consider, the delete action should vary. [...]
| > Now, I can write patterns to recognise messages but I don't know how to have
| > them take effect. Looking at "message-hook" in "man muttrc" it says that it
| > runs when a message is displayed/formatted. However, some messages are going
| > to get "deleted" without opening - I will be purely in the index.
[...]
| Since you are deleting by saving messages to particular mailboxes,
| how about using a save-hook?

That's a neat suggestion. This post is just to say I'm exploring it and
not ignoring you!

I'm currently playing with this:

  folder-hook . 'macro index,pager d 
"<copy-message>+ham<enter><save-message><enter>" "archive message"
  folder-hook .       'save-hook . "$DELETE_FOLDER"'
  folder-hook '^=me$' 'save-hook "~s ^LogWatch" "+bos-reports"'

This should load up a sequence of save-hooks based on the folder.
Is there any way to flush all the save-hooks if I change folders, or am
I stuck with just loading up the new set to override the older ones?

$DELETE_FOLDER is set up by my mutt wrapper to =OLD/YYYY/folder, this
doing the default archive.

My current difficulty is writing complex rules for the save-hook, because
that requires a third level of quote nesting.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/