which-function-mode? pretty please? #9

Open
chipdude opened this Issue Aug 30, 2011 · 4 comments

Comments

Projects
None yet
2 participants

No description provided.

Owner

jrockway commented Sep 4, 2011

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.

chipdude commented Sep 7, 2011

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)

Owner

jrockway commented Sep 7, 2011

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

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

Are you not seeing the same thing?

chipdude commented Sep 8, 2011

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 7d8066c 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment