设置自动完成与语义工作 [英] Setting up autocomplete to work with semantic

查看:100
本文介绍了设置自动完成与语义工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在Emacs自动完成包装的一个问题。目前,我有和适当自动完成运行CEDET,但自动完成包装有一些怪异的行为。它不使用语义的(参议员?)数据库中,直到我明确地参观包括文件,并进行C-U M-X bovinate。然后,我可以返回到源文件并自动完成的完成列表将完全相同看起来语义的之一。

I have a problem with auto-complete package in Emacs. Currently I have up and running cedet with proper autocompletion, but auto-complete package has some weird behaviour. It doesn't use semantic's (senator's?) database until I explicitly visit include file and make "C-u M-x bovinate". Then I can return to the source file and auto-complete's completion list will look exactly as the semantic's one.

另外一点是,如果我修改我的源文件,例如,在C ++ - 模式,并尝试bovinate头在C模式下,自动完成不会得到它的完成列表中的任何附加分。

Another point is if I edit my source file, for example, in c++-mode and try to "bovinate" header in c-mode, auto-complete won't get any additional points in it's completion list.

任何想法如何让系统自动完成的工作?

Any ideas how to get auto-complete work automatically?

我的.emacs文件(其主体部分是从亚历克斯奥特的文章

My .emacs file is (Major parts of it were taken from Alex Ott's article)

(load "~/.emacs.d/cedet/cedet-devel-load.el")
(add-to-list 'semantic-default-submodes 'global-semanticdb-minor-mode)
(add-to-list 'semantic-default-submodes 'global-cedet-m3-minor-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-mru-bookmark-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-local-symbol-highlight-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-scheduler-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-completions-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-summary-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-decoration-mode)

(require 'semantic/ia)
(semantic-mode 1)

(require 'semantic/bovine/gcc)

(semantic-add-system-include "/usr/include/mpi/" 'c++-mode)

;; ;; Imenu integration
(defun my-semantic-hook ()
  (imenu-add-to-menubar "TAGS"))
(add-hook 'semantic-init-hooks 'my-semantic-hook)

;; Class suggest improvement
(defun my-c-mode-cedet-hook ()
 (local-set-key "." 'semantic-complete-self-insert)
 (local-set-key ">" 'semantic-complete-self-insert))
(add-hook 'c-mode-common-hook 'my-c-mode-cedet-hook)

;;;; Semantic and auto-config integration
(require 'auto-complete-config)
(ac-config-default)
(add-to-list 'ac-dictionary-directories "/home/zvord/.emacs.d/ac-dict")
(define-key ac-mode-map [(meta return)] 'auto-complete)

(defun my-cedet-hook ()
  (add-to-list 'ac-sources 'ac-source-semantic))
(add-hook 'c-mode-common-hook 'my-cedet-hook)

这是所有我读过这应该是足以让自动完成的工作,但事实并非如此。

From all I've read this should be enough to get auto-complete work, but it isn't.

推荐答案

尝试改变:

(defun函数我-CEDET挂机()
    (添加到列表AC-来源AC-源语义))

(defun my-cedet-hook () (add-to-list 'ac-sources 'ac-source-semantic))

(defun函数我-CEDET挂机()
    (添加到列表AC-来源AC-源语义原料))

(defun my-cedet-hook () (add-to-list 'ac-sources 'ac-source-semantic-raw))

它应该工作。

这篇关于设置自动完成与语义工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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