On 2009-01-16, Cameron Simpson <c...@zip.com.au> 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". > > The macro is made when I start mutt, based on the opening folder, so > OLD/YYYY/me is effecively hardwired. For other folders (eg "=mutt") > this works well - I want to just move deleted messages into the archive. > (I should say that my usage pattern is to start mutt on a particular > folder and later quit; I do not "change folders"). > > However, because my "=me" folder is something of a catch-all for > messages > I should consider, the delete action should vary. For example, I'd like > certain logwatch messages to "delete" into a reports folder, work > related discussion email to "delete" into the "work" folder etc. > > 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. > > At present I can only imagine handing the message to a procmail > filter to make the decisions. But is there something that can fire > whenever I move lines in the index? > > Alternatively, I can imagine a horribe hack of making "d" pipe the > message to /dev/null in order to trigger the formatter in order to > trigger message-hook, and then proceeding with the newly tweaked delete > macro. > > Has anyone any better ideas?
Since you are deleting by saving messages to particular mailboxes, how about using a save-hook? Regards, Gary