diff --git a/application.py b/application.py index 4851628..582efd2 100755 --- a/application.py +++ b/application.py @@ -82,7 +82,7 @@ class Application(object): # ok, now let's load all the "standard" modes mode.install(self) - for name in ('blame', 'c', 'console', 'consolemini', 'css', 'diff', + for name in ('about', 'blame', 'c', 'console', 'consolemini', 'css', 'diff', 'dir', 'elisp', 'hex', 'html', 'java', 'javascript', 'lisp', 'make', 'mini', 'mutt', 'nasm', 'ocaml', 'perl', 'python', 'replace', 'rst', 'scheme', 'search', 'sh', diff --git a/method.py b/method.py index 4b8ec98..abf4616 100644 --- a/method.py +++ b/method.py @@ -108,10 +108,8 @@ class Method: class AboutPmacs(Method): '''print some information about pmacs''' data = ''' - ================================================================================ - ************ ********** ****** ****** **** ******** ********* ************** ****************** ************* ********** *********** ******* ***** ****** ***** **** **** ****** **** **** ***** **** @@ -126,12 +124,10 @@ class AboutPmacs(Method): ***** ***** to see all available commands use: C-c M-h (show-bindings-buffer) - ================================================================================ - ''' def _execute(self, w, **vargs): - w.application.data_buffer("*About*", self.data, switch_to=True) + w.application.data_buffer("*About*", self.data, switch_to=True, modename='about') class GotoChar(Method): '''Jump to the specified character''' diff --git a/mode/about.py b/mode/about.py new file mode 100644 index 0000000..146ef6b --- /dev/null +++ b/mode/about.py @@ -0,0 +1,30 @@ +import mode +from lex import Grammar, PatternRule, RegionRule, PatternGroupRule + +class AboutGrammar(Grammar): + rules = [ + PatternRule(r'stars', r'\*+'), + PatternRule(r'equals', r'=+'), + PatternRule(r'pmacs', r'pmacs'), + PatternRule(r'author', r'Erik Osheim'), + PatternRule(r'copyright', r'\(c\) 2005-2007'), + PatternRule(r'license', r'GNU General Public License v2'), + PatternRule(r'binding', r'C-c M-h'), + PatternRule(r'command', r'\(show-bindings-buffer\)'), + ] + +class About(mode.Fundamental): + modename = 'About' + grammar = AboutGrammar() + colors = { + 'stars': ('yellow', 'default'), + 'equals': ('red', 'default'), + 'pmacs': ('cyan', 'default'), + 'author': ('cyan', 'default'), + 'copyright': ('blue', 'default'), + 'license': ('cyan', 'default'), + 'binding': ('cyan', 'default'), + 'command': ('blue', 'default'), + } + +install = About.install