< p > Emacs Wiki说:
< blockquote >
我需要把修复代码放在YASnippet的.el文件中吗?还是放在我的.emacs文件中(这会导致错误)?
Company会干扰Yasnippet的本地行为。这里是一个快速修复方法:http://gist.github.com/265010
代码如下:
(define-key company-active-map "\t" 'company-yasnippet-or-completion)
(defun company-yasnippet-or-completion ()
(interactive)
(if (yas/expansion-at-point)
(progn (company-abort)
(yas/expand))
(company-complete-common)))
(defun yas/expansion-at-point ()
"Tested with v0.6.1. Extracted from `yas/expand-1'"
(first (yas/current-key)))
我将那段代码放到了我的.emacs文件中,出现了以下信息:
Warning (initialization): An error occurred while loading `c:/Documents and Settings/Alex.AUTOINSTALL.001/Application Data/.emacs.elc':
Symbol's value as variable is void: company-active-map
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
我需要把修复代码放在YASnippet的.el文件中吗?还是放在我的.emacs文件中(这会导致错误)?
yasnippet
的作者,我可以确认这是API的合法使用,而之前的代码则不是。 - joao