 
 (add-hook 'c-mode-common-hook
           (lambda()
-;            (set (make-local-variable 'ac-auto-start) nil)
-            ;; we'll define a special key event for yasnippet
-            ;; (setq ac-sources (remove 'ac-source-yasnippet ac-sources))
-            ;; (setq ac-sources (remove 'ac-source-gtags ac-sources))
-            (when (featurep 'rtags)
-              (add-to-list 'ac-sources 'ac-source-rtags)
-              )
-            (when (featurep 'auto-complete-clang)
-              (add-to-list 'ac-sources 'ac-source-clang)
-              (define-key c-mode-base-map [?\C-\M-i] 'ac-complete-clang)
+            (when rtags-exec
+              (add-to-list 'ac-sources 'ac-source-rtags))
+            (when clang-exec
+              (define-key c-mode-base-map [?\M-/] 'ac-complete-clang)
               ;; (add-to-list 'ac-omni-completion-sources
               ;;              (cons "\\." '(ac-source-clang)))
               ;; (add-to-list 'ac-omni-completion-sources

  (add-to-list 'completion-at-point-functions 'my/auto-complete-at-point))
(add-hook 'auto-complete-mode-hook 'my/add-ac-completion-at-point)


(ac-flyspell-workaround)
;(define-key ac-mode-map (kbd "M-/") 'auto-complete)
;(define-key ac-mode-map (kbd "<lwindow> TAB") 'auto-complete)
;; (define-key ac-mode-map (kbd "\C-c TAB") (lambda()(interactive)
;;                                            (setq ac-auto-start
;;                                                  (null ac-auto-start))))
;; rtags
(when (featurep 'rtags)
  (require 'rtags-ac)
  (setq rtags-completions-enabled t)
  (rtags-enable-standard-keybindings c-mode-base-map)

                ac-source-words-in-same-mode-buffers
                ac-source-filename
                ))
(setq ac-expand-on-auto-complete nil)
(setq ac-auto-start nil)
(setq ac-dwim nil)
