Friday, December 28, 2007

emacs 代码导航

emacs 自带的 ctags 不支持 ruby,安装 exuberant-ctags 提供 ruby 语言支持。

aptitude install exuberant-ctags

生成 TAGS

ctags -e -R ~/www/mephisto/

使用 tags 代码导航 copy 自 exuberant-ctags manpage:

HOW TO USE WITH GNU EMACS
       Emacs  will,  by default, expect a tag file by the name "TAGS" in the current directory. Once the tag file is built, the following commands exercise the tag indexing
       feature:

       M-x visit-tags-table  FILE 
                 Select the tag file, "FILE", to use.

       M-. [TAG] 
                 Find the first definition of TAG. The default tag is the identifier under the cursor.

       M-*       Pop back to where you previously invoked "M-.".

       C-u M-.   Find the next definition for the last tag.

       For more commands, see the Tags topic in the Emacs info document.

works almost great!

No comments:

Post a Comment