Emacs/CEDET。多个项目和代码完成

发布于 2024-09-28 10:30:45 字数 1316 浏览 8 评论 0原文

我已经使用 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 只会在项目配置中指定的各个目录中查找补全吗?

我关注了 http://mmmyddd.freeshell.net/blog/Computer/Emacs/usecscopesemanticdbbackend< /a> 使用 cscope 作为语义数据库的后端。我可以运行semanticdb-enable-cscope-in​​-buffer,而emacs不会抛出任何错误,但我不知道semantic是否使用我的数据库。我是否可以在项目定义中添加对 cscope.out 的引用,以便更好地控制在当前上下文中搜索引用的文件?

有几个奇怪的地方:

当我尝试打开一个新的源文件时,出现错误“应用:搜索程序:没有这样的文件或目录,全局”并且没有任何反应。如果我尝试再次打开它,一切都会很好。

当我尝试通过指向锚文件来加载项目时,出现此错误:“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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤凫 2024-10-05 10:30:45

当您的配置出现错误时,最好的做法是:

M-x toggle-debug-on-error RET

获取指向问题区域的堆栈跟踪。通常这有助于识别配置问题。

CEDET 将尝试将每个文件与单个项目相关联,并且在该缓冲区中操作的所有命令都将限制在该项目的范围内。对于 CScope 支持,它也将使用 EDE 来识别根目录,这将有助于查找 cscope.out 文件,这与完成工具和参考工具相关。

当然,例外的是系统包含路径,通常是 /usr/include 或其他路径。这是对默认系统包含路径的增强,该路径是通过 GCC 支持计算的。在您的 C 文件之一中,您可以执行以下操作:

M-x semantic-c-describe-environment RET

这应该显示 Semantic 将尝试使用的内容。

要仔细检查 CScope 是否用于代码完成,您可以使用:进行检查

M-x semanticdb-find-test-translate-path RET

,并检查列表末尾是否有 CScope 内容。

When you get errors in your configuration, the best thing to do is:

M-x toggle-debug-on-error RET

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:

M-x semantic-c-describe-environment RET

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:

M-x semanticdb-find-test-translate-path RET

and check the end of the list for some CScope thing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文