branch : pmacs2
This commit is contained in:
moculus 2007-07-25 20:42:24 +00:00
parent ada40b4224
commit f8aa9c2cab
2 changed files with 25 additions and 9 deletions

15
README
View File

@ -18,15 +18,16 @@ commented, although currently there is only one author. Buyer beware!
Requirements: Requirements:
1. python 2.3 or higher 1. python 2.3 or higher
2. ncurses 2. ncurses
3. bash
Optional Dependencies: Optional Dependencies:
1. ispell * aespipe [for aes-encrypted buffers]
2. aespipe * ctags [for ctags support]
3. perl * cvs [for cvs-based commands]
4. ctags * grep [for grep-based commands]
5. cvs * ispell [for spell-as-you-type]
6. svn * perl [for perl syntax-checking]
7. grep * svn [for svn-based commands]
Quick Start Guide: Quick Start Guide:
1. Download and unpack the pmacs tarball file. After this, there should be 1. Download and unpack the pmacs tarball file. After this, there should be

View File

@ -1,5 +1,7 @@
import commands
import color, mode2, tab2 import color, mode2, tab2
from lex3 import Grammar, PatternRule, RegionRule from lex3 import Grammar, PatternRule, RegionRule
from method import Method
class StringGrammar(Grammar): class StringGrammar(Grammar):
rules = [ rules = [
@ -94,5 +96,18 @@ class Sh(mode2.Fundamental):
'comment': ('red', 'default'), 'comment': ('red', 'default'),
'continuation': ('red', 'default'), 'continuation': ('red', 'default'),
} }
def name(self): def __init__(self, w):
return "Sh" mode2.Fundamental.__init__(self, w)
self.add_action_and_bindings(ShCheckSyntax(), ('C-c s',))
class ShCheckSyntax(Method):
'''Check the syntax of a shell script'''
def _execute(self, w, **vargs):
app = w.application
cmd = "bash -n %r" % w.buffer.path
(status, output) = commands.getstatusoutput(cmd)
if status == 0:
app.set_error("Syntax OK")
app.data_buffer("*Sh-Check-Syntax*", output, switch_to=False)
else:
app.data_buffer("*Sh-Check-Syntax*", output)