为 Emacs cscope 加入 Java 支持
source link: https://blog.yxwang.me/2013/01/java-and-aidl-support-in-emacs-cscope/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
为 Emacs cscope 加入 Java 支持
Wed, Jan 9, 2013 • Tooling
Emacs 的 xcscope 插件默认不会扫描 Java 文件,另外 Android 源码里有不少 .aidl 的文件,默认也不包含在 xcscope 的扫描范围里。解决这个问题的一个方法是在项目根目录下手动创建 cscope 索引:
$ find . -name "*.java" -or -name "*.aidl" -or -name "*.cpp" > cscope.files
$ cscope -b
这样做的缺点很明显,索引功能没有做到 Emacs 里,需要单独起一个 shell,比较麻烦。我发现这个问题的本质在于 xcscope 创建索引用的是 cscope-indexer 这个脚本,而 cscope-indexer 默认只会扫描 C/C++ 的源码文件。所以其实只要修改 cscope-indexer,把第 140 行从原来的
egrep -i '\.([chly](xx|pp)*|cc|hh)$' | \
egrep -i '\.([chly](xx|pp)*|cc|hh|java|aidl)$' | \
之后就能用 C-c s I
在 Emacs 中创建 Android 项目的索引了。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK