On Sat, Jul 18, 2009 at 09:15:27AM -0600, Paul E Condon wrote:
> I have an idea that might be useful, but I haven't been following really
> closely, please excuse the possible noise
> 
> The thread code arranges the display based on some field/information that
> correllates sub-sets of email. I don't know what it is, but if the place
> where it looks to decide whether or not to include a partcular email in 
> a thread were a setable option, like $folder - would that met OP's needs?

The way I handle categorization in my inbox is by tagging subject
lines.  The tags can then be used as a limit pattern to filter the
view temporarily.  For example this thread shows up with
"[mutt-users]" at the front of the subject line, and I can limit to
that if I only want to see this list.

To assign the tags I hooked a Lua interpreter into mutt.  The tags
don't actually exist in the messages, but are inserted dynamically as
part of mutt's display/search code.

For example when mutt is rendering the message list, instead of using
the subject line directly from the message it calls a Lua function
"get_printable_subject" with a marshalled copy of the message data,
and uses the returned string as if it were the subject line.  There is
a similar Lua function "get_matchable_subject" that gets invoked when
doing pattern matching against subject lines.

In the case of this mailing list, the Lua code notices that the
"sender" or "to" values in the envelope match known values for the the
list, and prepends "[mutt-users]" to the subject line.

As a trivial spam filter, I also tag messages with known-spam subject
lines as "[SPAM]".  If I see a spam message that isn't tagged, I can
hit "S" while reading mail and a Lua function adds the current
message's subject to the blacklist.  A persistent copy of the
blacklist is kept in a file, which is loaded into a Lua hash table on
startup.

I guess the point here is that if you don't want to edit messages
directly, it might be possible to handle the categories with an
external mapping table from subject lines, message-ids, senders, or
whatever to categories, and have mutt dynamically apply those
mappings.  Editing and managing the categories in some user-friendly
way remains a problem.  Likewise if you want fancy display-time
functions such expanding/collapsing subcategories in a hierarchy, that
could get complicated.

Note that my Lua patches are based on a build of mutt over a year old
and to do anything useful with them you have to be able to read and
write Lua, so I'm not sure my implementation would be of much use.  My
patches also provide only bare-bones hooks in the C code and assume
custom Lua code (nearly 200 lines of it even in my trivial case) will
do the heavy lifting.

                                                  -Dave Dodge

Reply via email to