Emacs的自动完成模式启动 [英] Emacs auto-complete-mode at startup

查看:159
本文介绍了Emacs的自动完成模式启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装自动完成模式,但是每次我启动Emacs我不得不M-X自动完成模式。反正是有拥有它自动加载?

I just install auto-complete-mode, however everytime I start emacs I have to M-x auto-complete-mode. Is there anyway to have it loaded automatically ?

我的.emacs如下:

My .emacs is as follows:

;; auto-complete
(add-to-list 'load-path "~/.emacs.d/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")
(ac-config-default)

感谢

推荐答案

我觉得你可以以不同的方式做到这一点。要全局启用它,你应该使用

I think you can do it in various ways. To enable it globally you should use

(global-auto-complete-mode t)

但它使用自动完成模式,也许,这把AC上只有那些在上市交流方式。您可以手动添加它们就这样

But it uses auto-complete-mode-maybe, which turn AC on only those listed in ac-modes. You can add them manually just like this

(add-to-list 'ac-modes 'sql-mode)

您可以让自己的列表,如果你想交流活跃只为少数模式

You can make your own list if you wish AC be active only for few modes

(setq ac-modes '(c++-mode sql-mode))

或重写它有交流无处不在。

Or rewrite it to have AC everywhere.

(defun auto-complete-mode-maybe ()
  "No maybe for you. Only AC!"
  (auto-complete-mode 1))

编辑:

在自动完成小缓冲区是坏的。我认为这将是更好的。

Autocomplete in minibuffer is bad. I think this will be better.

(defun auto-complete-mode-maybe ()
  "No maybe for you. Only AC!"
  (unless (minibufferp (current-buffer))
    (auto-complete-mode 1)))

这篇关于Emacs的自动完成模式启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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