jrockway / cperl-mode

cperl-mode with 5.10 fixes, mx-declare support, perl6 support, etc.
102 stars 33 forks source link

which-function-mode? pretty please? #9

Open chloe-zen opened 13 years ago

jrockway commented 13 years ago

Sure. Do you have any suggestions for an algorithm to use? It would be nice to detect package boundaries, not be fooled by code like sub foo { sub { ... } }, and optionally support other "sub defining keywords", like "method".

(Note that unlike most static analysis packages, we have to be able to get the right answer even when the code is sligthly malformed, like as it's being typed in.)

Anyway, I played with something similar to this in Pure Perl a while ago, see http://cpansearch.perl.org/src/JROCKWAY/Devel-InPackage-0.01/lib/Devel/InPackage.pm. Your thoughts would be appreciated.

chloe-zen commented 13 years ago

The idea is to help with gross navigation, so I personally would be content with support for

m{ ^ \s* package \s+ (\w[:\w]) }xm m{ ^ \s $sub_keyword \s+ (\w[:\w]*) }xm

where default $sub_keyword is 'sub', 'method', 'before', 'after', 'around', and now 'func' (see Method::Signatures::Simple)

jrockway commented 13 years ago

Oh. This already works. which-func uses the data from imenu, which has worked for a while.

I just tested cperl-mode 7d8066cff7bfb6bc151c05bd2fcff13fb811bf25 with Emacs 23.3.1 on Debian, and which-func works as expected.

Are you not seeing the same thing?

chloe-zen commented 13 years ago

On 9/7/2011 2:12 PM, Jonathan Rockway wrote:

Oh. This already works. which-func uses the data from imenu, which has worked for a while.

I just tested cperl-mode 7d8066cff7bfb6bc151c05bd2fcff13fb811bf25 with Emacs 23.3.1 on Debian, and which-func works as expected.

Are you not seeing the same thing?

How curious. When I turn on which-function-mode in .emacs it malfunctions, and I only get "???" as my function names. If I toggle it twice after loading the files, then it works.

If you could clear up how/why that is happening, that'd be neat, but now I know how to make it work, so thanks.

renormalist commented 6 years ago

I will close this soon for cleanup reasons if nobody objects.