让 emacs cedet 语义查找包含目录

发布于 2024-11-27 10:22:22 字数 520 浏览 2 评论 0原文

Cedet 是一个不错的工具套件,但在默认配置下,它很难找到包含的文件。

我想让它在每个父目录中查找名为 include/ 的目录并从那里获取文件。

例如,文件 /home/fakedrake/my-project/some-thing/something-else/file.c 具有 #include "file.h" file.h 位于 some-thing/file.h 中,但 cedet 无法找到它

如果让 cedet 查找 file.h 以在目录中创建补全,那就太棒了

/home/fakedrake/my-project/some-thing/include/
/home/fakedrake/my-project/include/

(如果它试图查找,我可以接受它)

/include/
/home/include/
/home/fakedrake/include/ 

Cedet is a nice tool suite but in default configuration it has some difficulty locating included files.

I would like to make it look for a directory called include/ in each parent directory and get the file from there.

for examplme a file /home/fakedrake/my-project/some-thing/something-else/file.c has #include "file.h"
file.h is in some-thing/file.h but cedet fails to locate it

What would be awesome would be to make cedet look for file.h to create completions in directories

/home/fakedrake/my-project/some-thing/include/
/home/fakedrake/my-project/include/

( and i could live with it if it tried to look for

/include/
/home/include/
/home/fakedrake/include/ 

)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

尘世孤行 2024-12-04 10:22:22

您可以使用 EDE 来实现。此外,它允许您为特定项目指定不同的包含路径。 EDE 是 Cedet 的一部分,因此您无需安装任何东西。

基本设置是:

(global-ede-mode t)

然后对于每个项目,您应该有类似的内容:

(if (file-exists-p "~/dev/chanconf/Makefile")
    (ede-cpp-root-project "chanconf"
                          :name "Channel Config"
                          :file "~/dev/chanconf/Makefile"
                          :system-include-path '("/usr/include"
                                                 "/usr/include/boost")
                          :include-path '("/src"
                                          "/test/gtest/include")
                          :spp-table '(("BOOST_PROGRAM_OPTIONS_DECL" . ""))))

这并不完全是您所要求的,因为您仍然必须列出所有包含目录。但通常每个项目只需要完成一次,不需要太多的努力,所以我希望它有所帮助。

Alex Ott 撰写的关于 Cedet 的文章是一个很好的来源如果您需要更多想法。

You can use EDE for it. Moreover, it allows you to specify different include paths for particular projects. EDE is a part of Cedet, so you needn't install anything.

The basic setup is:

(global-ede-mode t)

Then for each project you should have something like that:

(if (file-exists-p "~/dev/chanconf/Makefile")
    (ede-cpp-root-project "chanconf"
                          :name "Channel Config"
                          :file "~/dev/chanconf/Makefile"
                          :system-include-path '("/usr/include"
                                                 "/usr/include/boost")
                          :include-path '("/src"
                                          "/test/gtest/include")
                          :spp-table '(("BOOST_PROGRAM_OPTIONS_DECL" . ""))))

It's not exactly what you're asking for since you still have to list all the include directories. But usually it's done only one time per project and doesn't require too much effort, so I hope it helps.

An article on Cedet by Alex Ott is a pretty good source of ideas if you need more.

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