2007-03-06 10:05:38 -05:00
|
|
|
import sets, sys
|
|
|
|
|
|
|
|
import color, mode, lex, lex_mutt, method, mode_text
|
|
|
|
|
|
|
|
class Mutt(mode.Fundamental):
|
|
|
|
def __init__(self, w):
|
|
|
|
mode.Fundamental.__init__(self, w)
|
|
|
|
|
|
|
|
self.add_action_and_bindings(mode_text.LearnWord(), ('C-c l',))
|
|
|
|
self.add_action_and_bindings(MuttWrapParagraph(), ('M-q',))
|
|
|
|
self.add_action_and_bindings(MuttInsertSpace(), ('SPACE',))
|
|
|
|
|
|
|
|
self.grammar = lex_mutt.MuttGrammar()
|
2007-06-13 22:38:46 -04:00
|
|
|
#import lex_text
|
|
|
|
#self.grammar = lex_text.TextGrammar()
|
2007-03-06 10:05:38 -05:00
|
|
|
self.lexer = lex.Lexer(self.grammar)
|
|
|
|
|
|
|
|
self.default_color = color.build('default', 'default')
|
|
|
|
self.colors = {
|
2007-06-13 22:38:46 -04:00
|
|
|
'header': color.build('green', 'default', 'bold'),
|
|
|
|
'email': color.build('cyan', 'default', 'bold'),
|
|
|
|
'url': color.build('cyan', 'default', 'bold'),
|
|
|
|
'misspelled word': color.build('red', 'default', 'bold'),
|
2007-03-06 10:05:38 -05:00
|
|
|
'misspelled continued word': color.build('red', 'default', 'bold'),
|
2007-06-13 22:38:46 -04:00
|
|
|
'quote1': color.build('yellow', 'default', 'bold'),
|
|
|
|
'quote2': color.build('cyan', 'default', 'bold'),
|
|
|
|
'quote3': color.build('magenta', 'default', 'bold'),
|
2007-03-06 10:05:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
return "Mutt"
|
|
|
|
|
|
|
|
class MuttWrapLine(method.WrapLine):
|
|
|
|
limit = 72
|
|
|
|
|
|
|
|
class MuttWrapParagraph(method.WrapParagraph):
|
|
|
|
wrapper = MuttWrapLine
|
|
|
|
|
|
|
|
class MuttInsertSpace(mode_text.TextInsertSpace):
|
|
|
|
limit = 72
|
|
|
|
wrapper = MuttWrapParagraph
|