views:

169

answers:

3

For now I've stuck with multi-occur-in-matching-buffers and rgrep, which, while powerful, is still pretty basic I guess.

Eventhough I realize anything more involved than matching a regexp and renaming will need to integrate with CEDET's semantic bovinator, I feel like there is still room for improvement here.

Built-in functions, packages, or custom-code what do you find helpful getting the job done ?

Cheers

+1  A: 

It depends on which language you are using; if your language is supported by slime, there are the family of who commands: slime-who-calls, who-references, who-binds, calls-who, etc. They provide real, semantic based information, so are more reliable than regexp matching.

huaiyuan
+2  A: 

In CEDET, there is a symbol reference tool. By default it also uses find/grep in a project to find occurrence of a symbol. It is better to use GNU Global, IDUtils, or CScope instead to create a database in your project. You can then use semantic-symref-symbol which will then use gnu global or whatever to find all the references.

Once in symref list buffer, you can look through the hits. You can then select various hits and perform operations such as symbol rename, or the more powerful, execute macro on all the hits.

While there are more focused commands that could be made, the macro feature allows almost anything to happen for the expert user who understands Emacs keyboard macros well.

Eric
Hi Eric, so basically CEDET could provide a common architecture for referencing symbols which could be populated from more specialized packages depending on the language at hand ? If so, this sounds quite interesting !
julien
Read about it on your website, and I kinda have my answer now. However, I still wonder how this could be extended for using other tools, say slime which got mentionned in another answer... What would be the starting point here ?
julien
Yes. CEDET attempts to provide a generic interface between language specific solutions and more general interfaces. Thus, any specific code indexer for any particular language could be retrofitted into the 'symref' api in Semantic. After that, any tool using symref, such as the symref list mode I mention above can use it. Someone else could also implement some new tool that uses the symref API to do other things knowing it will work with a wide range of tools. If you look at semantic-symref-global.el it is a pretty basic example if you want to support slime.
Eric
Seems like CEDET is the way to go, has it would allow for language-agnostic semantics when defining refactorings like "move method to superclass" (well not the best example...). I've been procastrinating on getting into it for a while now, but it sounds like it's time to buckle up ! Thanks Eric for your answers and your awesome work.
julien
A: 

If you're editing lisp, I've found it useful (in general) to use the paredit.el package. Follow the link for documentation, and the video is a great introduction.

Trey Jackson