开发者

What are some useful emacs functions for refactoring?

开发者 https://www.devze.com 2023-01-15 19:13 出处:网络
For now I\'ve stuck with multi开发者_开发知识库-occur-in-matching-buffers and rgrep, which, while powerful, is still pretty basic I guess.

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


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消