My exmh environment is full of small tweaks for my needs, acquired over the years. exmh is written in tcl, which is likely the weirdest almost-mainstream scripting language, but not bad at all - however lousy I am at it.

So here's my helpers to make training your Bayes filter (spamassassin or other) a bit more convenient.

Plug this into ~/.exmh/lib/, run echo "auto_mkindex ." | tclsh in there to update the library index.

proc learnspam {type} {
    global exmh mhProfile
    set paths {}
    Ftoc_Iterate line {
        set msgid [Ftoc_MsgNumber $line]
    Exmh_Debug "looking at $msgid in line $line"
        if {$msgid != {}} {
            lappend paths "$mhProfile(path)/$exmh(folder)/$msgid"
        Exmh_Debug "added $mhProfile(path)/$exmh(folder)/$msgid"
        }
    }

    if {[llength $paths] == 0} {
    Exmh_Status "No messages selected"
    return
    }
    eval exec learnspam $type $paths &
}

Add this to ~/.exmh/exmh-defaults:

*Mops.ubuttonlist: isspam nospam
*Mops.isspam.text: IsSpam
*Mops.isspam.command: learnspam spam
*Mops.nospam.text: NotSpam
*Mops.nospam.command: learnspam ham

Together these to snippets allow you to select messages somewhere and click on one of two buttons (spam/notspam) in the menubar. The tcl bit runs a wrapper called learnspam with args ham or spam and the pathes of your selected messages. All you need to do is create your wrapper to call whatever learning system you have (in my case spamassassin on two remote servers).

[ published on Sat 17.01.2004 15:15 | filed in mystuff | ]
Debian Silver Server
© Alexander Zangerl