branch : pmacs2
This commit is contained in:
moculus 2008-05-20 15:10:42 +00:00
parent e382dcf8bb
commit b123ac8a60
1 changed files with 13 additions and 8 deletions

View File

@ -495,21 +495,25 @@ class PerlOpenModule(method.Method):
else:
w.set_error("Could not find module %r" % vargs['module'])
class PerlOpenModuleWord(method.Method):
namechars = string.letters + string.digits + '_'
def _execute(self, w, **vargs):
word = pkg = w.get_token().string
path = None
while pkg and pkg[0] not in self.namechars:
pkg = pkg[1:]
while True:
path = w.mode.find_module(pkg)
if path:
break
parent = pkg.rsplit('::')[0]
parent = pkg.rsplit('::', 1)[0]
if parent == pkg:
break
parent = pkg
else:
pkg = parent
if path:
w.application.methods['open-file'].execute(w, filename=path)
else:
w.set_error("Could not find module related to %r" % pkg)
w.set_error("Could not find module related to %r" % word)
class PerlFunctionCompleter(completer.Completer):
def get_candidates(self, s, w=None):
@ -537,9 +541,11 @@ class PerlContext(context.Context):
if (not stack and len(g) > 2 and g[0].name == 'perl_keyword' and
g[0].string == 'sub' and g[2].name == 'sub'):
curr = g[2].string
self.names[curr] = i
starting = True
if curr is not None and curr not in self.names:
self.names[curr] = i
if i == y2 - 1 and curr != self.namelines[i][0] and y2 < blen:
y2 += 1
@ -691,10 +697,9 @@ class Perl(mode.Fundamental):
self.add_bindings('perl-view-module-perldoc', ('C-c v',))
self.add_bindings('perl-view-word-perldoc', ('C-c p',))
self.add_bindings('perl-wrap-paragraph', ('M-q',))
self.add_bindings('perl-init-functions', ('C-c M-g',))
self.add_bindings('perl-goto-function', ('C-c M-g',))
self.add_bindings('perl-which-function', ('C-c w',))
self.add_bindings('perl-list-functions', ('C-c W',))
self.add_bindings('perl-open-module', ('C-c C-f',))
self.add_bindings('perl-open-module-word', ('C-c M-f',))
self.add_bindings('close-paren', (')'))
self.add_bindings('close-bracket', (']'))
self.add_bindings('close-brace', ('}'))