I fixed the problem with the quotes. I also attached the python script this time to make it easier to save.
I really need to better understand how mutt treats quotes and backslashes to improve the script further. What works from the <enter-command> prompt from within mutt, doesn't work when sourced from the .muttrc file. For example: score score "~s 'Selecting\ messages\ in\ \"my\"\ threads'" 10 works from within mutt (using <enter-command>), but produces an error when sourced from the output of my script. Here's what works instead: score "~s 'Selecting\\ messages\\ in\\ \"my\"\\ threads'" 10 Note how all backslashes are escaped except for the ones preceding the quotes. Can anyone shed light on this? Thanks, Ben -- Ben Logan: ben at wblogan dot net OpenPGP Key KeyID: A1ADD1F0 Gibble, Gobble, we ACCEPT YOU ...
#!/usr/bin/python import string,re watch_file = "/home/ben/mail/watch" f = open(watch_file,"r") line = f.readline() while line: # Strip any beginning [listnamehere] strings, because they screw everything up line = re.sub(r"""^(\s*\[[^]]+\])?\s*(Re:\s*)*(?i)""","",line) line = string.replace(re.escape(string.strip(line)),"\\","\\\\") line = string.replace(line,r"""\\'""",r"""\'""") line = string.replace(line,r'''\\"''',r'''\"''') print """score "~s '%s'" 10""" % line line = f.readline() f.close()