Emacs的/ CEDET。多个项目和代码完成 [英] Emacs/CEDET. Multiple projects and code completion

查看:217
本文介绍了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 ),谢谢Alex)。它工作得很好,但是我需要更多的了解在使用多个项目时如何处理代码完成和符号引用。



我创建了一个简单的ede项目像这样:

 (ede-cpp-root-projecttest
:file〜/ src / sw /
:include-path(/ Common)
:system-include-path'(〜/ include))
pre>

当此项目加载时,语义只会在项目配置中指定的各种目录中查找完成?



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



A几个怪物:



当我尝试打开一个新的源文件时,我收到错误apply:搜索程序:没有这样的文件或目录,全局,没有任何反应。如果我尝试重新打开它,一切都很好。



当我尝试通过指向锚文件加载项目时,我得到这个错误:if:Wrong类型参数:class-p,ede-cpp-root

解决方案

当您在配置中出现错误时,做是:

  Mx toggle-debug-on-error RET 

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



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



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

  Mx语义c描述环境RET 

,这应该显示Semantic将尝试使用。



检查CScope是否用于代码完成,您可以检查:

  Mx semanticdb-find-test-translate-path RET 

并检查列表的结尾是否有一些CScope的东西。


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"

解决方案

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.

这篇关于Emacs的/ CEDET。多个项目和代码完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆