About the fix for the interference between Company mode and Yasnippet

Posted by janoChen on Stack Overflow See other posts from Stack Overflow or by janoChen
Published on 2010-01-18T15:49:15Z Indexed on 2010/05/20 22:30 UTC
Read the original article Hit count: 272

Filed under:
|

Emacs wiki says:

Company does interfere with Yasnippet’s native behaviour. Here’s a quick fix: http://gist.github.com/265010

The code is the following:

(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)))

I placed that code in my .emacs and the following message appeared:

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.

Do I have to place the fix code inside a YASnippet's .el file? or in my .emacs (which throws me an error)?

© Stack Overflow or respective owner

Related posts about emacs

Related posts about plugin