Permalink
Browse files

Only check Lispy-ness once.

  • Loading branch information...
1 parent 91af7be commit 0123147270b29ac247b4ebb7a44b3f7657fefdb3 @andkerosine committed May 18, 2012
Showing with 9 additions and 4 deletions.
  1. +9 −4 rainbowth.py
View
@@ -6,18 +6,23 @@ def __init__(self):
self.style = settings.get('style') == 'outline' and 32 or 0
self.sources = settings.get('sources')
- def lispy(self):
+ def is_lispy(self):
file_scope = self.view.scope_name(0)
return file_scope.split('.')[1].split(' ')[0] in ['lisp', 'scheme']
def on_modified(self, view):
- self.view = view
- if not self.lispy():
- return
key = view.substr(view.sel()[0].begin() - 1)
if key not in '()':
return
+ try:
+ self.lispy
+ except AttributeError:
+ self.view = view
+ self.lispy = self.is_lispy()
+ if not self.lispy:
+ return
+
start, end = [view.sel()[0].begin()] * 2
while start > 0:

0 comments on commit 0123147

Please sign in to comment.