Skip to content

Instantly share code, notes, and snippets.

@Kanasansoft
Created September 24, 2010 17:01
Show Gist options
  • Save Kanasansoft/595678 to your computer and use it in GitHub Desktop.
Save Kanasansoft/595678 to your computer and use it in GitHub Desktop.
;;from http://www.emacswiki.org/emacs/AutoComplete
(require 'auto-complete)
(require 'yasnippet)
(defun ac-yasnippet-candidate ()
(let ((table (yas/get-snippet-tables major-mode)))
(if table
(let (candidates (list))
(mapcar (lambda (mode)
(maphash (lambda (key value)
(push key candidates))
(yas/snippet-table-hash mode)))
table)
(all-completions ac-prefix candidates)))))
(defface ac-yasnippet-candidate-face
'((t (:background "sandybrown" :foreground "black")))
"Face for yasnippet candidate.")
(defface ac-yasnippet-selection-face
'((t (:background "coral3" :foreground "white")))
"Face for the yasnippet selected candidate.")
(defvar ac-source-yasnippet
'((candidates . ac-yasnippet-candidate)
(action . yas/expand)
(limit . 3)
(candidate-face . ac-yasnippet-candidate-face)
(selection-face . ac-yasnippet-selection-face))
"Source for Yasnippet.")
(provide 'auto-complete-yasnippet)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment