From b123ac8a6060d2fde2021a9475ca8df5e212f009 Mon Sep 17 00:00:00 2001 From: moculus Date: Tue, 20 May 2008 15:10:42 +0000 Subject: [PATCH] --HG-- branch : pmacs2 --- mode/perl.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/mode/perl.py b/mode/perl.py index f2cc18c..0f91369 100644 --- a/mode/perl.py +++ b/mode/perl.py @@ -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): @@ -536,9 +540,11 @@ class PerlContext(context.Context): g = highlights.tokens[i] 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 + curr = g[2].string + starting = True + + if curr is not None and curr not in self.names: self.names[curr] = i - starting = True 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', ('}'))