Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

which-function-mode? pretty please? #9

Open
chloe-zen opened this issue Aug 30, 2011 · 5 comments
Open

which-function-mode? pretty please? #9

chloe-zen opened this issue Aug 30, 2011 · 5 comments

Comments

@chloe-zen
Copy link

No description provided.

@jrockway
Copy link
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.

@chloe-zen
Copy link
Author

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
Copy link
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?

@chloe-zen
Copy link
Author

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.

@renormalist
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants