Emacs/CEDET。多个项目和代码完成
我已经使用 CEDET 1.0 和 ECB 2.40 设置了 emacs 23.1.50.1 (很大程度上受到 Alex Otts 设置的启发,位于 http://github.com/alexott/emacs-configs/blob/master/rc/emacs-rc-cedet.el 以及他对 Cedet 的温和介绍( http://alexott.net/en/writings/emacs-devenv/EmacsCedet。 html ),谢谢亚历克斯)。它工作得很好,但我需要更多地了解在处理多个项目时如何处理代码完成和符号引用。
我创建了一个简单的 ede 项目,如下所示:
(ede-cpp-root-project "test"
:file "~/src/sw/anchor"
:include-path '("/Common")
:system-include-path '("~/include"))
当加载此项目时,Semantic 只会在项目配置中指定的各个目录中查找补全吗?
有几个奇怪的地方:
当我尝试打开一个新的源文件时,出现错误“应用:搜索程序:没有这样的文件或目录,全局”并且没有任何反应。如果我尝试再次打开它,一切都会很好。
当我尝试通过指向锚文件来加载项目时,出现此错误:“if:错误的类型参数:class-p,ede-cpp-root”
I've setup emacs 23.1.50.1 with CEDET 1.0 and ECB 2.40 (heavily inspired by Alex Otts setup at http://github.com/alexott/emacs-configs/blob/master/rc/emacs-rc-cedet.el and his gentle introduction to Cedet ( http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html ), thanks Alex). It works quite well, but I need more understanding about how code-completion and symbol-references are handled when working with multiple projects.
I've created a simple ede project like this:
(ede-cpp-root-project "test"
:file "~/src/sw/anchor"
:include-path '("/Common")
:system-include-path '("~/include"))
When this project is loaded, will Semantic only look for completions in the various directories specified in the project configurations?
I followed http://mmmyddd.freeshell.net/blog/Computer/Emacs/usecscopesemanticdbbackend to use cscope as backend for semanticdb. I can run semanticdb-enable-cscope-in-buffer without emacs throwing any errors, but I have no idea if semantic uses my database. Can I add a reference to a cscope.out in my project-definition as well, to have more control over which files to search for references in my current context?
A couple of oddities:
When I try to open a new source file I get the error "apply: Searching for program: no such file or directory, global" and nothing happens. If I try to open it again, everything is fine.
When I try to load a project by pointing at the anchor file, I get this error: "if: Wrong type argument: class-p, ede-cpp-root"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您的配置出现错误时,最好的做法是:
获取指向问题区域的堆栈跟踪。通常这有助于识别配置问题。
CEDET 将尝试将每个文件与单个项目相关联,并且在该缓冲区中操作的所有命令都将限制在该项目的范围内。对于 CScope 支持,它也将使用 EDE 来识别根目录,这将有助于查找 cscope.out 文件,这与完成工具和参考工具相关。
当然,例外的是系统包含路径,通常是 /usr/include 或其他路径。这是对默认系统包含路径的增强,该路径是通过 GCC 支持计算的。在您的 C 文件之一中,您可以执行以下操作:
这应该显示 Semantic 将尝试使用的内容。
要仔细检查 CScope 是否用于代码完成,您可以使用:进行检查
,并检查列表末尾是否有 CScope 内容。
When you get errors in your configuration, the best thing to do is:
and get the stack trace which will point at the problem area. Often times that is helpful in identifying the configuration issue.
CEDET will try to associate every file with a single project, and all the commands that operate in that buffer will be restricted to the bounds of that project. For the CScope support, it too will use EDE to identify the root directory, and that will help find the cscope.out file, and that is related to both the completion and reference tools.
The exception, of course, is the system include path which is usually /usr/include or whatever. This is an augmentation to the default system include path which is calculated with the GCC support. In one of your C files you can do:
and that should show what Semantic will try to use.
To double check if CScope is being used for code completion, you can check with:
and check the end of the list for some CScope thing.