在emacs中寻求自动完成功能 [英] seeking autocomplete functionality in emacs

查看:173
本文介绍了在emacs中寻求自动完成功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个插件做自动完成弹出窗口的c ++开发在emacs。我尝试过的是Cedet语义和自动填充模式,他们在完成变量方面非常整齐和函数名,只要我已经有几个字。例如,我有一个类foo和一个函数返回一个整数1

I am seeking a plugin to do autocompletion popup for c++ development in emacs. what I have tried are Cedet Semantics and the Autocompletion mode, they are pretty neat in terms of completing the variable and function names as long as I have a few words already. For example, I have a class named foo and a function that returns an integer 1

class foo{
   int getInt(){return 1};
};

在main方法中,只要我开始输入

In the main method, so long as I started typing this

int main(){
 foo bar;
 bar.get...
}

这些插件没有问题像bar.getInt()这样的建议。然而,我真正想要的是类似于Eclipse,只要我按点,可能的选择可以为我生成。这是可能在Emacs?感谢

the plugins have no problem popping up suggestions like bar.getInt(). However, what I am really looking for is something like in Eclipse, as soon as I press the "dot", possible choices could be generated for me. Is that possible in Emacs? Thanks

推荐答案

这取决于您的设置自动完成& CEDET。看起来自动完成设置仅在输入几个字符后才显示可能的完成。您可以检查 ac-auto-start 变量的值 - 如果这是一个数字,则在此字符数后调用自动完成。另一个重要的事情是你的 ac-sources 变量 - 对于使用CEDET,你需要使用 ac-source-semantic -raw ac-source-semantic 完成源。
要在 - > 后自动完成,可以尝试使用Semantic的内置完成例如:

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)

PS如果您看到我关于CEDET& C ++

这篇关于在emacs中寻求自动完成功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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