vanity method + vanity mode

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-11-05 23:50:47 +00:00
parent 1b88f3c600
commit e1973910ca
3 changed files with 32 additions and 6 deletions

View File

@ -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',

View File

@ -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'''

30
mode/about.py Normal file
View File

@ -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