seeking autocomplete functionality in emacs

匆匆过客 提交于 2019-12-05 09:51:19

It depends on your settings of auto-complete & CEDET. It looks like that auto-complete is setup to show possible completions only after several characters will be typed. You can check value of the ac-auto-start variable - if this is a number, then auto-complete will be called after this number of characters. Another important thing is a what is in your ac-sources variable - for work with CEDET you need to use ac-source-semantic-raw or ac-source-semantic completion source. To automatic completion after . or -> you can try to use Semantic's built-in completion with something like:

(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)

P.S. Had you seen my article on CEDET & C++?

I have found that cedet is really underwhelming, especially under cmake projects.

I would recommend using https://github.com/Andersbakken/rtags It underlines errors as you type as well as using smart completions. Just add this to your init file after obtaining the required emacs packages

(require 'rtags)
(require 'popup)
(require 'rtags-ac)
(setq rtags-completions-enabled t)
(rtags-enable-standard-keybindings c-mode-base-map)
(add-hook 'c++-mode-hook
          (lambda ()
            (setq ac-sources '(ac-source-rtags)
)))
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!