branch : pmacs2
This commit is contained in:
moculus 2009-03-16 18:35:13 +00:00
parent 1bdfd3e1b2
commit 9b3ef0fc3e
2 changed files with 12 additions and 7 deletions

View File

@ -62,7 +62,6 @@ class Man(Exec):
def _execute(self, w, **vargs):
name = vargs['name']
cmd = 'man %r' % name
#p = Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT)
p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
output = p.stdout.read()
result = p.wait()

View File

@ -7,6 +7,7 @@ from lex import Grammar, PatternRule, ContextPatternRule, RegionRule, \
from method import Argument, Method, WrapParagraph
from tab import StackTabber, StackTabber2
from parse import Any, And, Or, Optional, Name, Match, Matchs
import term
class PodDataGrammar(Grammar):
rules = [PatternRule(r'data', r'[^\n]+\n$')]
@ -226,6 +227,7 @@ class PerldocModule(PerlBase):
'''View documentation about this buffer using perldoc'''
bname = '*Perldoc*'
prog = 'use Pod::Text; Pod::Text->new()->parse_from_filehandle();';
#prog = 'use Pod::Text::Termcap; Pod::Text::Termcap->new()->parse_from_filehandle();';
def get_args(self, w, **vargs):
return ('perl', '-e', self.prog)
def _execute(self, w, **vargs):
@ -258,21 +260,25 @@ class Perldoc(Method):
w.set_error('nothing found for %r' % name)
def _try(self, w, name, asfunc=False):
if asfunc:
cmd = "perldoc -t -T -f '%s'" % name
cmd = "perldoc -f '%s'" % name
else:
cmd = "perldoc -t -T '%s'" % name
cmd = "perldoc '%s'" % name
l = w.application.config.get('perl.libs', [])
if l:
cmd = 'PERL5LIB=%r %s' % (':'.join(['%r' % x for x in l]), cmd)
status, data = commands.getstatusoutput(cmd)
p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
output = p.stdout.read()
result = p.wait()
status = os.WEXITSTATUS(result)
if status == 0:
return data
xterm = term.XTerm(cbuf=True)
output = xterm.term_filter(output)
return output
else:
return None
def _show(self, w, data, name):
w.application.data_buffer("*Perldoc*", data, switch_to=True)
w.application.color_data_buffer("*Perldoc*", data, switch_to=True)
w.set_error('displaying perldoc for %r' % name)
class PerldocWord(Perldoc):