diff --git a/contrib/auto-completion/README.md b/contrib/auto-completion/README.md
new file mode 100644
index 000000000..0b6833a3f
--- /dev/null
+++ b/contrib/auto-completion/README.md
@@ -0,0 +1,77 @@
+# Auto-Completion configuration layer for Spacemacs
+
+
+**Table of Contents**
+
+- [Colors contribution layer for Spacemacs](#colors-contribution-layer-for-spacemacs)
+ - [Description](#description)
+ - [Install](#install)
+ - [Enable rainbow-identifiers](#enable-rainbow-identifiers)
+ - [Enable Nyan cat](#enable-nyan-cat)
+ - [Key bindings](#key-bindings)
+ - [Rainbow Identifiers](#rainbow-identifiers)
+ - [Rainbow Mode](#rainbow-mode)
+
+
+
+## Description
+
+This layer provides auto-completion to Spacemacs.
+The following front-ends are supported:
+- [company][]
+- [auto-complete][]
+
+**Notes***
+- `company` is the most supported and preferred front-end in Spacemacs.
+- For a given language, Spacemacs supports one and only one front-end.
+
+## Install
+
+To use this contribution add it to your `~/.spacemacs`
+
+```elisp
+(setq-default dotspacemacs-configuration-layers '(auto-completion))
+```
+
+### Company variables
+
+To use tab instead of enter to complete your selection,
+`dotspacemacs/init` set `auto-completion-use-tab-instead-of-enter` to
+`t`, for example:
+
+``` elisp
+(setq-default dotspacemacs-configuration-layers
+ '(auto-completion :variables
+ auto-completion-use-tab-instead-of-enter t))
+```
+
+To enable docstring tooltips set `auto-completion-enable-company-help-tooltip`
+to `t`
+
+``` elisp
+(setq-default dotspacemacs-configuration-layers
+ '(auto-completion :variables
+ auto-completion-enable-company-help-tooltip t))
+```
+
+## Key Bindings
+
+### Company
+
+ No Debug | Description
+---------------------|------------------------------------------------------------
+C-j | go down in company dropdown menu
+C-k | go up in company dropdown menu
+C-/ | search in company dropdown
+C-M-/ | filter the company dropdown menu
+C-d | open minibuffer with documentation of thing at point in company dropdown
+
+### Auto-complete
+
+ Key Binding | Description
+-------------------|------------------------------------------------------------
+C-j | select next candidate
+C-k | select previous candidate
+TAB | expand selection or select next candidate
+S-TAB | select previous candidate
+return | complete word, if word is already completed insert a carriage return
diff --git a/contrib/auto-completion/config.el b/contrib/auto-completion/config.el
new file mode 100644
index 000000000..cb927cdea
--- /dev/null
+++ b/contrib/auto-completion/config.el
@@ -0,0 +1,32 @@
+;;; config.el --- Auto-completion configuration File for Spacemacs
+;;
+;; Copyright (c) 2012-2014 Sylvain Benner
+;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
+;;
+;; Author: Sylvain Benner
+;; URL: https://github.com/syl20bnr/spacemacs
+;;
+;; This file is not part of GNU Emacs.
+;;
+;;; License: GPLv3
+
+;; Company -------------------------------------------------------------------
+
+;; not used for now
+(defvar auto-completion-enable-company-yasnippet t
+ "If non nil enable yasnippet for all company backends.
+Not used for now.")
+
+(defvar auto-completion-enable-company-help-tooltip nil
+ "If non nil the docstring appears in a tooltip.")
+
+(defvar auto-completion-use-tab-instead-of-enter nil
+ "If non nil use tab instead of enter for completion.")
+
+(defvar company-mode-completion-cancel-keywords
+ '("do"
+ "then"
+ "begin"
+ "case")
+ "Keywords on which to cancel completion so that you can use RET
+to complet without blocking common line endings.")
diff --git a/contrib/auto-completion/funcs.el b/contrib/auto-completion/funcs.el
new file mode 100644
index 000000000..3c6003dff
--- /dev/null
+++ b/contrib/auto-completion/funcs.el
@@ -0,0 +1,89 @@
+;;; funcs.el --- Auto-completion functions File
+;;
+;; Copyright (c) 2012-2014 Sylvain Benner
+;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
+;;
+;; Author: Sylvain Benner
+;; URL: https://github.com/syl20bnr/spacemacs
+;;
+;; This file is not part of GNU Emacs.
+;;
+;;; License: GPLv3
+
+(spacemacs|add-toggle auto-completion
+ :status
+ (if (eq 'company auto-completion-front-end)
+ company-mode
+ auto-complete-mode)
+ :on
+ (progn
+ (if (eq 'company auto-completion-front-end)
+ (company-mode)
+ (auto-complete-mode))
+ (message "Enabled %S." auto-completion-front-end))
+ :off
+ (progn
+ (if (eq 'company auto-completion-front-end)
+ (company-mode -1)
+ (auto-complete-mode -1))
+ (message "Disabled %S." auto-completion-front-end))
+ :documentation "Activate auto-completion."
+ :evil-leader "ta")
+
+;; Company -------------------------------------------------------------------
+
+(defmacro spacemacs|enable-company (mode &optional hook)
+ "Enable company for the given MODE.
+MODE must match the symbol passed in `spacemacs|init-company-backends'.
+By default the initialization function is hooked to `MODE-hook', it is
+possible to explicitly define a hook with HOOK."
+ (when (configuration-layer/layer-declaredp 'auto-completion)
+ (let ((mode-hook (if hook hook
+ (intern (format "%S-hook" mode))))
+ (func (intern (format "spacemacs//init-company-%S" mode))))
+ `(progn
+ (defun ,func ()
+ ,(format "Initialize company for %S" mode)
+ (set (make-variable-buffer-local 'auto-completion-front-end)
+ 'company)
+ (set (make-variable-buffer-local 'company-backends)
+ ,(intern (format "company-backends-%S" mode))))
+ (add-hook ',mode-hook ',func)
+ (add-hook ',mode-hook 'company-mode)))))
+
+(defun spacemacs/company-backend-with-yas (backend)
+ "Return BACKEND with support for yasnippet candidates."
+ backend
+ ;; ------------------
+ ;; syl20bnr: For now adding company-snippet to some backend like anaconda
+ ;; has weird side effects, I need to investigate a little more on this
+ ;; ------------------
+ ;; (if (and (configuration-layer/package-declaredp 'yasnippet)
+ ;; auto-completion-enable-company-yasnippet
+ ;; (not (eq 'company-semantic backend)))
+ ;; (unless (and (listp backend) (member 'company-yasnippet backend))
+ ;; (append (if (listp backend) backend (list backend))
+ ;; (list :with 'company-yasnippet)))
+ ;; ;; (cons backend '(company-yasnippet)))
+ ;; backend)
+ )
+
+;; Auto-complete -------------------------------------------------------------
+
+(defmacro spacemacs|enable-auto-complete (mode &optional hook)
+ "Enable auto-complete for the given MODE.
+By default the initialization function is hooked to `MODE-hook', it is
+possible to explicitly define a hook with HOOK."
+ (when (configuration-layer/layer-declaredp 'auto-completion)
+ (let ((mode-hook (if hook hook
+ (intern (format "%S-hook" mode))))
+ (func (intern (format "spacemacs//init-auto-complete-%S" mode))))
+ `(progn
+ (defun ,func ()
+ ,(format "Initialize auto-complete for %S" mode)
+ (set (make-variable-buffer-local 'auto-completion-front-end)
+ 'auto-complete)
+ (set (make-variable-buffer-local 'company-backends)
+ ,(intern (format "company-backends-%S" mode))))
+ (add-hook ',mode-hook ',func)
+ (add-hook ',mode-hook 'auto-complete-mode)))))
diff --git a/contrib/auto-completion/packages.el b/contrib/auto-completion/packages.el
new file mode 100644
index 000000000..d492835ff
--- /dev/null
+++ b/contrib/auto-completion/packages.el
@@ -0,0 +1,122 @@
+;;; packages.el --- Auto-completion Layer packages File for Spacemacs
+;;
+;; Copyright (c) 2012-2014 Sylvain Benner
+;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
+;;
+;; Author: Sylvain Benner
+;; URL: https://github.com/syl20bnr/spacemacs
+;;
+;; This file is not part of GNU Emacs.
+;;
+;;; License: GPLv3
+
+(defvar auto-completion-packages
+ '(
+ company
+ ac-ispell
+ auto-complete
+ ))
+
+;; company-quickhelp from MELPA is not compatible with 24.3 anymore
+(unless (version< emacs-version "24.4")
+ (push 'company-quickhelp auto-completion-packages))
+
+(defvar auto-completion-excluded-packages '()
+ "Packages that use auto-complete that are no longer necessary and might
+conflict.")
+
+(defun auto-completion/init-ac-ispell ()
+ (use-package ac-ispell
+ :defer t
+ :init
+ (progn
+ (setq ac-ispell-requires 4)
+ (eval-after-load "auto-complete"
+ '(ac-ispell-setup))
+ ;; (add-hook 'markdown-mode-hook 'ac-ispell-ac-setup)
+ )))
+
+(defun auto-completion/init-auto-complete ()
+ (use-package auto-complete
+ :defer t
+ :init
+ (setq ac-auto-start 0
+ ac-delay 0.2
+ ac-quick-help-delay 1.
+ ac-use-fuzzy t
+ ac-fuzzy-enable t
+ ac-comphist-file (concat spacemacs-cache-directory "ac-comphist.dat")
+ tab-always-indent 'complete ; use 'complete when auto-complete is disabled
+ ac-dwim t)
+ :config
+ (progn
+ (require 'auto-complete-config)
+ (ac-config-default)
+ (when (configuration-layer/package-declaredp 'yasnippet)
+ (push 'ac-source-yasnippet ac-sources))
+ (add-to-list 'completion-styles 'initials t)
+ (define-key ac-completing-map (kbd "C-j") 'ac-next)
+ (define-key ac-completing-map (kbd "C-k") 'ac-previous)
+ (define-key ac-completing-map (kbd "") 'ac-previous)
+ (spacemacs|diminish auto-complete-mode " Ⓐ" " A"))))
+
+(defun auto-completion/init-company ()
+ (use-package company
+ :defer t
+ :init
+ (setq company-idle-delay 0.2
+ company-minimum-prefix-length 2
+ company-require-match nil
+ company-dabbrev-ignore-case nil
+ company-dabbrev-downcase nil
+ company-tooltip-flip-when-above t
+ company-frontends '(company-pseudo-tooltip-frontend)
+ company-clang-prefix-guesser 'company-mode/more-than-prefix-guesser)
+ :config
+ (progn
+ (spacemacs|diminish company-mode " Ⓐ" " A")
+ ;; Set the completion key
+ (if auto-completion-use-tab-instead-of-enter
+ (progn
+ ;; have tab stand in for enter
+ (define-key company-active-map (kbd "TAB") 'company-complete-selection)
+ (define-key company-active-map (kbd "") 'company-complete-selection)
+ (define-key company-active-map [tab] 'company-complete-selection)
+ ;;disable enter
+ (define-key company-active-map [return] nil)
+ (define-key company-active-map (kbd "RET") nil))
+ ;; Fix integration of company and yasnippet
+ (define-key company-active-map (kbd "TAB") nil)
+ (define-key company-active-map (kbd "") nil)
+ (define-key company-active-map [tab] nil))
+ ;; key bindings
+ (define-key company-active-map (kbd "C-j") 'company-select-next)
+ (define-key company-active-map (kbd "C-k") 'company-select-previous)
+ (define-key company-active-map (kbd "C-/") 'company-search-candidates)
+ (define-key company-active-map (kbd "C-M-/") 'company-filter-candidates)
+ (define-key company-active-map (kbd "C-d") 'company-show-doc-buffer)
+ ;; Nicer looking faces
+ (custom-set-faces
+ '(company-tooltip-common
+ ((t (:inherit company-tooltip :weight bold :underline nil))))
+ '(company-tooltip-common-selection
+ ((t (:inherit company-tooltip-selection :weight bold :underline nil)))))
+ ;; Transformers
+ (defun spacemacs//company-transformer-cancel (candidates)
+ "Cancel completion if prefix is in the list
+`company-mode-completion-cancel-keywords'"
+ (unless (and (member company-prefix company-mode-completion-cancel-keywords)
+ (not auto-completion-use-tab-instead-of-enter))
+ candidates))
+ (setq company-transformers '(spacemacs//company-transformer-cancel
+ company-sort-by-occurrence))
+ ;; Backends
+ (setq company-backends
+ (mapcar 'spacemacs/company-backend-with-yas company-backends)))))
+
+(defun auto-completion/init-company-quickhelp ()
+ (use-package company-quickhelp
+ :if (and auto-completion-enable-company-help-tooltip
+ (display-graphic-p))
+ :defer t
+ :init (add-hook 'company-mode-hook 'company-quickhelp-mode)))
diff --git a/contrib/company-mode/README.md b/contrib/company-mode/README.md
deleted file mode 100644
index c5cd57fa0..000000000
--- a/contrib/company-mode/README.md
+++ /dev/null
@@ -1,49 +0,0 @@
-# Company Mode
-
-This contrib layer switches spacemacs to use company-mode for
-autocompletion. It automatically uninstalls all auto-complete-mode
-related packages when you include it.
-
-## Clang Fanciness
-
-In `funcs.el` there are some fancy improvements to `company-clang`.
-It includes a hook to load a projects `.clang_complete` file, which is
-just a text file with one clang flag per line, a format also used by
-other text editor clang plugins.
-
-Not only does this allow proper autocomplete on projects with extra
-includes and flags, but I also hooked it into flycheck so that the
-error messages don't complain about missing header files and skip the
-actual problems.
-
-Basically, Spacemacs now has better Clang/C++ than any other Emacs
-config.
-
-## Key Bindings
-
- No Debug | Description
----------------------|------------------------------------------------------------
-C-j | go down in company dropdown menu
-C-k | go up in company dropdown menu
-C-/ | search in company dropdown
-C-M-/ | filter the company dropdown menu
-C-d | open minibuffer with documentation of thing at point in company dropdown
-
-## Settings
-
-To use tab instead of enter to complete your selection,
-`dotspacemacs/init` set `company-mode-use-tab-instead-of-enter` to
-true, for example:
-
-``` elisp
-(defun dotspacemacs/init ()
- "User initialization for Spacemacs. This function is called at the very
- startup."
- (setq company-mode-use-tab-instead-of-enter t)
- )
-```
-
-## Maintainer
-
-This contrib layer was written by and should be maintained by @trishume, everyone else is
-welcome to contribute.
diff --git a/contrib/company-mode/config.el b/contrib/company-mode/config.el
deleted file mode 100644
index bdecc5bf5..000000000
--- a/contrib/company-mode/config.el
+++ /dev/null
@@ -1,27 +0,0 @@
-;;; config.el --- Company mode configuration File for Spacemacs
-;;
-;; Copyright (c) 2012-2014 Sylvain Benner
-;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
-;;
-;; Author: Sylvain Benner
-;; URL: https://github.com/syl20bnr/spacemacs
-;;
-;; This file is not part of GNU Emacs.
-;;
-;;; License: GPLv3
-
-;; Variables
-
-(defvar company-mode-enable-yas t
- "If non nil enable yasnippet for all backends.")
-
-(defvar company-mode-use-tab-instead-of-enter nil
- "If non nil use tab instead of enter for completion in company-mode")
-
-(defvar company-mode-completion-cancel-keywords
- '("do"
- "then"
- "begin"
- "case")
- "Keywords on which to cancel completion so that you can use RET
-to complet without blocking common line endings.")
diff --git a/contrib/company-mode/funcs.el b/contrib/company-mode/funcs.el
deleted file mode 100644
index eaccdd1dc..000000000
--- a/contrib/company-mode/funcs.el
+++ /dev/null
@@ -1,29 +0,0 @@
-;;; funcs.el --- Company Layer functions File
-;;
-;; Copyright (c) 2012-2014 Sylvain Benner
-;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
-;;
-;; Author: Sylvain Benner
-;; URL: https://github.com/syl20bnr/spacemacs
-;;
-;; This file is not part of GNU Emacs.
-;;
-;;; License: GPLv3
-
-(defun spacemacs/company-backend-with-yas (backend)
- "Return BACKEND with support for yasnippet candidates."
- backend
- ;; ------------------
- ;; syl20bnr: For now adding company-snippet to some backend like anaconda
- ;; has weird side effects, I need to investigate a little more on this
- ;; ------------------
- ;; (if (and (configuration-layer/package-declaredp 'yasnippet)
- ;; company-mode-enable-yas
- ;; (not (eq 'company-semantic backend)))
- ;; (unless (and (listp backend) (member 'company-yasnippet backend))
- ;; (append (if (listp backend) backend (list backend))
- ;; (list :with 'company-yasnippet)))
- ;; ;; (cons backend '(company-yasnippet)))
- ;; backend)
- )
-
diff --git a/contrib/company-mode/packages.el b/contrib/company-mode/packages.el
deleted file mode 100644
index 7a0fd247d..000000000
--- a/contrib/company-mode/packages.el
+++ /dev/null
@@ -1,72 +0,0 @@
-(defvar company-mode-packages '(company))
-
-;; company-quickhelp from MELPA is not compatible with 24.3 anymore
-(unless (version< emacs-version "24.4")
- (push 'company-quickhelp company-mode-packages))
-
-(defvar company-mode-excluded-packages
- '(auto-complete ac-ispell tern-auto-complete auto-complete-clang edts)
- "Packages that use auto-complete that are no longer necessary and might
-conflict.")
-
-(defun company-mode/init-company ()
- (use-package company
- :defer t
- :init
- (progn
- (setq company-idle-delay 0.5
- company-minimum-prefix-length 2
- company-require-match nil
- company-dabbrev-ignore-case nil
- company-dabbrev-downcase nil
- company-tooltip-flip-when-above t
- company-frontends '(company-pseudo-tooltip-frontend)
- company-clang-prefix-guesser 'company-mode/more-than-prefix-guesser)
- (add-hook 'prog-mode-hook 'global-company-mode))
- :config
- (progn
- (spacemacs|diminish company-mode " Ⓒ" " C")
- ;; Set the completion key
- (if company-mode-use-tab-instead-of-enter
- (progn
- ;; have tab stand in for enter
- (define-key company-active-map (kbd "TAB") 'company-complete-selection)
- (define-key company-active-map (kbd "") 'company-complete-selection)
- (define-key company-active-map [tab] 'company-complete-selection)
- ;;disable enter
- (define-key company-active-map [return] nil)
- (define-key company-active-map (kbd "RET") nil))
- ;; Fix integration of company and yasnippet
- (define-key company-active-map (kbd "TAB") nil)
- (define-key company-active-map (kbd "") nil)
- (define-key company-active-map [tab] nil))
- ;; key bindings
- (define-key company-active-map (kbd "C-j") 'company-select-next)
- (define-key company-active-map (kbd "C-k") 'company-select-previous)
- (define-key company-active-map (kbd "C-/") 'company-search-candidates)
- (define-key company-active-map (kbd "C-M-/") 'company-filter-candidates)
- (define-key company-active-map (kbd "C-d") 'company-show-doc-buffer)
- ;; Nicer looking faces
- (custom-set-faces
- '(company-tooltip-common
- ((t (:inherit company-tooltip :weight bold :underline nil))))
- '(company-tooltip-common-selection
- ((t (:inherit company-tooltip-selection :weight bold :underline nil)))))
- ;; Transformers
- (defun spacemacs//company-transformer-cancel (candidates)
- "Cancel completion if prefix is in the list
-`company-mode-completion-cancel-keywords'"
- (unless (and (member company-prefix company-mode-completion-cancel-keywords)
- (not company-mode-use-tab-instead-of-enter))
- candidates))
- (setq company-transformers '(spacemacs//company-transformer-cancel
- company-sort-by-occurrence))
- ;; Backends
- (setq company-backends
- (mapcar 'spacemacs/company-backend-with-yas company-backends)))))
-
-(defun company-mode/init-company-quickhelp ()
- (use-package company-quickhelp
- :if (display-graphic-p)
- :defer t
- :init (add-hook 'company-mode-hook 'company-quickhelp-mode)))
diff --git a/contrib/lang/c-c++/README.md b/contrib/lang/c-c++/README.md
index 42fd05fee..7e1915517 100644
--- a/contrib/lang/c-c++/README.md
+++ b/contrib/lang/c-c++/README.md
@@ -26,8 +26,16 @@ for demos in some programming languages.
- Support common refactoring with [semantic-refactor][]. See [this page][srefactor-demos]
for demonstration of refactoring features.
-**This layer is not fully adapted for Spacemacs, it needs you, C/C++ experts, to
-improve it and make it consistent with the Spacemacs experience.**
+### Clang Fanciness
+
+This layer adds some fancy improvements to `company-clang`.
+It includes a hook to load a projects `.clang_complete` file, which is
+just a text file with one clang flag per line, a format also used by
+other text editor clang plugins.
+
+Not only does this allow proper autocomplete on projects with extra
+includes and flags, but there is also support for flycheck so that it
+doesn't complain about missing header files.
## Key Bindings
diff --git a/contrib/lang/c-c++/packages.el b/contrib/lang/c-c++/packages.el
index 2c168790b..e5a9bc200 100644
--- a/contrib/lang/c-c++/packages.el
+++ b/contrib/lang/c-c++/packages.el
@@ -102,7 +102,7 @@ which require an initialization must be listed explicitly in the list.")
(defun c-c++/init-company-c-headers ()
(use-package company-c-headers
- :if (configuration-layer/layer-declaredp 'company-mode)
+ :if (configuration-layer/layer-declaredp 'auto-completion)
:defer t
:init (push 'company-c-headers company-backends-c-c++)))
diff --git a/contrib/lang/ess/packages.el b/contrib/lang/ess/packages.el
index ce2cd2991..5636fae0b 100644
--- a/contrib/lang/ess/packages.el
+++ b/contrib/lang/ess/packages.el
@@ -31,7 +31,7 @@ which require an initialization must be listed explicitly in the list.")
(defun ess/init-company-ess ()
(use-package company-ess
- :if (configuration-layer/layer-declaredp 'company-mode)
+ :if (configuration-layer/layer-declaredp 'auto-completion)
:defer t
:init (push '(company-ess-backend :with company-yasnippet)
company-backends-ess-mode)))
diff --git a/contrib/lang/go/packages.el b/contrib/lang/go/packages.el
index 697305b83..3aea57625 100644
--- a/contrib/lang/go/packages.el
+++ b/contrib/lang/go/packages.el
@@ -43,7 +43,7 @@ which require an initialization must be listed explicitly in the list.")
)
(defun go/init-company-go ()
(use-package company-go
- :if (configuration-layer/layer-declaredp 'company-mode)
+ :if (configuration-layer/layer-declaredp 'auto-completion)
:defer t
:init (push '(company-go :with company-yasnippet)
company-backends-go-mode)))
diff --git a/contrib/lang/haskell/packages.el b/contrib/lang/haskell/packages.el
index 6dde8d22f..708cebee6 100644
--- a/contrib/lang/haskell/packages.el
+++ b/contrib/lang/haskell/packages.el
@@ -28,7 +28,7 @@
(defun haskell/init-company-ghc ()
(use-package company-ghc
- :if (configuration-layer/layer-declaredp 'company-mode)
+ :if (configuration-layer/layer-declaredp 'auto-completion)
:defer t
:init (push '(company-ghc :with company-yasnippet)
company-backends-haskell-mode)))
diff --git a/contrib/lang/javascript/packages.el b/contrib/lang/javascript/packages.el
index 0972835b2..92784d460 100644
--- a/contrib/lang/javascript/packages.el
+++ b/contrib/lang/javascript/packages.el
@@ -46,7 +46,7 @@ which require an initialization must be listed explicitly in the list.")
(defun javascript/init-company-tern ()
(use-package company-tern
:if (and (configuration-layer/package-declaredp 'tern)
- (configuration-layer/layer-declaredp 'company-mode))
+ (configuration-layer/layer-declaredp 'auto-completion))
:defer t
:init (push '(company-tern :with company-yasnippet)
company-backends-js2-mode)))
diff --git a/contrib/lang/markdown/packages.el b/contrib/lang/markdown/packages.el
index 1a137e08b..f87bc460a 100644
--- a/contrib/lang/markdown/packages.el
+++ b/contrib/lang/markdown/packages.el
@@ -22,11 +22,7 @@ which require an initialization must be listed explicitly in the list.")
(use-package markdown-mode
:mode ("\\.md" . markdown-mode)
:defer t
- :init
- (progn
- (add-hook 'markdown-mode-hook 'smartparens-mode)
- (when (configuration-layer/layer-declaredp 'company-mode)
- (add-hook 'markdown-mode-hook (lambda () (company-mode -1)))))
+ :init (add-hook 'markdown-mode-hook 'smartparens-mode)
:config
;; Don't do terrible things with Github code blocks (```)
(when (fboundp 'sp-local-pair)
diff --git a/contrib/lang/python/packages.el b/contrib/lang/python/packages.el
index 366db53ff..ee619b342 100644
--- a/contrib/lang/python/packages.el
+++ b/contrib/lang/python/packages.el
@@ -60,7 +60,7 @@ which require an initialization must be listed explicitly in the list.")
(defun python/init-company-anaconda ()
(use-package company-anaconda
- :if (configuration-layer/layer-declaredp 'company-mode)
+ :if (configuration-layer/layer-declaredp 'auto-completion)
:defer t
:init
;; we don't use the yasnippet backend here because it
diff --git a/contrib/ycmd/packages.el b/contrib/ycmd/packages.el
index 331cc10b1..2178c4517 100644
--- a/contrib/ycmd/packages.el
+++ b/contrib/ycmd/packages.el
@@ -13,7 +13,7 @@ which require an initialization must be listed explicitly in the list.")
(defun ycmd/init-company-ycmd ()
(use-package company-ycmd
- :if (configuration-layer/layer-declaredp 'company-mode)
+ :if (configuration-layer/layer-declaredp 'auto-completion)
:defer t
:init (push '(company-ycmd :with company-yasnippet)
company-backends-c-c++)))
diff --git a/doc/DOCUMENTATION.md b/doc/DOCUMENTATION.md
index a9ff93072..922e5b1fc 100644
--- a/doc/DOCUMENTATION.md
+++ b/doc/DOCUMENTATION.md
@@ -122,7 +122,6 @@
- [Indent text object](#indent-text-object)
- [Region narrowing](#region-narrowing)
- [Line formatting](#line-formatting)
- - [Auto-completion](#auto-completion)
- [Replacing text with iedit](#replacing-text-with-iedit)
- [iedit states key bindings](#iedit-states-key-bindings)
- [State transitions](#state-transitions)
@@ -1923,18 +1922,6 @@ Line formatting commands start with `j`:
Used together these key bindings are very powerful to quickly reformat the code.
-### Auto-completion
-
-`Spacemacs` uses [auto-complete][] auto-completion engine.
-
- Key Binding | Description
--------------------|------------------------------------------------------------
-C-j | select next candidate
-C-k | select previous candidate
-TAB | expand selection or select next candidate
-S-TAB | select previous candidate
-return | complete word, if word is already completed insert a carriage return
-
### Replacing text with iedit
`Spacemacs` uses the powerful [iedit][] mode through [evil-iedit-state][] to
diff --git a/spacemacs/config.el b/spacemacs/config.el
index 06c371cd8..8e37146a9 100644
--- a/spacemacs/config.el
+++ b/spacemacs/config.el
@@ -107,6 +107,7 @@ It runs `tabulated-list-revert-hook', then calls `tabulated-list-print'."
;; Edit
;; ---------------------------------------------------------------------------
+(spacemacs|init-company-backends emacs-lisp-mode)
;; start scratch in text mode (usefull to get a faster Emacs load time
;; because it avoids autoloads of elisp modes)
(setq initial-major-mode 'text-mode)
diff --git a/spacemacs/extensions.el b/spacemacs/extensions.el
index b02250c89..af39f229d 100644
--- a/spacemacs/extensions.el
+++ b/spacemacs/extensions.el
@@ -28,6 +28,7 @@
spray
zoom-frm
;; hack to be able to wrap built-in emacs modes in an init function
+ emacs-builtin-emacs-lisp
emacs-builtin-process-menu
))
@@ -174,5 +175,13 @@
(global-set-key (kbd "C-") 'spacemacs/zoom-frm-in)
(global-set-key (kbd "C-") 'spacemacs/zoom-frm-out))))
+(defun spacemacs/init-emacs-builtin-emacs-lisp ()
+ (when (configuration-layer/layer-declaredp 'auto-completion)
+ ;; from lower priority to higher
+ (push 'company-dabbrev company-backends-emacs-lisp-mode)
+ (push 'company-files company-backends-emacs-lisp-mode)
+ (push 'company-capf company-backends-emacs-lisp-mode)
+ (spacemacs|enable-company emacs-lisp-mode)))
+
(defun spacemacs/init-emacs-builtin-process-menu ()
(evilify process-menu-mode process-menu-mode-map))
diff --git a/spacemacs/funcs.el b/spacemacs/funcs.el
index c15eecb41..db9ccc408 100644
--- a/spacemacs/funcs.el
+++ b/spacemacs/funcs.el
@@ -828,25 +828,10 @@ If ASCII si not provided then UNICODE is used instead."
(let ((comint-buffer-maximum-size 0))
(comint-truncate-buffer)))
+;; cannot move it to auto-completion layer since it is
+;; required in config.el file of the layers
(defmacro spacemacs|init-company-backends (mode)
"Initialize a MODE specific company backend variable.
The variable name format is company-backends-MODE."
`(defvar ,(intern (format "company-backends-%S" mode)) nil
,(format "Company backend list for %S" mode)))
-
-(defmacro spacemacs|enable-company (mode &optional hook)
- "Enable company for the given MODE.
-MODE must match the symbol passed in `spacemacs|init-company-backends'.
-By default the initialization function is hooked to `MODE-hook', it is
-possible to explicitly define a hook with HOOK."
- (when (configuration-layer/layer-declaredp 'company-mode)
- (let ((mode-hook (if hook hook
- (intern (format "%S-hook" mode))))
- (func (intern (format "spacemacs//init-company-%S" mode))))
- `(progn
- (defun ,func ()
- ,(format "Initialize company for %S" mode)
- (set (make-variable-buffer-local 'company-backends)
- ,(intern (format "company-backends-%S" mode))))
- (add-hook ',mode-hook ',func)))))
-
diff --git a/spacemacs/packages.el b/spacemacs/packages.el
index 6b9ac7dbc..3a29a0d16 100644
--- a/spacemacs/packages.el
+++ b/spacemacs/packages.el
@@ -12,12 +12,9 @@
(defvar spacemacs-packages
'(
- ac-ispell
ace-jump-mode
ace-window
aggressive-indent
- auto-complete
- auto-complete-clang
auto-dictionary
auto-highlight-symbol
base16-theme
@@ -124,18 +121,6 @@ which require an initialization must be listed explicitly in the list.")
;; Initialization of packages
-(defun spacemacs/init-ac-ispell ()
- (use-package ac-ispell
- :defer t
- :init
- (progn
- (custom-set-variables
- '(ac-ispell-requires 4))
- (eval-after-load "auto-complete"
- '(progn
- (ac-ispell-setup)))
- (add-hook 'markdown-mode-hook 'ac-ispell-ac-setup))))
-
(defun spacemacs/init-ace-jump-mode ()
(use-package ace-jump-mode
:defer t
@@ -189,54 +174,6 @@ which require an initialization must be listed explicitly in the list.")
:config
(spacemacs|diminish aggressive-indent-mode " Ⓘ" " I")))
-(defun spacemacs/init-auto-complete ()
- (use-package auto-complete
- :commands global-auto-complete-mode
- :init
- (add-to-hooks 'auto-complete-mode '(org-mode-hook
- prog-mode-hook))
- :config
- (progn
- (require 'auto-complete-config)
- (ac-config-default)
- (when (configuration-layer/package-declaredp 'yasnippet)
- (push 'ac-source-yasnippet ac-sources))
- (add-to-list 'completion-styles 'initials t)
- (evil-leader/set-key "ta" 'auto-complete-mode)
- (define-key ac-completing-map (kbd "C-j") 'ac-next)
- (define-key ac-completing-map (kbd "C-k") 'ac-previous)
- (define-key ac-completing-map (kbd "") 'ac-previous)
- ;; customization
- (setq ac-auto-start 0
- ac-delay 0.2
- ac-quick-help-delay 1.
- ac-use-fuzzy t
- ac-fuzzy-enable t
- ac-comphist-file (concat spacemacs-cache-directory "ac-comphist.dat")
- tab-always-indent 'complete ; use 'complete when auto-complete is disabled
- ac-dwim t)
- (spacemacs|diminish auto-complete-mode " Ⓐ" " A"))))
-
-(defun spacemacs/init-auto-complete-clang ()
- (use-package auto-complete-clang
- :defer t
- :config
- (progn
- (setq ac-clang-flags
- (mapcar (lambda (item)(concat "-I" item))
- (split-string
- "
- /usr/include/c++/4.7
- /usr/include/i386-linux-gnu/c++/4.7/.
- /usr/include/c++/4.7/backward
- /usr/lib/gcc/i686-linux-gnu/4.7/include
- /usr/local/include
- /usr/lib/gcc/i686-linux-gnu/4.7/include-fixed
- /usr/include/i386-linux-gnu
- /usr/include
- "
- ))))))
-
(defun spacemacs/init-auto-dictionary ()
(use-package auto-dictionary
:disabled t