rust-lang / rust-mode

Emacs configuration for Rust
Apache License 2.0
1.1k stars 178 forks source link

Add rust-occur-definitions #362

Closed lerouxrgd closed 4 years ago

lerouxrgd commented 4 years ago

Taking inspiration from elpy, this function displays an occur buffer of all definitions in the current buffer.

This is similar to what imenu provides, but it also reflects the overall file structure (by preserving order and indentation).

It could be bound to C-c C-o (as done in elpy).

rust-highfive commented 4 years ago

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brotzeit (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

mookid commented 4 years ago

I am bothered by the duplication of functionality compared to the exisiting imenu support. Did you investigate if it was possible to instead improve the imenu code to obtain a similar effect?

A good thing about this is that existing packages provide a different user interface to imenu instead of the one you suggest.

lerouxrgd commented 4 years ago

I understand your concern. I think imenu is more aimed at dynamic interaction (filtering, narrowing down, through different interfaces as you mentioned). Here occur is the final interface (navigable output, file structure overview).

So feel free to close the PR if you think this is a duplication of functionalities.