bash actions for sh-mode

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2009-05-17 23:48:01 -04:00
parent dd91be6169
commit eb087a4e94
1 changed files with 16 additions and 1 deletions

View File

@ -3,6 +3,7 @@ from tab import StackTabber
from mode import Fundamental
from lex import Grammar, PatternRule, RegionRule, PatternMatchRule, OverridePatternRule
from method import Method
from method.shell import Interact
char = '[a-zA-Z0-9_]'
word = char + '+'
@ -170,6 +171,20 @@ class ShCheckSyntax(Method):
else:
app.data_buffer("*Sh-Check-Syntax*", output)
class BashStart(Interact):
args = []
reuse = True
def _execute(self, w, **vargs):
Interact._execute(self, w, bname='*Bash*', cmd='bash')
class BashLoadFile(Interact):
args = []
reuse = True
def _execute(self, w, **vargs):
path = w.buffer.path
cmd = 'bash %r' % path
Interact._execute(self, w, bname='*Bash*', cmd=cmd)
b = w.application.get_buffer_by_name('*Bash*')
class Sh(Fundamental):
name = 'sh'
paths = ['/etc/profile']
@ -213,7 +228,7 @@ class Sh(Fundamental):
'neval.null': ('cyan', 'default', 'bold'),
'neval.end': ('yellow', 'default', 'bold'),
}
actions = [ShCheckSyntax]
actions = [ShCheckSyntax, BashStart, BashLoadFile]
_bindings = {
'sh-check-syntax': ('C-c s',),
}