     (candidates . ac-imenu-candidate))
   "Source for imenu.")
 
-(defun ac-yasnippet-candidate-1 (table)
-  (let ((hashtab (yas/snippet-table-hash table))
-        (parent (yas/snippet-table-parent table))
-        candidates)
-    (maphash (lambda (key value)
-               (push key candidates))
-             hashtab)
-    (setq candidates (all-completions ac-prefix (nreverse candidates)))
-    (if parent
-        (setq candidates
-              (append candidates (ac-yasnippet-candidate-1 parent))))
-    candidates))
-
-(defun ac-yasnippet-candidate ()
-  (when (require 'yasnippet nil t)
-    (let ((table (yas/snippet-table major-mode)))
-      (if table
-          (ac-yasnippet-candidate-1 table)))))
-
-(defface ac-yasnippet-menu-face
-  '((t (:background "sandybrown" :foreground "black")))
-  "Face for yasnippet candidate menu."
-  :group 'auto-complete)
-
-(defface ac-yasnippet-selection-face
-  '((t (:background "coral3" :foreground "white")))
-  "Face for the yasnippet selected candidate."
-  :group 'auto-complete)
-
-(defvar ac-source-yasnippet
-  '((candidates . ac-yasnippet-candidate)
-    (action . yas/expand)
-    (limit . 3)
-    (menu-face . ac-yasnippet-menu-face)
-    (selection-face . ac-yasnippet-selection-face))
-  "Source for Yasnippet.")
-
-(when (require 'rcodetools nil t)
-  (defvar ac-source-rcodetools
-    `((init . (lambda ()
-                (condition-case x
-                    (rct-exec-and-eval rct-complete-command-name "--completion-emacs-icicles")
-                  (error) (setq rct-method-completion-table nil))))
-      (candidates . (lambda ()
-                      (all-completions
-                       ac-prefix
-                       (mapcar
-                        (lambda (completion)
-                          (replace-regexp-in-string "\t.*$" "" (car completion)))
-                        rct-method-completion-table)))))))
+(defmacro ac-define-dictionary-source (name list)
+  "Define dictionary source named `NAME'.
+`LIST' is a list of string.
+This is useful if you just want to define a dictionary/keywords source."
+  `(defvar ,name
+     '((candidates . (lambda () (all-completions ac-prefix ,list))))))
 
  

    (ac-deactivate-mode-map))
  (ac-redraw-candidates))

(defun ac-propertize-candidate (candidate &rest properties)
  (apply 'propertize candidate properties))


  '((candidates . ac-filename-candidate))
  "Source for completing file name.")

(defvar ac-imenu-index nil
  "Imenu index.")

