我在 X86_64-pc-gnu-linux (ubuntu 10.04) 上使用 emacs 23.1.1 并按照著名的链接http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html将所有配置添加到 .emacs。但它甚至不能完成基本的工作。我的设置或配置一定有问题。
如果我试图让它显示成员函数,它就无法找到。[自动完成使用clang作为解析器。那么解析器语义使用什么?]
;; Load CEDET
(load-file "~/backup/cedet-trunk/common/cedet.el")
(global-ede-mode 1)
;(semantic-load-enable-code-helpers)
(semantic-load-enable-excessive-code-helpers)
;(semantic-load-enable-semantic-debugging-helpers)
(global-srecode-minor-mode 1)
(global-semantic-tag-folding-mode 1)
(require 'semantic-tag-folding)
(global-semantic-idle-scheduler-mode 1)
(global-semantic-idle-completions-mode 1)
(global-semantic-idle-summary-mode 1)
(global-semantic-idle-completions-mode)
(require 'semantic-ia)
(require 'eassist)
(require 'semantic-gcc)
(require 'semanticdb-global)
(semanticdb-enable-gnu-global-databases 'c-mode)
(semanticdb-enable-gnu-global-databases 'c++-mode)
(setq qt4-base-dir "/usr/include/qt4")
(setq qt4-gui-dir (concat qt4-base-dir "/QtGui"))
(setq qt4-core-dir (concat qt4-base-dir "/QtCore"))
(semantic-add-system-include qt4-base-dir 'c++-mode)
(semantic-add-system-include qt4-gui-dir 'c++-mode)
(semantic-add-system-include qt4-core-dir 'c++-mode)
(add-to-list 'auto-mode-alist (cons qt4-base-dir 'c++-mode))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat qt4-base-dir
"/Qt/qconfig.h"))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat qt4-base-dir "/Qt/qconfig-large.h"))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat qt4-base-dir "/Qt/qglobal.h"))
(defun my-cedet-hook ()
(local-set-key [(control return)] 'semantic-ia-complete-symbol-menu)
(local-set-key "\C-c?" 'semantic-ia-complete-symbol)
(local-set-key "\C-c>" 'semantic-complete-analyze-inline)
(local-set-key "\C-c=" 'semantic-decoration-include-visit)
(local-set-key "\C-cj" 'semantic-ia-fast-jump)
(local-set-key "\C-cb" 'semantic-mrub-switch-tags)
(local-set-key "\C-cd" 'semantic-ia-show-doc)
(local-set-key "\C-cs" 'semantic-ia-show-summary)
(local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle)
(local-set-key "\C-cr" 'semantic-symref)
(local-set-key "\C-c\-" 'senator-fold-tag)
(local-set-key "\C-c\+" 'senator-unfold-tag)
)
(add-hook 'c-mode-common-hook 'my-cedet-hook)
(add-hook 'lisp-mode-hook 'my-cedet-hook)
(add-hook 'emacs-lisp-mode-hook 'my-cedet-hook)
(ede-cpp-root-project "Test"
:name "Test Project"
:file "~/project/shared/test-qt-semantic.cpp"
:include-path '("/"
)
:system-include-path '("/usr/include/qt4"
"/usr/include/qt4/Qt"
"/usr/include/qt4/QtGui"
"/usr/include/qt4/QtCore"
))
这是源文件:
#include <QApplication>
#include <QPushButton>
#include <QString>
int main (int argc, char ** argv)
{
QApplication app (argc, argv);
QPushButton hello ("Hello, World!");
hello.resize (100, 30);
hello.show ();
QString id("hi");
return app.exec ();
}
找不到“class QPushButton hello ()”的数据类型。
声明的类型是:"class QPushButton {}"
原始数据类型是:("QPushButton" type (:type "class") nil nil)Semantic 在其任何全局表中都找不到此数据类型。
语义通过本地范围或全局类型缓存定位数据类型。
本地范围信息:
* 针对范围的标记类约束:(类型)
* 当前范围内没有已知的父级。
* 目前范围内没有已知符号。
* 没有本地声明的已知符号。
Semantic 为每个缓冲区创建并维护一个类型缓存。
如果类型是全局类型,那么它应该出现在它们的 typecache 中。
要检查类型缓存,请键入:Mx semanticdb-typecache-dump RET [做它]
当前类型缓存统计信息:
此文件中的 0 种全局
类型 0 种来自包含的类型。如果数据类型不在类型缓存中,则您的包含路径可能不正确。
包括路径摘要:
此文件的项目包含搜索由 EDE 对象处理:
缓冲区目标:#ede-cpp-root-target /home/mike/project/shared/>
缓冲区项目:#ede-cpp-root-project 测试>
备份定位器:# ede-locate-base Loc>系统包含路径为:
/usr/include/qt4/ /usr/include/qt4/QtGui/ /usr/include/qt4/QtCore/ /usr/include/c++/4.4/ /usr/include/c++/4.4/x86_64-linux-gnu/ /usr/include/c++/4.4/backward/ /usr/local/include/ /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/ /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include-fixed/ /usr/include/
包括摘要:/home/mike/project/shared/test-qt-semantic.cpp
test-qt-semantic.cpp 包含 3 个包含。
未知包含: 0 未解析包含
:0
已解析包含:3
无未知包含。