Port many layers to new auto-completion

Adds support for ruby, auctex, css, ledger and gtags with new
auto-completion infrastructure. Ticks off many things in #1045
This commit is contained in:
Tristan Hume 2015-04-07 16:02:53 -04:00
parent ad86ab8fb1
commit fe90cf09e8
5 changed files with 27 additions and 8 deletions

View file

@ -10,9 +10,6 @@
:defer t
:config
(progn
(when (configuration-layer/layer-usedp 'auto-completion)
(company-auctex-init))
(defun auctex/build-view ()
(interactive)
(if (buffer-modified-p)
@ -60,9 +57,16 @@
(setq-default TeX-parse-self t)
(setq-default TeX-PDF-mode t))))
(defun auctex/init-company-auctex ()
(use-package company-auctex :defer t
:if (configuration-layer/layer-usedp 'auto-completion)))
(defun auctex/post-init-evil-matchit ()
(add-hook 'web-mode-hook 'evil-matchit-mode))
(when (configuration-layer/layer-usedp 'auto-completion)
(spacemacs|init-layer-company auctex LaTeX-mode)
(defun auctex/init-company-auctex ()
(use-package company-auctex :defer t
:init (progn
(add-to-list 'company-backends-LaTeX-mode 'company-auctex-labels)
(add-to-list 'company-backends-LaTeX-mode 'company-auctex-bibs)
(add-to-list 'company-backends-LaTeX-mode
'(company-auctex-macros company-auctex-symbols company-auctex-environments))))))

View file

@ -29,6 +29,7 @@ which require an initialization must be listed explicitly in the list.")
:defer t
:init
(progn
(push '(company-capf :with company-yasnippet) company-backends-ledger-mode)
(setq ledger-post-amount-alignment-column 62)
(evil-leader/set-key-for-mode 'ledger-mode
"mhd" 'ledger-delete-current-transaction
@ -44,3 +45,6 @@ which require an initialization must be listed explicitly in the list.")
"mt" 'ledger-insert-effective-date
"my" 'ledger-set-year
"m RET" 'ledger-set-month))))
(when (configuration-layer/layer-usedp 'auto-completion)
(spacemacs|init-layer-company finance ledger-mode))

View file

@ -163,3 +163,7 @@ which require an initialization must be listed explicitly in the list.")
(defun html/init-slim-mode ()
(use-package slim-mode
:defer t))
(when (configuration-layer/layer-usedp 'auto-completion)
(spacemacs|init-layer-company html css-mode)
(push '(company-css :with company-yasnippet) company-backends-css-mode))

View file

@ -128,7 +128,11 @@
"Initialize Robe mode"
(use-package robe
:defer t
:init (add-hook 'enh-ruby-mode-hook 'robe-mode)
:init
(progn
(add-hook 'enh-ruby-mode-hook 'robe-mode)
(when (configuration-layer/layer-usedp 'auto-completion)
(push '(company-robe :with company-yasnippet) company-backends-enh-ruby-mode)))
:config
(progn
(spacemacs|hide-lighter robe-mode)
@ -173,3 +177,6 @@
(evil-leader/set-key
"mtb" 'ruby-test-run
"mtt" 'ruby-test-run-at-point))))
(when (configuration-layer/layer-usedp 'auto-completion)
(spacemacs|init-layer-company ruby enh-ruby-mode))

View file

@ -834,6 +834,6 @@ If ASCII si not provided then UNICODE is used instead."
"Initialize a MODE specific company backend variable.
The variable name format is company-backends-MODE."
`(defvar ,(intern (format "company-backends-%S" mode))
'((company-dabbrev-code company-keywords)
'((company-dabbrev-code company-gtags company-etags company-keywords)
company-files company-dabbrev)
,(format "Company backend list for %S" mode)))