parent
6865b2a4e9
commit
a6fb81d077
|
@ -127,7 +127,8 @@ class Application(object):
|
|||
'python', 'replace', 'rst', 'scheme', 'search', 'sh', 'sql',
|
||||
'tt', 'text', 'text2', 'which', 'xml', 'cheetah', 'colortext',
|
||||
'latex', 'insertmini', 'conf', 'haskell', 'erlang',
|
||||
'iperl', 'iperlmini', 'ipython', 'ipythonmini'
|
||||
'iperl', 'iperlmini', 'ipython', 'ipythonmini',
|
||||
'bds', #XYZ
|
||||
)
|
||||
for name in names:
|
||||
exec("import mode.%s; mode.%s.install(self)" % (name, name))
|
||||
|
|
|
@ -2,6 +2,7 @@ import commands, os.path, sets, string, sys, traceback
|
|||
import color, completer, default, mode, method, regex, tab
|
||||
from point import Point
|
||||
from lex import Grammar, PatternRule, RegionRule, OverridePatternRule
|
||||
from mode.lisp import LispTabber, LispCommentRegion, LispUncommentRegion
|
||||
|
||||
class StringGrammar(Grammar):
|
||||
rules = [
|
||||
|
@ -12,6 +13,7 @@ class StringGrammar(Grammar):
|
|||
class ELispGrammar(Grammar):
|
||||
rules = [
|
||||
PatternRule(r'comment', r';.*$'),
|
||||
PatternRule(r'delimiter', r'[()]'),
|
||||
PatternRule(r'elisp_reserved', r'(?:nil)(?![a-zA-Z0-9_])'),
|
||||
PatternRule(r'elisp_keyword', r'(?:while|when|unless|setq|require|or|not|mapcar|list|let|lambda|if|exists|equal|defvar|defun|defalias|count|cons|cdr|car|apply|and)(?![a-zA-Z0-9_])'),
|
||||
PatternRule(r'elisp_symbol', r"'[a-zA-Z_][a-zA-Z0-9-_]*"),
|
||||
|
@ -25,14 +27,15 @@ class ELispGrammar(Grammar):
|
|||
PatternRule(r'eol', r'\n$'),
|
||||
]
|
||||
|
||||
class ELispTabber(tab.StackTabber):
|
||||
pass
|
||||
#class ELispTabber(tab.StackTabber):
|
||||
# pass
|
||||
|
||||
class ELisp(mode.Fundamental):
|
||||
modename = 'ELisp'
|
||||
tabwidth = 2
|
||||
basenames = ['.emacs']
|
||||
extensions = ['.el']
|
||||
tabbercls = ELispTabber
|
||||
tabbercls = LispTabber
|
||||
grammar = ELispGrammar
|
||||
opentokens = ('delimiter',)
|
||||
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||
|
@ -49,5 +52,7 @@ class ELisp(mode.Fundamental):
|
|||
self.add_bindings('close-paren', (')',))
|
||||
self.add_bindings('close-brace', ('}',))
|
||||
self.add_bindings('close-bracket', (']',))
|
||||
self.add_bindings('lisp-comment-region', ('C-c #',))
|
||||
self.add_bindings('lisp-uncomment-region', ('C-u C-C #',))
|
||||
|
||||
install = ELisp.install
|
||||
|
|
10
mode/lisp.py
10
mode/lisp.py
|
@ -3,6 +3,7 @@ import color, completer, default, mode, method, regex, tab
|
|||
from point import Point
|
||||
from lex import Grammar, PatternRule, RegionRule, OverridePatternRule
|
||||
from mode.python import StringGrammar
|
||||
from method import CommentRegion, UncommentRegion
|
||||
|
||||
class LispGrammar(Grammar):
|
||||
rules = [
|
||||
|
@ -13,6 +14,11 @@ class LispGrammar(Grammar):
|
|||
PatternRule(r'eol', r'\n'),
|
||||
]
|
||||
|
||||
class LispCommentRegion(CommentRegion):
|
||||
commentc = ';'
|
||||
class LispUncommentRegion(UncommentRegion):
|
||||
commentc = ';'
|
||||
|
||||
class LispTabber(tab.StackTabber):
|
||||
wsre = regex.whitespace
|
||||
wst = ('spaces', 'null', 'eol',)
|
||||
|
@ -43,10 +49,14 @@ class Lisp(mode.Fundamental):
|
|||
opentags = {'(': ')'}
|
||||
closetokens = ('delimiter',)
|
||||
closetags = {')': '('}
|
||||
actions = [LispCommentRegion, LispUncommentRegion]
|
||||
|
||||
def __init__(self, w):
|
||||
mode.Fundamental.__init__(self, w)
|
||||
self.add_bindings('close-paren', (')',))
|
||||
self.add_bindings('close-brace', ('}',))
|
||||
self.add_bindings('close-bracket', (']',))
|
||||
self.add_action_and_bindings('lisp-comment-region', ('C-c #',))
|
||||
self.add_action_and_bindings('lisp-uncomment-region', ('C-u C-C #',))
|
||||
|
||||
install = Lisp.install
|
||||
|
|
Loading…
Reference in New Issue