(eval-when-compile (require 'cl)) (require 'auto-complete) ;;;; Emacs Lisp sources (defvar ac-emacs-lisp-features nil) (defvar ac-source-emacs-lisp-features '((init . (lambda () (unless ac-emacs-lisp-features (let ((suffix (concat (regexp-opt (find-library-suffixes) t) "\\'"))) (setq ac-emacs-lisp-features (delq nil (apply 'append (mapcar (lambda (dir) (if (file-directory-p dir) (mapcar (lambda (file) (if (string-match suffix file) (substring file 0 (match-beginning 0)))) (directory-files dir)))) load-path)))))))) (candidates . (lambda () (all-completions ac-prefix ac-emacs-lisp-features))))) (defun ac-emacs-lisp-features-setup () (push 'ac-source-emacs-lisp-features ac-sources) (push '("require\s+'" ac-source-emacs-lisp-features) ac-omni-completion-sources)) (defun ac-emacs-lisp-features-initialize () (require 'find-func) (add-hook 'emacs-lisp-mode-hook 'ac-emacs-lisp-features-setup) t) ;;;; C++ sources (ac-define-dictionary-source ac-source-c++-keywords '("and" "bool" "compl" "do" "export" "goto" "namespace" "or_eq" "return" "struct" "try" "using" "xor" "and_eq" "break" "const" "double" "extern" "if" "new" "private" "short" "switch" "typedef" "virtual" "xor_eq" "asm" "case" "const_cast" "dynamic_cast" "false" "inline" "not" "protected" "signed" "template" "typeid" "void" "auto" "catch" "continue" "else" "float" "int" "not_eq" "public" "sizeof" "this" "typename" "volatile" "bitand" "char" "default" "enum" "for" "long" "operator" "register" "static" "throw" "union" "wchar_t" "bitor" "class" "delete" "explicit" "friend" "mutable" "or" "reinterpret_cast" "static_cast" "true" "unsigned" "while")) (defun ac-c++-keywords-setup () (push 'ac-source-c++-keywords ac-sources)) (defun ac-c++-keywords-initialize () (add-hook 'c++-mode-hook 'ac-c++-keywords-setup) t) ;;;; CSS sources ;; http://www.w3.org/TR/CSS2/css2.txt (defvar ac-css-property-table '(("margin-top" "" "inherit") ("margin-bottom" "" "inherit") ("margin-left" "" "inherit") ("margin-right" "" "inherit") ("margin" "" "inherit") ("padding-top" "" "inherit") ("padding-right" "" "inherit") ("padding-bottom" "" "inherit") ("padding-left" "" "inherit") ("padding" "" "inherit") ("border-top-width" "" "inherit") ("border-right-width" "" "inherit") ("border-bottom-width" "" "inherit") ("border-left-width" "" "inherit") ("border-width" "" "inherit") ("border-top-color" "" "transparent" "inherit") ("border-right-color" "" "transparent" "inherit") ("border-bottom-color" "" "transparent" "inherit") ("border-left-color" "" "transparent" "inherit") ("border-color" "" "transparent" "inherit") ("border-top-style" "" "inherit") ("border-right-style" "" "inherit") ("border-bottom-style" "" "inherit") ("border-left-style" "" "inherit") ("border-style" "" "inherit") ("display" "inline" "block" "list-item" "run-in" "inline-block" "table") ("position" "static" "relative" "absolute" "fixed" "inherit") ("top" "" "" "auto" "inherit") ("right" "" "" "auto" "inherit") ("bottom" "" "" "auto" "inherit") ("left" "" "" "auto" "inherit") ("float" "left" "right" "none" "inherit") ("clear" "none" "left" "right" "both" "inherit") ("z-index" "auto" "" "inherit") ("direction" "ltr" "rtl" "inherit") ("unicode-bidi" "normal" "embed" "bidi-override" "inherit") ("width" "" "" "auto" "inherit") ("max-width" "" "" "inherit") ("min-width" "" "" "inherit") ("max-width" "" "" "none" "inherit") ("height" "" "" "auto" "inherit") ("min-height" "" "" "inherit") ("max-height" "" "" "none" "inherit") ("line-height" "normal" "" "" "" "inherit") ("vertical-align" "baseline" "sub" "super" "top" "text-top" "middle" "bottom") ("overflow" "visible" "hidden" "scroll" "auto" "inherit") ("clip" "" "auto" "inherit") ("visibility" "visible" "hidden" "collapse" "inherit") ("content" "normal" "none" "" "" "") ("quotes" "" "none" "inherit") ("counter-reset" "" "" "none" "inherit") ("counter-increment" "" "" "none" "inherit") ("list-style-type" "disc" "circle" "square" "decimal" "decimal-leading-zero") ("list-style-image" "" "none" "inherit") ("list-style-position" "inside" "outside" "inherit") ("list-style" "" "") ("page-break-before" "auto" "always" "avoid" "left" "right" "inherit") ("page-break-after" "auto" "always" "avoid" "left" "right" "inherit") ("page-break-inside" "auto" "always" "avoid" "left" "right" "inherit") ("page-break-before" "auto" "always" "avoid" "left" "right" "inherit") ("page-break-after" "auto" "always" "avoid" "left" "right" "inherit") ("page-break-inside" "avoid" "auto" "inherit") ("orphans" "" "inherit") ("widows" "" "inherit") ("color" "" "inherit") ("background-color" "" "transparent" "inherit") ("background-image" "" "none" "inherit") ("background-repeat" "repeat" "repeat-x" "repeat-y" "no-repeat" "inherit") ("background-attachment" "scroll" "fixed" "inherit") ("background-position" "" "" "left" "center" "right") ("background" "" "") ("font-family" "" "") ("font-style" "normal" "italic" "oblique" "inherit") ("font-variant" "normal" "small-caps" "inherit") ("font-size" "" "" "" "") ("font" "" "" "") ("text-indent" "" "" "inherit") ("text-align" "left" "right" "center" "justify" "inherit") ("text-decoration" "none" "underline" "overline" "line-through" "blink") ("letter-spacing" "normal" "" "inherit") ("word-spacing" "normal" "" "inherit") ("text-transform" "capitalize" "uppercase" "lowercase" "none" "inherit") ("white-space" "normal" "pre" "nowrap" "pre-wrap" "pre-line" "inherit") ("caption-side" "top" "bottom" "inherit") ("table-layout" "auto" "fixed" "inherit") ("border-collapse" "collapse" "separate" "inherit") ("border-spacing" "" "inherit") ("empty-cells" "show" "hide" "inherit") ("cursor" "" "auto" "crosshair" "default" "pointer" "move") ("outline" "" "" "") ("outline-width" "" "inherit") ("outline-style" "" "inherit") ("outline-color" "" "invert" "inherit") ("volume" "" "" "silent" "x-soft" "soft" "medium" ) ("speak" "normal" "none" "spell-out" "inherit") ("pause-before" "