[英]Emacs auto-complete not displaying results
I am running the most recent version of auto-complete
in elpa
with the new stable release of Emacs (24.3) in Linux. 我正在使用Linux中新版本的Emacs(24.3)运行
elpa
最新版本的auto-complete
。 I have the following setup on my Emacs init file. 我在Emacs init文件上进行了以下设置。
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
(require 'auto-complete-config)
(setq-default ac-sources
'(
ac-source-filename
ac-source-abbrev
ac-source-dictionary
ac-source-words-in-same-mode-buffers))
(ac-config-default)
If I start typing: /home/james/.em
in a buffer (eg a Python buffer) I would expect auto-complete to suggest: 如果我开始在缓冲区 (例如Python缓冲区)中输入:
/home/james/.em
,我希望自动完成建议:
.emacs
.emacs.d
but it does not show anything. 但它没有显示任何东西。 The same thing happens with other files.
其他文件也会发生同样的事情。
Sometimes I do see suggestions and/or the pop-up menu shows up, but other times it doesn't. 有时我会看到建议和/或弹出菜单显示,但有时则不会。
Any thoughts why? 有什么想法?
ac-config-default
sets a list of sources that does not include ac-source-filename. ac-config-default
设置不包含ac-source-filename的源列表。 By calling this function after setq-default ac-sources
you are resetting them back to the defaults. 通过在
setq-default ac-sources
之后调用此函数,您可以将它们重置为默认值。 The auto-complete manual suggests setting mode-hooks to set up the desired sources for specific modes. 自动完成手册建议设置模式挂钩以设置特定模式的所需源。 The example from the manual is
手册中的例子是
(defun my-ac-emacs-lisp-mode ()
(setq ac-sources '(ac-source-symbols ac-source-words-in-same-mode-buffers)))
(add-hook 'emacs-lisp-mode-hook 'my-ac-emacs-lisp-mode)
Adapting this to python-mode should be easy enough. 将其改编为python-mode应该很容易。 Alternatively you can globally override the settings set by
ac-config-default
by calling it first, ie 或者,您可以通过首先调用它来全局覆盖
ac-config-default
设置的设置,即
(require 'auto-complete-config)
(ac-config-default)
(setq-default ac-sources
'(
ac-source-filename
ac-source-abbrev
ac-source-dictionary
ac-source-words-in-same-mode-buffers))
That way setq-default ac-sources
will override the sources set by ac-config-default
rather than the other way around. 这样
setq-default ac-sources
将覆盖ac-config-default
设置的源,而不是相反。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.