Emacs wiki说:
公司的确干预了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中(这会给我带来错误)?
发布于 2015-02-14 00:23:16
你提到的片段无论如何都不起作用了。
下面是您可以使用的代码片段:
(defun company-yasnippet-or-completion ()
(interactive)
(let ((yas-fallback-behavior nil))
(unless (yas-expand)
(call-interactively #'company-complete-common))))若要确保调用它而不是company-complete-common,请使用
(add-hook 'company-mode-hook (lambda ()
(substitute-key-definition 'company-complete-common
'company-yasnippet-or-completion
company-active-map)))背景:这在本地更改了yas-fallback-behaviour的值,如果没有找到完成,就会导致yas调用company-complete-common。
发布于 2010-01-18 16:11:50
这听起来像是负载路径的问题。符号值是空的,意味着emacs找不到它的定义--很可能是因为包含其定义的文件还没有加载。
您可以尝试在.emacs中添加类似的内容(在导致错误的代码之前):
;; where ~/.emacs.d/ is the path to a directory containing
;; additional library code you want emacs to load
(add-to-list 'load-path "~/.emacs.d/")https://stackoverflow.com/questions/2087225
复制相似问题