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:
1. python 2.3 or higher
2. ncurses
3. bash
Optional Dependencies:
1. ispell
2. aespipe
3. perl
4. ctags
5. cvs
6. svn
7. grep
* aespipe [for aes-encrypted buffers]
* ctags [for ctags support]
* cvs [for cvs-based commands]
* grep [for grep-based commands]
* ispell [for spell-as-you-type]
* perl [for perl syntax-checking]
* svn [for svn-based commands]
Quick Start Guide:
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
from lex3 import Grammar, PatternRule, RegionRule
from method import Method
class StringGrammar(Grammar):
rules = [
@ -94,5 +96,18 @@ class Sh(mode2.Fundamental):
'comment': ('red', 'default'),
'continuation': ('red', 'default'),
}
def name(self):
return "Sh"
def __init__(self, w):
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)