diff --git a/core/core-auto-completion.el b/core/core-auto-completion.el deleted file mode 100644 index 062b25351..000000000 --- a/core/core-auto-completion.el +++ /dev/null @@ -1,83 +0,0 @@ -;;; core-auto-completion.el --- Spacemacs Core File -;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors -;; -;; Author: Sylvain Benner -;; URL: https://github.com/syl20bnr/spacemacs -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 - -;; Company ------------------------------------------------------------------- - -(defvar spacemacs-default-company-backends - '((company-dabbrev-code company-gtags company-etags company-keywords) - company-files company-dabbrev) - "The list of default company backends used by spacemacs. -This variable is used to configure mode-specific company backends in spacemacs. -Backends in this list will always be active in these modes, as well as any -backends added by individual spacemacs layers.") - -(defmacro spacemacs|defvar-company-backends (mode) - "Define a MODE specific company backend variable with default backends. -The variable name format is company-backends-MODE." - `(defvar ,(intern (format "company-backends-%S" mode)) - ',spacemacs-default-company-backends - ,(format "Company backend list for %S" mode))) - -(defmacro spacemacs|add-company-hook (mode) - "Enable company for the given MODE. -MODE must match the symbol passed in `spacemacs|defvar-company-backends'. -The initialization function is hooked to `MODE-hook'." - (let ((mode-hook (intern (format "%S-hook" mode))) - (func (intern (format "spacemacs//init-company-%S" mode))) - (backend-list (intern (format "company-backends-%S" mode)))) - `(when (configuration-layer/package-usedp 'company) - (defun ,func () - ,(format "Initialize company for %S" mode) - (when auto-completion-enable-snippets-in-popup - (setq ,backend-list (mapcar 'spacemacs//show-snippets-in-company - ,backend-list))) - (set (make-variable-buffer-local 'auto-completion-front-end) - 'company) - (set (make-variable-buffer-local 'company-backends) - ,backend-list)) - (add-hook ',mode-hook ',func t) - (add-hook ',mode-hook 'company-mode t)))) - -(defmacro spacemacs|disable-company (mode) - "Disable company for the given MODE. -MODE parameter must match the parameter used in the call to -`spacemacs|add-company-hook'." - (let ((mode-hook (intern (format "%S-hook" mode))) - (func (intern (format "spacemacs//init-company-%S" mode)))) - `(progn - (remove-hook ',mode-hook ',func) - (remove-hook ',mode-hook 'company-mode)))) - -(defun spacemacs//show-snippets-in-company (backend) - (if (or (not auto-completion-enable-snippets-in-popup) - (and (listp backend) (member 'company-yasnippet backend))) - backend - (append (if (consp backend) backend (list backend)) - '(:with company-yasnippet)))) - -;; Auto-complete ------------------------------------------------------------- - -(defmacro spacemacs|enable-auto-complete (mode) - "Enable auto-complete for the given MODE. -The initialization function is hooked to `MODE-hook'." - (let ((mode-hook (intern (format "%S-hook" mode))) - (func (intern (format "spacemacs//init-auto-complete-%S" mode)))) - `(when (configuration-layer/package-usedp 'auto-complete) - (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)))) - -(provide 'core-auto-completion) diff --git a/core/core-spacemacs.el b/core/core-spacemacs.el index b788a1191..2d6e6e3dd 100644 --- a/core/core-spacemacs.el +++ b/core/core-spacemacs.el @@ -18,7 +18,6 @@ (require 'core-dotspacemacs) (require 'core-custom-settings) (require 'core-release-management) -(require 'core-auto-completion) (require 'core-jump) (require 'core-display-init) (require 'core-themes-support) diff --git a/doc/LAYERS.org b/doc/LAYERS.org index 9b58f2700..bdce140c9 100644 --- a/doc/LAYERS.org +++ b/doc/LAYERS.org @@ -29,8 +29,6 @@ - [[#load-ordering][Load ordering]] - [[#no-require][No require]] - [[#auto-load-everything][Auto-load everything]] - - [[#how-do-i--idiomatically][How do I ... idiomatically?]] - - [[#setup-auto-completion-for-a-major-mode][Setup auto-completion for a major mode]] * Introduction This document is intended as a tutorial for users who are interested in writing @@ -463,7 +461,6 @@ would have been installed even if the =auto-completion= layer had been disabled, which is not what we want. * Layer tips and tricks - ** Cross-dependencies Spacemacs provides a couple of additional useful functions you can use to check whether other layers or packages are included. @@ -570,54 +567,3 @@ missing appropriate auto-loads. Defer everything. You should have a very good reason not to defer the loading of a package. -* How do I ... idiomatically? - -** Setup auto-completion for a major mode -In your layer's =config.el=, call =spacemacs|defvar-company-backends=. - -#+begin_src emacs-lisp -(spacemacs|defvar-company-backends yoyo-mode) -#+end_src - -This creates a variable called =company-backends-yoyo-mode=. In the package -=init= functions, you should push backends to this variable. But of course, only -if the =auto-completion= layer is enabled. - -#+begin_src emacs-lisp -(defconst yoyo-packages '( - ;; ... - some-weird-package - ;; ... - ) - - (when (configuration-layer/package-usedp 'company) - (defun yoyo/init-some-weird-package () - (use-package some-weird-package - :defer t - ;; This has to be in init because it's a package entry point - :init - (push 'some-weird-backend company-backends-yoyo-mode)))) -#+end_src - -Finally, we must make sure company is started when we enter =yoyo-mode=, but -again only if the =auto-completion= layer is enabled. - -#+begin_src emacs-lisp -(defconst yoyo-packages '( - ;; ... - yoyo-mode - ;; ... - )) - -(defun yoyo/init-yoyo-mode () - (use-package yoyo-mode - ;; Some configuration goes here, however nothing relating to company - ;; since this function may be called even if company is not installed! - )) - -(when (configuration-layer/package-usedp 'company) - (defun yoyo/post-init-yoyo-mode () - ;; This makes no reference to `some-weird-package', which may have - ;; been excluded by the user - (spacemacs|add-company-hook yoyo-mode))) -#+end_src diff --git a/layers/+chat/erc/config.el b/layers/+chat/erc/config.el index 7567fb1ad..15d0c2005 100644 --- a/layers/+chat/erc/config.el +++ b/layers/+chat/erc/config.el @@ -20,5 +20,3 @@ (defvar erc-server-list nil "If non nil, connect automatically to the specified servers with the given credentials.") - -(spacemacs|defvar-company-backends erc-mode) diff --git a/layers/+chat/erc/packages.el b/layers/+chat/erc/packages.el index c539b0dff..e8f212a51 100644 --- a/layers/+chat/erc/packages.el +++ b/layers/+chat/erc/packages.el @@ -35,11 +35,10 @@ (push 'erc-terminal-notifier erc-packages)) (defun erc/post-init-company () - (spacemacs|add-company-hook erc-mode) - (push 'company-capf company-backends-erc-mode)) + (spacemacs|add-company-backends :backends company-capf :modes erc-mode)) (defun erc/post-init-company-emoji () - (push 'company-emoji company-backends-erc-mode)) + (spacemacs|add-company-backends :backends company-emoji :modes erc-mode)) (defun erc/post-init-emoji-cheat-sheet-plus () (add-hook 'erc-mode-hook 'emoji-cheat-sheet-plus-display-mode)) diff --git a/layers/+chat/rcirc/config.el b/layers/+chat/rcirc/config.el index d8549e11d..29bec98a2 100644 --- a/layers/+chat/rcirc/config.el +++ b/layers/+chat/rcirc/config.el @@ -22,5 +22,3 @@ (defvar rcirc-spacemacs-layout-binding "i" "Binding used in the setup for `spacemacs-layouts' micro-state") - -(spacemacs|defvar-company-backends rcirc-mode) diff --git a/layers/+chat/rcirc/packages.el b/layers/+chat/rcirc/packages.el index 3cb8b2d25..b3a23dfde 100644 --- a/layers/+chat/rcirc/packages.el +++ b/layers/+chat/rcirc/packages.el @@ -13,11 +13,10 @@ )) (defun rcirc/post-init-company () - (spacemacs|add-company-hook rcirc-mode) - (push 'company-capf company-backends-rcirc-mode)) + (spacemacs|add-company-backends :backends company-capf :modes rcirc-mode)) (defun rcirc/post-init-company-emoji () - (push 'company-emoji company-backends-rcirc-mode)) + (spacemacs|add-company-backends :backends company-emoji :modes rcirc-mode)) (defun rcirc/post-init-emoji-cheat-sheet-plus () (add-hook 'rcirc-mode-hook 'emoji-cheat-sheet-plus-display-mode)) diff --git a/layers/+completion/auto-completion/README.org b/layers/+completion/auto-completion/README.org index 958e1a575..68551d19d 100644 --- a/layers/+completion/auto-completion/README.org +++ b/layers/+completion/auto-completion/README.org @@ -12,8 +12,6 @@ - [[#enable-company-or-auto-complete-globally][Enable company or auto-complete globally]] - [[#replacing-company-by-auto-complete][Replacing company by auto-complete]] - [[#add-auto-completion-in-a-layer][Add auto-completion in a layer]] - - [[#in-configel][In =config.el=]] - - [[#in-packagesel][In =packages.el=]] - [[#completion-back-ends][Completion back ends]] - [[#improved-faces][Improved faces]] - [[#key-bindings-1][Key Bindings]] @@ -152,32 +150,26 @@ You can disable =company= by adding it to the =dotspacemacs-excluded-packages= variable, then you are free to enable =auto-complete= globally. ** Add auto-completion in a layer -Here is an example to add =company= auto-completion to python buffer: +Here is an example to add =company= auto-completion to python buffers via the +package =company-anaconda=. -*** In =config.el= -#+BEGIN_SRC emacs-lisp - ;; Define the buffer local company backend variable - (spacemacs|defvar-company-backends python-mode) -#+END_SRC +In the file =packages.el= of the python layer: -*** In =packages.el= #+BEGIN_SRC emacs-lisp ;; Add the relevant packages to the layer + ;; here it is `company-anaconda' (setq python-packages '(... - company (company-anaconda :toggle (configuration-layer/package-usedp 'company)) ...)) - ;; Hook company to python-mode - (defun python/post-init-company () - (spacemacs|add-company-hook python-mode)) - - ;; Add the backend to the major-mode specific backend list (defun python/init-company-anaconda () (use-package company-anaconda :defer t - :init (push 'company-anaconda company-backends-python-mode))) + :init + (spacemacs|add-company-backends + :backends 'company-anaconda + :modes python-mode))) #+END_SRC ** Completion back ends diff --git a/layers/+completion/auto-completion/config.el b/layers/+completion/auto-completion/config.el index 6e63c8e7b..c8ec044cc 100644 --- a/layers/+completion/auto-completion/config.el +++ b/layers/+completion/auto-completion/config.el @@ -11,6 +11,14 @@ ;; Company ------------------------------------------------------------------- +(defvar spacemacs-default-company-backends + '((company-dabbrev-code company-gtags company-etags company-keywords) + company-files company-dabbrev) + "The list of default company backends used by spacemacs. +This variable is used to configure mode-specific company backends in spacemacs. +Backends in this list will always be active in these modes, as well as any +backends added by individual spacemacs layers.") + (defvar-local auto-completion-front-end 'company "Which auto-completion front end to use.") diff --git a/layers/+completion/auto-completion/funcs.el b/layers/+completion/auto-completion/funcs.el index a1c4c99b1..a99ebc29d 100644 --- a/layers/+completion/auto-completion/funcs.el +++ b/layers/+completion/auto-completion/funcs.el @@ -32,6 +32,100 @@ :documentation "Enable auto-completion." :evil-leader "ta") + +;; company backends declaration macro + +(defmacro spacemacs|add-company-backends (&rest props) + "Add and enable company backends. +This function should be called exclusively in `post-init-company' functions or +`init-company-xxx' function where xxx is company backend package. + +Available PROPS: + +`:backends BACKENDS' + One or several symbols or lists representing a company backend or a list of + company backends. + +`:modes MODES' + One or several modes where BACKENDS will be added. + +`:variables VAR VALUE' + One or several VAR VALUE pairs (similar to layer variables). + These variables are made buffer local so their values are set only for + the given MODES. + +`:from SYMBOL' + Advanced property aimed at avoiding hook function name conflicts when + `:variables' property is used in several calls to this macro for the same + MODES." + (declare (indent 0)) + (let* ((backends (spacemacs/mplist-get props :backends)) + (modes (spacemacs/mplist-get props :modes)) + (variables (spacemacs/mplist-get props :variables)) + (from (plist-get props :from)) + (result '(progn))) + (dolist (mode modes) + (let ((backends-var-name (intern (format "company-backends-%S" mode))) + (init-func-name (intern (format "spacemacs//init-company-%S" mode))) + (vars-func-name (intern + (format "spacemacs//init-company-vars-%S%s" mode + (if from (format "-%S" from) "")))) + (mode-hook-name (intern (format "%S-hook" mode)))) + ;; declare buffer local company-backends variable + (push `(defvar ,backends-var-name + ',spacemacs-default-company-backends + ,(format "Company backend list for %S." mode)) result) + ;; add backends + (dolist (backend backends) + (push `(add-to-list ',backends-var-name ',backend) result)) + ;; define initialization hook function + (push `(defun ,init-func-name () + ,(format "Initialize company for %S." mode) + (when auto-completion-enable-snippets-in-popup + (setq ,backends-var-name + (mapcar 'spacemacs//show-snippets-in-company + ,backends-var-name))) + (set (make-variable-buffer-local 'auto-completion-front-end) + 'company) + (set (make-variable-buffer-local 'company-backends) + ,backends-var-name)) result) + (push `(add-hook ',mode-hook-name ',init-func-name t) result) + ;; define variables hook function + (when variables + (let ((vars-func `(defun ,vars-func-name () + ,(format "Define company local variables for %S." + mode))) + vars) + (while variables + (let* ((var (pop variables)) + (forms + (when (consp variables) + `(set (make-variable-buffer-local ',var) + ,(eval (pop variables)))))) + (when forms (push forms vars)))) + (push (append vars-func vars) result)) + (push `(add-hook ',mode-hook-name ',vars-func-name t) result)) + (push `(add-hook ',mode-hook-name 'company-mode t) result))) + ;; return the expanded macro in correct order + (reverse result))) + +(defmacro spacemacs|disable-company (mode) + "Disable company for the given MODE. +MODE parameter must match the :modes values used in the call to +`spacemacs|add-company-backends'." + (let ((mode-hook-name (intern (format "%S-hook" mode))) + (func (intern (format "spacemacs//init-company-%S" mode)))) + `(progn + (remove-hook ',mode-hook-name ',func) + (remove-hook ',mode-hook-name 'company-mode)))) + +(defun spacemacs//show-snippets-in-company (backend) + (if (or (not auto-completion-enable-snippets-in-popup) + (and (listp backend) (member 'company-yasnippet backend))) + backend + (append (if (consp backend) backend (list backend)) + '(:with company-yasnippet)))) + ;; auto-completion key bindings functions diff --git a/layers/+emacs/org/config.el b/layers/+emacs/org/config.el index 75fe3fddd..528ad9053 100644 --- a/layers/+emacs/org/config.el +++ b/layers/+emacs/org/config.el @@ -28,5 +28,3 @@ used.") (defvar org-enable-org-journal-support nil "If non-nil org-journal is configured.") - -(spacemacs|defvar-company-backends org-mode) diff --git a/layers/+emacs/org/packages.el b/layers/+emacs/org/packages.el index 59e609307..221943b6a 100644 --- a/layers/+emacs/org/packages.el +++ b/layers/+emacs/org/packages.el @@ -40,11 +40,10 @@ )) (defun org/post-init-company () - (spacemacs|add-company-hook org-mode) - (push 'company-capf company-backends-org-mode)) + (spacemacs|add-company-backends :backends company-capf :modes org-mode)) (defun org/post-init-company-emoji () - (push 'company-emoji company-backends-org-mode)) + (spacemacs|add-company-backends :backends company-emoji :modes org-mode)) (defun org/post-init-emoji-cheat-sheet-plus () (add-hook 'org-mode-hook 'spacemacs/delay-emoji-cheat-sheet-hook)) diff --git a/layers/+frameworks/react/config.el b/layers/+frameworks/react/config.el index f51001927..03ba96c64 100644 --- a/layers/+frameworks/react/config.el +++ b/layers/+frameworks/react/config.el @@ -11,6 +11,4 @@ ;; Variables -(spacemacs|defvar-company-backends react-mode) - (spacemacs|define-jump-handlers react-mode) diff --git a/layers/+frameworks/react/packages.el b/layers/+frameworks/react/packages.el index 701bacfbd..6d348fc46 100644 --- a/layers/+frameworks/react/packages.el +++ b/layers/+frameworks/react/packages.el @@ -11,7 +11,6 @@ (setq react-packages '( - company company-tern emmet-mode evil-matchit @@ -23,11 +22,8 @@ web-mode )) -(defun react/post-init-company () - (spacemacs|add-company-hook react-mode)) - (defun react/post-init-company-tern () - (push 'company-tern company-backends-react-mode)) + (spacemacs|add-company-backends :backends company-tern :modes react-mode)) (defun react/post-init-emmet-mode () (add-hook 'react-mode-hook 'emmet-mode)) diff --git a/layers/+lang/agda/config.el b/layers/+lang/agda/config.el index 6e0ab3d0e..9da8bc7e1 100644 --- a/layers/+lang/agda/config.el +++ b/layers/+lang/agda/config.el @@ -16,4 +16,3 @@ Emacs. If `use-helper', the `agda-mode' executable is used to find its location.") (spacemacs|define-jump-handlers agda2-mode agda2-goto-definition-keyboard) -(spacemacs|defvar-company-backends agda2-mode) diff --git a/layers/+lang/agda/packages.el b/layers/+lang/agda/packages.el index 7bd300fb8..373ed1e61 100644 --- a/layers/+lang/agda/packages.el +++ b/layers/+lang/agda/packages.el @@ -15,8 +15,7 @@ golden-ratio)) (defun agda/post-init-company () - (spacemacs|add-company-hook agda2-mode) - (push 'company-capf company-backends-agda2-mode)) + (spacemacs|add-company-backends :backends company-capf :modes agda2-mode)) (defun agda/init-agda () (if (and (eq 'use-helper agda-mode-path) diff --git a/layers/+lang/asm/config.el b/layers/+lang/asm/config.el index ed2f59f23..de65114dc 100644 --- a/layers/+lang/asm/config.el +++ b/layers/+lang/asm/config.el @@ -10,7 +10,5 @@ ;;; License: GPLv3 ;; variables -(spacemacs|defvar-company-backends asm-mode) -(spacemacs|defvar-company-backends nasm-mode) (spacemacs|define-jump-handlers asm-mode) diff --git a/layers/+lang/asm/packages.el b/layers/+lang/asm/packages.el index b37898511..8c35f4b5b 100644 --- a/layers/+lang/asm/packages.el +++ b/layers/+lang/asm/packages.el @@ -61,8 +61,7 @@ (setq x86-lookup-browse-pdf-function 'x86-lookup-browse-pdf-pdf-tools))))) (defun asm/post-init-company () - (spacemacs|add-company-hook asm-mode) - (spacemacs|add-company-hook nasm-mode)) + (spacemacs|add-company-backends :modes asm-mode nasm-mode)) (defun asm/post-init-ggtags () (add-hook 'asm-mode-local-vars-hook #'spacemacs/ggtags-mode-enable)) diff --git a/layers/+lang/c-c++/config.el b/layers/+lang/c-c++/config.el index cec7c9721..a3592be4c 100644 --- a/layers/+lang/c-c++/config.el +++ b/layers/+lang/c-c++/config.el @@ -14,9 +14,6 @@ (defvar c-c++-enable-clang-support nil "If non nil Clang related packages and configuration are enabled.") -(spacemacs|defvar-company-backends c-mode-common) -(spacemacs|defvar-company-backends cmake-mode) - (spacemacs|define-jump-handlers c++-mode) (spacemacs|define-jump-handlers c-mode) diff --git a/layers/+lang/c-c++/funcs.el b/layers/+lang/c-c++/funcs.el index 62149d94b..98f73006c 100644 --- a/layers/+lang/c-c++/funcs.el +++ b/layers/+lang/c-c++/funcs.el @@ -9,6 +9,10 @@ ;; ;;; License: GPLv3 +(defun company-mode/more-than-prefix-guesser () + (c-c++/load-clang-args) + (company-clang-guess-prefix)) + ;; Based on the Sarcasm/irony-mode compilation database code. (defun company-mode/find-clang-complete-file () (when buffer-file-name diff --git a/layers/+lang/c-c++/packages.el b/layers/+lang/c-c++/packages.el index e6ffffcde..66be0cf5d 100644 --- a/layers/+lang/c-c++/packages.el +++ b/layers/+lang/c-c++/packages.el @@ -66,26 +66,26 @@ (defun c-c++/init-cmake-mode () (use-package cmake-mode :mode (("CMakeLists\\.txt\\'" . cmake-mode) ("\\.cmake\\'" . cmake-mode)) - :init (push 'company-cmake company-backends-cmake-mode))) + :init (spacemacs|add-company-backends + :backends company-cmake + :modes cmake-mode))) (defun c-c++/post-init-company () - (spacemacs|add-company-hook c-mode-common) - (spacemacs|add-company-hook cmake-mode) - + (when (configuration-layer/package-usedp 'cmake-mode) + (spacemacs|add-company-backends :backends company-cmake :modes cmake-mode)) (when c-c++-enable-clang-support - (push 'company-clang company-backends-c-mode-common) - - (defun company-mode/more-than-prefix-guesser () - (c-c++/load-clang-args) - (company-clang-guess-prefix)) - + (spacemacs|add-company-backends :backends company-clang + :modes c-mode-common) (setq company-clang-prefix-guesser 'company-mode/more-than-prefix-guesser) - (spacemacs/add-to-hooks 'c-c++/load-clang-args '(c-mode-hook c++-mode-hook)))) + (spacemacs/add-to-hooks 'c-c++/load-clang-args + '(c-mode-hook c++-mode-hook)))) (defun c-c++/init-company-c-headers () (use-package company-c-headers :defer t - :init (push 'company-c-headers company-backends-c-mode-common))) + :init (spacemacs|add-company-backends + :backends company-c-headers + :modes c-mode-common))) (defun c-c++/post-init-flycheck () (dolist (mode '(c-mode c++-mode)) @@ -132,7 +132,7 @@ "gG" 'ycmd-goto-imprecise))) (defun c-c++/post-init-company-ycmd () - (push 'company-ycmd company-backends-c-mode-common)) + (spacemacs|add-company-backends :backends company-ycmd :modes c-mode-common)) (defun c-c++/pre-init-xcscope () (spacemacs|use-package-add-hook xcscope diff --git a/layers/+lang/clojure/config.el b/layers/+lang/clojure/config.el index 86a5564a9..a8b0b27c4 100644 --- a/layers/+lang/clojure/config.el +++ b/layers/+lang/clojure/config.el @@ -9,15 +9,8 @@ ;; ;;; License: GPLv3 -;; --------------------------------------------------------------------------- -;; Prefixes -;; --------------------------------------------------------------------------- - ;; Variables -(spacemacs|defvar-company-backends cider-mode) -(spacemacs|defvar-company-backends cider-repl-mode) - (spacemacs|define-jump-handlers clojure-mode) (spacemacs|define-jump-handlers clojurec-mode) (spacemacs|define-jump-handlers clojurescript-mode) diff --git a/layers/+lang/clojure/packages.el b/layers/+lang/clojure/packages.el index 6744b820d..b38dcf07e 100644 --- a/layers/+lang/clojure/packages.el +++ b/layers/+lang/clojure/packages.el @@ -275,10 +275,11 @@ (add-hook 'cider-mode-hook 'subword-mode)) (defun clojure/post-init-company () - (push 'company-capf company-backends-cider-mode) - (spacemacs|add-company-hook cider-mode) - (push 'company-capf company-backends-cider-repl-mode) - (spacemacs|add-company-hook cider-repl-mode)) + (spacemacs|add-company-backends + :backends company-capf + :modes + company-backends-cider-mode + company-backends-cider-repl-mode)) (defun clojure/post-init-ggtags () (add-hook 'clojure-mode-local-vars-hook #'spacemacs/ggtags-mode-enable)) diff --git a/layers/+lang/csharp/config.el b/layers/+lang/csharp/config.el index b6b974fa4..596b7ba0b 100644 --- a/layers/+lang/csharp/config.el +++ b/layers/+lang/csharp/config.el @@ -11,6 +11,4 @@ ;; variables -(spacemacs|defvar-company-backends csharp-mode) - (spacemacs|define-jump-handlers csharp-mode) diff --git a/layers/+lang/csharp/packages.el b/layers/+lang/csharp/packages.el index ed48aae39..b43201311 100644 --- a/layers/+lang/csharp/packages.el +++ b/layers/+lang/csharp/packages.el @@ -20,7 +20,8 @@ )) (defun csharp/init-omnisharp () - ;; Load omnisharp-mode with csharp-mode, this should start the omnisharp server automatically + ;; Load omnisharp-mode with csharp-mode, + ;; this should start the omnisharp server automatically (add-hook 'csharp-mode-hook 'omnisharp-mode) (use-package omnisharp :defer t @@ -31,7 +32,6 @@ ;; Note: if you are using a roslyn based omnisharp server you can ;; set back this variable to t. (setq omnisharp-auto-complete-want-documentation nil)) - (push 'company-omnisharp company-backends-csharp-mode) (add-to-list 'spacemacs-jump-handlers-csharp-mode 'omnisharp-go-to-definition)) :config @@ -39,13 +39,15 @@ (spacemacs/declare-prefix-for-mode 'csharp-mode "mc" "csharp/compile") (spacemacs/declare-prefix-for-mode 'csharp-mode "mf" "csharp/file") (spacemacs/declare-prefix-for-mode 'csharp-mode "mg" "csharp/navigation") - (spacemacs/declare-prefix-for-mode 'csharp-mode "mh" "csharp/documentation") + (spacemacs/declare-prefix-for-mode 'csharp-mode "mh" + "csharp/documentation") (spacemacs/declare-prefix-for-mode 'csharp-mode "mr" "csharp/refactoring") (spacemacs/declare-prefix-for-mode 'csharp-mode "ms" "csharp/server") (spacemacs/declare-prefix-for-mode 'csharp-mode "mt" "csharp/tests") (spacemacs/set-leader-keys-for-major-mode 'csharp-mode ;; Compile - "cc" 'omnisharp-build-in-emacs ;; Only one compile command so use top-level + ;; Only one compile command so use top-level + "cc" 'omnisharp-build-in-emacs ;; Solution/project manipulation "fa" 'omnisharp-add-to-solution-current-file "fA" 'omnisharp-add-to-solution-dired-selected-files @@ -72,7 +74,8 @@ "rm" 'omnisharp-rename "rM" 'omnisharp-rename-interactively "rr" 'omnisharp-run-code-action-refactoring - ;; Server manipulation, inspired spacemacs REPL bindings since C# does not provice a REPL + ;; Server manipulation, inspired spacemacs REPL bindings since C# does + ;; not provice a REPL "ss" 'omnisharp-start-omnisharp-server "sS" 'omnisharp-stop-server "sr" 'omnisharp-reload-solution @@ -86,7 +89,10 @@ "=" 'omnisharp-code-format)))) (defun csharp/post-init-company () - (spacemacs|add-company-hook csharp-mode)) + (when (configuration-layer/package-usedp 'omnisharp) + (spacemacs|add-company-backends + :backends company-omnisharp + :modes csharp-mode))) (defun csharp/init-csharp-mode () (use-package csharp-mode @@ -94,8 +100,9 @@ (defun csharp/post-init-evil-matchit () (with-eval-after-load 'evil-matchit - (plist-put evilmi-plugins 'csharp-mode '((evilmi-simple-get-tag evilmi-simple-jump) - (evilmi-c-get-tag evilmi-c-jump)))) + (plist-put evilmi-plugins 'csharp-mode + '((evilmi-simple-get-tag evilmi-simple-jump) + (evilmi-c-get-tag evilmi-c-jump)))) (add-hook 'csharp-mode-hook 'turn-on-evil-matchit-mode)) (defun csharp/post-init-ggtags () diff --git a/layers/+lang/d/config.el b/layers/+lang/d/config.el index d92def019..ee53723ce 100644 --- a/layers/+lang/d/config.el +++ b/layers/+lang/d/config.el @@ -11,6 +11,4 @@ ;; Variables -(spacemacs|defvar-company-backends d-mode) - (spacemacs|define-jump-handlers d-mode) diff --git a/layers/+lang/d/packages.el b/layers/+lang/d/packages.el index 1a38df70a..7af68b67c 100644 --- a/layers/+lang/d/packages.el +++ b/layers/+lang/d/packages.el @@ -24,16 +24,15 @@ (defun d/post-init-company () ;; Need to convince company that this C-derived mode is a code mode. - (with-eval-after-load 'company-dabbrev-code (push 'd-mode company-dabbrev-code-modes)) - (spacemacs|add-company-hook d-mode)) + (with-eval-after-load 'company-dabbrev-code + (push 'd-mode company-dabbrev-code-modes))) (defun d/init-company-dcd () (use-package company-dcd :defer t :init (progn - (add-hook 'd-mode-hook 'company-dcd-mode) - (push 'company-dcd company-backends-d-mode) + (spacemacs|add-company-backends :backends company-dcd :modes d-mode) (spacemacs/set-leader-keys-for-major-mode 'd-mode "gg" 'company-dcd-goto-definition "gb" 'company-dcd-goto-def-pop-marker diff --git a/layers/+lang/elixir/config.el b/layers/+lang/elixir/config.el index a109c1a75..1939c1dcd 100644 --- a/layers/+lang/elixir/config.el +++ b/layers/+lang/elixir/config.el @@ -17,7 +17,4 @@ Default is nil because Elixir compilation is based on macros and thus it is unsafe. Activate this option only for trusted code, usage of a directory variable is recommended.") -(spacemacs|defvar-company-backends elixir-mode) -(spacemacs|defvar-company-backends alchemist-iex-mode) - (spacemacs|define-jump-handlers elixir-mode) diff --git a/layers/+lang/elixir/packages.el b/layers/+lang/elixir/packages.el index bfbbacddd..f3e18e408 100644 --- a/layers/+lang/elixir/packages.el +++ b/layers/+lang/elixir/packages.el @@ -24,8 +24,10 @@ )) (defun elixir/post-init-company () - (spacemacs|add-company-hook elixir-mode) - (spacemacs|add-company-hook alchemist-iex-mode)) + (when (configuration-layer/package-usedp 'alchemist) + (spacemacs|add-company-backends + :backends alchemist-company + :modes elixir-mode alchemist-iex-mode))) (defun elixir/init-alchemist () (use-package alchemist @@ -36,9 +38,6 @@ (add-hook 'elixir-mode-hook 'alchemist-mode) (setq alchemist-project-compile-when-needed t alchemist-test-status-modeline nil) - ;; setup company backends - (push 'alchemist-company company-backends-elixir-mode) - (push 'alchemist-company company-backends-alchemist-iex-mode) (add-to-list 'spacemacs-jump-handlers-elixir-mode 'alchemist-goto-definition-at-point)) :config diff --git a/layers/+lang/elm/config.el b/layers/+lang/elm/config.el deleted file mode 100644 index f2ef182cb..000000000 --- a/layers/+lang/elm/config.el +++ /dev/null @@ -1,12 +0,0 @@ -;;; config.el --- elm Layer packages File for Spacemacs -;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors -;; -;; Author: Sylvain Benner -;; URL: https://github.com/syl20bnr/spacemacs -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 - -(spacemacs|defvar-company-backends elm-mode) diff --git a/layers/+lang/elm/packages.el b/layers/+lang/elm/packages.el index c0a46ac7f..9ab3d4fc4 100644 --- a/layers/+lang/elm/packages.el +++ b/layers/+lang/elm/packages.el @@ -20,9 +20,8 @@ )) (defun elm/post-init-company () - (spacemacs|add-company-hook elm-mode) - (add-hook 'elm-mode-hook 'elm-oracle-setup-completion) - (push 'company-elm company-backends-elm-mode)) + (spacemacs|add-company-backends :backends company-elm :modes elm-mode) + (add-hook 'elm-mode-hook 'elm-oracle-setup-completion)) (defun elm/post-init-flycheck () (add-hook 'elm-mode-hook 'flycheck-mode) diff --git a/layers/+lang/emacs-lisp/config.el b/layers/+lang/emacs-lisp/config.el index 2404f5ea0..eeddd0637 100644 --- a/layers/+lang/emacs-lisp/config.el +++ b/layers/+lang/emacs-lisp/config.el @@ -11,8 +11,5 @@ ;; Variables -(spacemacs|defvar-company-backends emacs-lisp-mode) -(spacemacs|defvar-company-backends ielm-mode) - (spacemacs|define-jump-handlers emacs-lisp-mode) (spacemacs|define-jump-handlers lisp-interaction-mode) diff --git a/layers/+lang/emacs-lisp/packages.el b/layers/+lang/emacs-lisp/packages.el index a60d3a485..a7f1c2aef 100644 --- a/layers/+lang/emacs-lisp/packages.el +++ b/layers/+lang/emacs-lisp/packages.el @@ -46,8 +46,10 @@ (lisp-indent-line)))))) (defun emacs-lisp/post-init-company () - (spacemacs|add-company-hook ielm-mode) - (push '(company-files company-capf) company-backends-ielm-mode)) + (spacemacs|add-company-backends :backends company-capf + :modes emacs-lisp-mode) + (spacemacs|add-company-backends :backends (company-files company-capf) + :modes ielm-mode)) (defun emacs-lisp/post-init-eldoc () (add-hook 'emacs-lisp-mode-hook 'eldoc-mode)) @@ -101,10 +103,7 @@ "gG" 'spacemacs/nav-find-elisp-thing-at-point-other-window "," 'lisp-state-toggle-lisp-state "tb" 'spacemacs/ert-run-tests-buffer - "tq" 'ert)) - ;; company support - (push 'company-capf company-backends-emacs-lisp-mode) - (spacemacs|add-company-hook emacs-lisp-mode)) + "tq" 'ert))) (defun emacs-lisp/init-macrostep () (use-package macrostep diff --git a/layers/+lang/faust/config.el b/layers/+lang/faust/config.el index 7d20f6890..60e4d1afb 100644 --- a/layers/+lang/faust/config.el +++ b/layers/+lang/faust/config.el @@ -11,6 +11,4 @@ ;; Variables -(spacemacs|defvar-company-backends faust-mode) - (spacemacs|define-jump-handlers faust-mode) diff --git a/layers/+lang/faust/packages.el b/layers/+lang/faust/packages.el index e4d3192b9..74265ef3f 100644 --- a/layers/+lang/faust/packages.el +++ b/layers/+lang/faust/packages.el @@ -17,7 +17,7 @@ yasnippet)) (defun faust/post-init-company () - (spacemacs|add-company-hook faust-mode)) + (spacemacs|add-company-backends :modes faust-mode)) (defun faust/init-faust-mode () (use-package faust-mode diff --git a/layers/+lang/go/config.el b/layers/+lang/go/config.el index 0332cb1c8..153d1e64a 100644 --- a/layers/+lang/go/config.el +++ b/layers/+lang/go/config.el @@ -11,8 +11,6 @@ ;; variables -(spacemacs|defvar-company-backends go-mode) - (spacemacs|define-jump-handlers go-mode godef-jump) (defvar go-use-gocheck-for-testing nil diff --git a/layers/+lang/go/packages.el b/layers/+lang/go/packages.el index bb32f887a..1cc506b11 100644 --- a/layers/+lang/go/packages.el +++ b/layers/+lang/go/packages.el @@ -1,6 +1,5 @@ (setq go-packages '( - company (company-go :toggle (configuration-layer/package-usedp 'company)) flycheck (flycheck-gometalinter :toggle (and go-use-gometalinter @@ -15,16 +14,14 @@ )) -(defun go/post-init-company () - (spacemacs|add-company-hook go-mode)) - (defun go/init-company-go () (use-package company-go :defer t :init - (progn - (setq company-go-show-annotation t) - (push 'company-go company-backends-go-mode)))) + (spacemacs|add-company-backends + :backends company-go + :modes go-mode + :variables company-go-show-annotation t))) (defun go/post-init-flycheck () (spacemacs/add-flycheck-hook 'go-mode)) diff --git a/layers/+lang/haskell/config.el b/layers/+lang/haskell/config.el index 2a1a10773..2c9707c80 100644 --- a/layers/+lang/haskell/config.el +++ b/layers/+lang/haskell/config.el @@ -13,10 +13,6 @@ (setq haskell-modes '(haskell-mode literate-haskell-mode)) -(spacemacs|defvar-company-backends haskell-mode) -(spacemacs|defvar-company-backends haskell-cabal-mode) -(spacemacs|defvar-company-backends intero-repl-mode) - (spacemacs|define-jump-handlers haskell-mode haskell-mode-jump-to-def-or-tag) (defvar haskell-completion-backend 'ghci @@ -25,4 +21,6 @@ Available options are `ghci', `intero' and `ghc-mod'. Default is `ghci'.") (defvar haskell-enable-hindent-style nil - "Style to use for formatting with hindent; available are: fundamental johan-tibell chris-done gibiansky. If nil hindent is disabled.") + "Style to use for formatting with hindent; available are: +fundamental johan-tibell chris-done gibiansky. +If nil hindent is disabled.") diff --git a/layers/+lang/haskell/funcs.el b/layers/+lang/haskell/funcs.el index 065e8128c..3fc4e235e 100644 --- a/layers/+lang/haskell/funcs.el +++ b/layers/+lang/haskell/funcs.el @@ -20,12 +20,14 @@ (`intero (spacemacs-haskell//setup-intero))))) (defun spacemacs-haskell//setup-ghci () - (add-to-list 'company-backends-haskell-mode - '(company-ghci company-dabbrev-code company-yasnippet))) + (spacemacs|add-company-backends + :backends (company-ghci company-dabbrev-code company-yasnippet) + :modes haskell-mode)) (defun spacemacs-haskell//setup-ghc-mod () - (add-to-list 'company-backends-haskell-mode - '(company-ghc company-dabbrev-code company-yasnippet)) + (spacemacs|add-company-backends + :backends (company-ghc company-dabbrev-code company-yasnippet) + :modes haskell-mode) (ghc-init) (dolist (mode haskell-modes) (spacemacs/declare-prefix-for-mode mode "mm" "haskell/ghc-mod") @@ -47,8 +49,9 @@ (set-face-attribute 'ghc-face-warn nil :underline nil))) (defun spacemacs-haskell//setup-intero () - (add-to-list 'company-backends-haskell-mode - '(company-intero company-dabbrev-code company-yasnippet)) + (spacemacs|add-company-backends + :backends (company-intero company-dabbrev-code company-yasnippet) + :modes haskell-mode) (push 'intero-goto-definition spacemacs-jump-handlers) (intero-mode) (dolist (mode haskell-modes) diff --git a/layers/+lang/haskell/packages.el b/layers/+lang/haskell/packages.el index 919be6c36..6301882ad 100644 --- a/layers/+lang/haskell/packages.el +++ b/layers/+lang/haskell/packages.el @@ -12,7 +12,6 @@ (setq haskell-packages '( cmm-mode - company (company-cabal :toggle (configuration-layer/package-usedp 'company)) company-ghci company-ghc @@ -33,19 +32,12 @@ (use-package cmm-mode :defer t)) -(defun haskell/post-init-company () - (spacemacs|add-company-hook haskell-mode) - (spacemacs|add-company-hook haskell-cabal-mode) - (when (eq haskell-completion-backend 'intero) - (spacemacs|add-company-hook intero-repl-mode))) - (defun haskell/init-company-cabal () (use-package company-cabal - :if (configuration-layer/package-usedp 'company) :defer t - :init - (push '(company-cabal) - company-backends-haskell-cabal-mode))) + :init (spacemacs|add-company-backends + :backends company-cabal + :modes haskell-cabal-mode))) (defun haskell/init-company-ghci () (use-package company-ghci diff --git a/layers/+lang/html/config.el b/layers/+lang/html/config.el deleted file mode 100644 index 5a6b0518a..000000000 --- a/layers/+lang/html/config.el +++ /dev/null @@ -1,20 +0,0 @@ -;;; packages.el --- HTML Layer packages File for Spacemacs -;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors -;; -;; Author: Sylvain Benner -;; URL: https://github.com/syl20bnr/spacemacs -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 - -;; Variables - -(spacemacs|defvar-company-backends css-mode) -(spacemacs|defvar-company-backends jade-mode) -(spacemacs|defvar-company-backends slim-mode) -(spacemacs|defvar-company-backends web-mode) -;;TODO: when this becomes available -- uncomment. -@robbyoconnor -;; (spacemacs|defvar-company-backends haml-mode) - diff --git a/layers/+lang/html/funcs.el b/layers/+lang/html/funcs.el index 6aee2a969..52faddbd1 100644 --- a/layers/+lang/html/funcs.el +++ b/layers/+lang/html/funcs.el @@ -14,8 +14,3 @@ (if (bound-and-true-p yas-minor-mode) (call-interactively 'emmet-expand-yas) (call-interactively 'emmet-expand-line))) - -;; see https://github.com/osv/company-web/issues/4 -(defun spacemacs//company-web-minimum-prefix-length () - "Set company minimum prefix length to 0 for the current buffer only." - (set (make-local-variable 'company-minimum-prefix-length) 0)) diff --git a/layers/+lang/html/packages.el b/layers/+lang/html/packages.el index 7e688108b..5e967ff16 100644 --- a/layers/+lang/html/packages.el +++ b/layers/+lang/html/packages.el @@ -31,25 +31,33 @@ )) (defun html/post-init-company () - (spacemacs|add-company-hook css-mode)) + (spacemacs|add-company-backends + :backends company-css + :modes css-mode)) -;;TODO: whenever company-web makes a backend for haml-mode it should be added here. -- @robbyoconnor (defun html/init-company-web () (use-package company-web :defer t :init (progn - (spacemacs|add-company-hook jade-mode) - (spacemacs|add-company-hook slim-mode) - (spacemacs|add-company-hook web-mode)))) + (spacemacs|add-company-backends + :backends (company-web-html company-css) + :modes web-mode + :variables + ;; see https://github.com/osv/company-web/issues/4 + company-minimum-prefix-length 0) + (spacemacs|add-company-backends + :backends company-web-jade + :modes pug-mode) + (spacemacs|add-company-backends + :backends company-web-slim + :modes slim-mode)))) (defun html/init-css-mode () (use-package css-mode :defer t :init (progn - (push 'company-css company-backends-css-mode) - ;; Mark `css-indent-offset' as safe-local variable (put 'css-indent-offset 'safe-local-variable #'integerp) @@ -135,8 +143,7 @@ (defun html/init-pug-mode () (use-package pug-mode :defer t - :mode ("\\.pug$" . pug-mode) - :init (push 'company-web-jade company-backends-jade-mode))) + :mode ("\\.pug$" . pug-mode))) (defun html/init-sass-mode () (use-package sass-mode @@ -150,8 +157,7 @@ (defun html/init-slim-mode () (use-package slim-mode - :defer t - :init (push 'company-web-slim company-backends-slim-mode))) + :defer t)) (defun html/post-init-smartparens () (spacemacs/add-to-hooks @@ -174,10 +180,6 @@ (defun html/init-web-mode () (use-package web-mode :defer t - :init - (progn - (push '(company-web-html company-css) company-backends-web-mode) - (add-hook 'web-mode-hook 'spacemacs//company-web-minimum-prefix-length)) :config (progn (spacemacs/declare-prefix-for-mode 'web-mode "me" "errors") diff --git a/layers/+lang/idris/config.el b/layers/+lang/idris/config.el deleted file mode 100644 index b4b6cc927..000000000 --- a/layers/+lang/idris/config.el +++ /dev/null @@ -1,13 +0,0 @@ -;;; config.el --- Idris Layer config File for Spacemacs -;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors -;; -;; Author: Timothy Jones -;; URL: https://github.com/syl20bnr/spacemacs -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 - -(spacemacs|defvar-company-backends idris-mode) -(spacemacs|defvar-company-backends idris-repl-mode) diff --git a/layers/+lang/idris/packages.el b/layers/+lang/idris/packages.el index 7a9d9e585..36e64cc52 100644 --- a/layers/+lang/idris/packages.el +++ b/layers/+lang/idris/packages.el @@ -9,16 +9,18 @@ ;; ;;; License: GPLv3 -(setq idris-packages '(company - idris-mode - golden-ratio - popwin)) +(setq idris-packages + '( + company + idris-mode + golden-ratio + popwin + )) (defun idris/post-init-company () - (spacemacs|add-company-hook idris-mode) - (spacemacs|add-company-hook idris-repl-mode) - (push 'company-capf company-backends-idris-mode) - (push 'company-capf company-backends-idris-repl-mode)) + (spacemacs|add-company-backends + :backends company-capf + :modes idris-mode idris-repl-mode)) (defun idris/init-idris-mode () (use-package idris-mode diff --git a/layers/+lang/java/config.el b/layers/+lang/java/config.el index 170fc000f..a36e841e3 100644 --- a/layers/+lang/java/config.el +++ b/layers/+lang/java/config.el @@ -8,6 +8,6 @@ ;; ;;; License: GPLv3 -(spacemacs|defvar-company-backends java-mode) +;; variables (spacemacs|define-jump-handlers java-mode) diff --git a/layers/+lang/java/packages.el b/layers/+lang/java/packages.el index b15ff464a..647e1daac 100644 --- a/layers/+lang/java/packages.el +++ b/layers/+lang/java/packages.el @@ -11,21 +11,21 @@ (setq java-packages '( - company - (company-emacs-eclim :toggle (configuration-layer/package-usedp 'company)) + (company-emacs-eclim :toggle + (configuration-layer/package-usedp 'company)) eclim ggtags helm-gtags (java-mode :location built-in) )) -(defun java/post-init-company () - (spacemacs|add-company-hook java-mode)) - (defun java/init-company-emacs-eclim () (use-package company-emacs-eclim :defer t - :init (push 'company-emacs-eclim company-backends-java-mode))) + :init + (spacemacs|add-company-backends + :backends company-emacs-eclim + :modes java-mode))) (defun java/init-eclim () (use-package eclim @@ -34,7 +34,8 @@ :init (progn (add-hook 'java-mode-hook 'eclim-mode) - (add-to-list 'spacemacs-jump-handlers-java-mode 'eclim-java-find-declaration)) + (add-to-list 'spacemacs-jump-handlers-java-mode + 'eclim-java-find-declaration)) :config (progn (require 'eclimd) diff --git a/layers/+lang/javascript/config.el b/layers/+lang/javascript/config.el index 184e760f0..e6b7dd644 100644 --- a/layers/+lang/javascript/config.el +++ b/layers/+lang/javascript/config.el @@ -11,8 +11,6 @@ ;; Variables -(spacemacs|defvar-company-backends js2-mode) - (spacemacs|define-jump-handlers js2-mode) (defvar javascript-disable-tern-port-files t diff --git a/layers/+lang/javascript/packages.el b/layers/+lang/javascript/packages.el index ff1cda221..c0594ab06 100644 --- a/layers/+lang/javascript/packages.el +++ b/layers/+lang/javascript/packages.el @@ -12,7 +12,6 @@ (setq javascript-packages '( coffee-mode - company (company-tern :toggle (configuration-layer/package-usedp 'company)) evil-matchit flycheck @@ -35,20 +34,19 @@ :init (progn ;; indent to right position after `evil-open-below' and `evil-open-above' - (add-hook 'coffee-mode-hook '(lambda () - (setq indent-line-function 'javascript/coffee-indent - evil-shift-width coffee-tab-width)))))) - -(defun javascript/post-init-company () - (spacemacs|add-company-hook js2-mode)) + (add-hook 'coffee-mode-hook + '(lambda () + (setq indent-line-function 'javascript/coffee-indent + evil-shift-width coffee-tab-width)))))) (defun javascript/init-company-tern () (use-package company-tern :if (and (configuration-layer/package-usedp 'company) (configuration-layer/package-usedp 'tern)) :defer t - :init - (push 'company-tern company-backends-js2-mode))) + :init (spacemacs|add-company-backends + :backends company-tern + :modes js2-mode))) (defun javascript/post-init-flycheck () (dolist (mode '(coffee-mode js2-mode json-mode)) diff --git a/layers/+lang/latex/config.el b/layers/+lang/latex/config.el index 68f1ac4f1..67ac1639e 100644 --- a/layers/+lang/latex/config.el +++ b/layers/+lang/latex/config.el @@ -11,8 +11,6 @@ ;; variables -(spacemacs|defvar-company-backends LaTeX-mode) - (spacemacs|define-jump-handlers latex-mode) (defvar latex-build-command (if (executable-find "latexmk") "LatexMk" "LaTeX") diff --git a/layers/+lang/latex/packages.el b/layers/+lang/latex/packages.el index 5486ea9a0..512c2afdf 100644 --- a/layers/+lang/latex/packages.el +++ b/layers/+lang/latex/packages.el @@ -13,7 +13,6 @@ '( auctex (auctex-latexmk :toggle (string= "LatexMk" latex-build-command)) - company (company-auctex :toggle (configuration-layer/package-usedp 'company)) evil-matchit (reftex :location built-in) @@ -130,19 +129,17 @@ :post-config (auctex-latexmk-setup))))) -(defun latex/post-init-company () - (spacemacs|add-company-hook LaTeX-mode)) - (defun latex/init-company-auctex () (use-package company-auctex :defer t - :init - (progn - (push 'company-auctex-labels company-backends-LaTeX-mode) - (push 'company-auctex-bibs company-backends-LaTeX-mode) - (push '(company-auctex-macros - company-auctex-symbols - company-auctex-environments) company-backends-LaTeX-mode)))) + :init (spacemacs|add-company-backends + :backends + company-auctex-labels + company-auctex-bibs + (company-auctex-macros + company-auctex-symbols + company-auctex-environments) + :modes LaTeX-mode))) (defun latex/post-init-evil-matchit () (add-hook 'LaTeX-mode-hook 'evil-matchit-mode)) diff --git a/layers/+lang/markdown/config.el b/layers/+lang/markdown/config.el index 3326b8eb0..e718ff5ab 100644 --- a/layers/+lang/markdown/config.el +++ b/layers/+lang/markdown/config.el @@ -11,7 +11,5 @@ ;; variables -(spacemacs|defvar-company-backends markdown-mode) - (defvar markdown-live-preview-engine 'eww "Possibe values are `eww' (built-in browser) or `vmd' (installed with `npm').") diff --git a/layers/+lang/markdown/packages.el b/layers/+lang/markdown/packages.el index 574b57e03..98aae1f36 100644 --- a/layers/+lang/markdown/packages.el +++ b/layers/+lang/markdown/packages.el @@ -23,11 +23,12 @@ )) (defun markdown/post-init-company () - (spacemacs|add-company-hook markdown-mode) - (push 'company-capf company-backends-markdown-mode)) + (spacemacs|add-company-backends :backends company-capf :modes markdown-mode)) (defun markdown/post-init-company-emoji () - (push 'company-emoji company-backends-markdown-mode)) + (spacemacs|add-company-backends + :backends company-emoji + :modes markdown-mode)) (defun markdown/post-init-emoji-cheat-sheet-plus () (add-hook 'markdown-mode-hook 'emoji-cheat-sheet-plus-display-mode)) diff --git a/layers/+lang/nim/config.el b/layers/+lang/nim/config.el index ac78366dd..b38cb06b2 100644 --- a/layers/+lang/nim/config.el +++ b/layers/+lang/nim/config.el @@ -11,7 +11,4 @@ ;; Variables -(spacemacs|defvar-company-backends nim-mode) -(spacemacs|defvar-company-backends nimscript-mode) - (spacemacs|define-jump-handlers nim-mode) diff --git a/layers/+lang/nim/packages.el b/layers/+lang/nim/packages.el index 04450d448..ac0568367 100644 --- a/layers/+lang/nim/packages.el +++ b/layers/+lang/nim/packages.el @@ -5,8 +5,9 @@ nim-mode)) (defun nim/post-init-company () - (spacemacs|add-company-hook nim-mode) - (spacemacs|add-company-hook nimscript-mode)) + (spacemacs|add-company-backends + :backends company-capf + :modes nim-mode nimscript-mode)) (defun nim/post-init-flycheck () (spacemacs/add-flycheck-hook 'nim-mode)) @@ -20,8 +21,6 @@ :defer t :init (progn - (when (configuration-layer/package-usedp 'company) - (push 'company-capf company-backends-nim-mode)) (add-hook 'nim-mode-hook 'nimsuggest-mode) (push 'nimsuggest-find-definition spacemacs-jump-handlers-nim-mode)) :config diff --git a/layers/+lang/ocaml/config.el b/layers/+lang/ocaml/config.el index 845829acb..c6696b390 100644 --- a/layers/+lang/ocaml/config.el +++ b/layers/+lang/ocaml/config.el @@ -9,6 +9,6 @@ ;; ;;; License: GPLv3 -(spacemacs|defvar-company-backends merlin-mode) +;; variables (spacemacs|define-jump-handlers tuareg-mode) diff --git a/layers/+lang/ocaml/packages.el b/layers/+lang/ocaml/packages.el index 311e59928..97f84d545 100644 --- a/layers/+lang/ocaml/packages.el +++ b/layers/+lang/ocaml/packages.el @@ -25,7 +25,11 @@ )) (defun ocaml/post-init-company () - (spacemacs|add-company-hook merlin-mode)) + (when (configuration-layer/layer-usedp 'merlin) + (spacemacs|add-company-backends + :backends merlin-company-backend + :modes merlin-mode + :variables merlin-completion-with-doc t))) (when (configuration-layer/layer-usedp 'syntax-checking) (defun ocaml/post-init-flycheck () @@ -54,8 +58,6 @@ (add-to-list 'spacemacs-jump-handlers-tuareg-mode 'spacemacs/merlin-locate) (add-hook 'tuareg-mode-hook 'merlin-mode) - (setq merlin-completion-with-doc t) - (push 'merlin-company-backend company-backends-merlin-mode) (spacemacs/set-leader-keys-for-major-mode 'tuareg-mode "cp" 'merlin-project-check "cv" 'merlin-goto-project-file diff --git a/layers/+lang/php/config.el b/layers/+lang/php/config.el index 6cfefb4ed..64a1e1008 100644 --- a/layers/+lang/php/config.el +++ b/layers/+lang/php/config.el @@ -11,6 +11,4 @@ ;; variables -(spacemacs|defvar-company-backends php-mode) - (spacemacs|define-jump-handlers php-mode) diff --git a/layers/+lang/php/packages.el b/layers/+lang/php/packages.el index 3fa6b4244..d82040154 100644 --- a/layers/+lang/php/packages.el +++ b/layers/+lang/php/packages.el @@ -25,7 +25,7 @@ )) (defun php/post-init-company () - (spacemacs|add-company-hook php-mode)) + (spacemacs|add-company-backends :modes php-mode)) (defun php/init-drupal-mode () (use-package drupal-mode diff --git a/layers/+lang/purescript/config.el b/layers/+lang/purescript/config.el index 0eaeea065..f789a5992 100644 --- a/layers/+lang/purescript/config.el +++ b/layers/+lang/purescript/config.el @@ -9,7 +9,7 @@ ;; ;;; License: GPLv3 -(spacemacs|defvar-company-backends purescript-mode) +;; variables (spacemacs|define-jump-handlers purescript-mode) diff --git a/layers/+lang/purescript/packages.el b/layers/+lang/purescript/packages.el index 55c9e882a..99b0e169e 100644 --- a/layers/+lang/purescript/packages.el +++ b/layers/+lang/purescript/packages.el @@ -19,7 +19,10 @@ popwin)) (defun purescript/post-init-company () - (spacemacs|add-company-hook purescript-mode)) + (when (configuration-layer/package-usedp 'psc-ide) + (spacemacs|add-company-backends + :backends company-psc-ide-backend + :modes purescript-mode))) (defun purescript/post-init-flycheck () (spacemacs/add-flycheck-hook 'purescript-mode)) @@ -57,7 +60,6 @@ (progn (add-hook 'purescript-mode-hook 'psc-ide-mode) (spacemacs/declare-prefix-for-mode 'purescript-mode "mm" "purescript/psc-ide") - (push 'company-psc-ide-backend company-backends-purescript-mode) (customize-set-variable 'psc-ide-add-import-on-completion purescript-add-import-on-completion) (customize-set-variable 'psc-ide-rebuild-on-save purescript-enable-rebuild-on-save) diff --git a/layers/+lang/python/config.el b/layers/+lang/python/config.el index 15c9e8b89..5d7ed1e08 100644 --- a/layers/+lang/python/config.el +++ b/layers/+lang/python/config.el @@ -11,10 +11,6 @@ ;; variables -(spacemacs|defvar-company-backends python-mode) -(spacemacs|defvar-company-backends inferior-python-mode) -(spacemacs|defvar-company-backends pip-requirements-mode) - (spacemacs|define-jump-handlers python-mode) (spacemacs|define-jump-handlers cython-mode anaconda-mode-goto) diff --git a/layers/+lang/python/packages.el b/layers/+lang/python/packages.el index 4ea36b41b..d072f51b0 100644 --- a/layers/+lang/python/packages.el +++ b/layers/+lang/python/packages.el @@ -65,18 +65,23 @@ (evil--jumps-push))))) (defun python/post-init-company () - (spacemacs|add-company-hook python-mode) - (spacemacs|add-company-hook inferior-python-mode) - (push '(company-files company-capf) company-backends-inferior-python-mode) - (add-hook 'inferior-python-mode-hook (lambda () - (setq-local company-minimum-prefix-length 0) - (setq-local company-idle-delay 0.5)))) + (spacemacs|add-company-backends + :backends (company-files company-capf) + :modes inferior-python-mode + :variables + company-minimum-prefix-length 0 + company-idle-delay 0.5) + (when (configuration-layer/package-usedp 'pip-requirements) + (spacemacs|add-company-backends + :backends company-capf + :modes pip-requirements-mode))) (defun python/init-company-anaconda () (use-package company-anaconda :defer t - :init - (push 'company-anaconda company-backends-python-mode))) + :init (spacemacs|add-company-backends + :backends 'company-anaconda + :modes python-mode))) (defun python/init-cython-mode () (use-package cython-mode @@ -165,12 +170,7 @@ (defun python/init-pip-requirements () (use-package pip-requirements - :defer t - :init - (progn - ;; company support - (push 'company-capf company-backends-pip-requirements-mode) - (spacemacs|add-company-hook pip-requirements-mode)))) + :defer t)) (defun python/init-py-isort () (use-package py-isort diff --git a/layers/+lang/ruby/config.el b/layers/+lang/ruby/config.el index 617d97b58..54a39f202 100644 --- a/layers/+lang/ruby/config.el +++ b/layers/+lang/ruby/config.el @@ -11,9 +11,6 @@ ;; Variables -(spacemacs|defvar-company-backends enh-ruby-mode) -(spacemacs|defvar-company-backends ruby-mode) - (spacemacs|define-jump-handlers enh-ruby-mode) (spacemacs|define-jump-handlers ruby-mode) diff --git a/layers/+lang/ruby/packages.el b/layers/+lang/ruby/packages.el index aa681bed4..b782519c6 100644 --- a/layers/+lang/ruby/packages.el +++ b/layers/+lang/ruby/packages.el @@ -47,8 +47,10 @@ "bo" 'bundle-open)))) (defun ruby/post-init-company () - (spacemacs|add-company-hook ruby-mode) - (spacemacs|add-company-hook enh-ruby-mode) + (when (configuration-layer/package-usedp 'robe) + (spacemacs|add-company-backends + :backends company-robe + :modes ruby-mode enh-ruby-mode)) (with-eval-after-load 'company-dabbrev-code (dolist (mode '(ruby-mode enh-ruby-mode)) (push mode company-dabbrev-code-modes)))) @@ -128,9 +130,6 @@ (spacemacs/register-repl 'robe 'robe-start "robe") (dolist (hook '(ruby-mode-hook enh-ruby-mode-hook)) (add-hook hook 'robe-mode)) - (when (configuration-layer/package-usedp 'company) - (push 'company-robe company-backends-enh-ruby-mode) - (push 'company-robe company-backends-ruby-mode)) (spacemacs/add-to-hooks 'robe-jump '(spacemacs-jump-handlers-ruby-mode spacemacs-jump-handlers-enh-ruby-mode))) diff --git a/layers/+lang/rust/config.el b/layers/+lang/rust/config.el index d81f7e31f..6e3765372 100644 --- a/layers/+lang/rust/config.el +++ b/layers/+lang/rust/config.el @@ -11,6 +11,4 @@ ;; Variables -(spacemacs|defvar-company-backends rust-mode) - (spacemacs|define-jump-handlers rust-mode) diff --git a/layers/+lang/rust/packages.el b/layers/+lang/rust/packages.el index ae84561bc..666ccefad 100644 --- a/layers/+lang/rust/packages.el +++ b/layers/+lang/rust/packages.el @@ -73,11 +73,10 @@ :mode "/\\(Cargo.lock\\|\\.cargo/config\\)\\'")) (defun rust/post-init-company () - (push 'company-capf company-backends-rust-mode) - (spacemacs|add-company-hook rust-mode) - (add-hook 'rust-mode-hook - (lambda () - (setq-local company-tooltip-align-annotations t)))) + (spacemacs|add-company-backends + :backends company-capf + :modes rust-mode + :variables company-tooltip-align-annotations t)) (defun rust/post-init-smartparens () (with-eval-after-load 'smartparens diff --git a/layers/+lang/scheme/config.el b/layers/+lang/scheme/config.el index 706f8c33d..5d4999e27 100644 --- a/layers/+lang/scheme/config.el +++ b/layers/+lang/scheme/config.el @@ -9,6 +9,6 @@ ;; ;;; License: GPLv3 -(spacemacs|define-jump-handlers scheme-mode geiser-edit-symbol-at-point) +;; variables -(spacemacs|defvar-company-backends scheme-mode) +(spacemacs|define-jump-handlers scheme-mode geiser-edit-symbol-at-point) diff --git a/layers/+lang/scheme/packages.el b/layers/+lang/scheme/packages.el index 23b62c703..3c0f88a4c 100644 --- a/layers/+lang/scheme/packages.el +++ b/layers/+lang/scheme/packages.el @@ -19,23 +19,22 @@ (defun scheme/post-init-company () ;; Geiser provides completion as long as company mode is loaded. - (spacemacs|add-company-hook scheme-mode)) + (spacemacs|add-company-backends :modes scheme-mode)) (defun scheme/init-geiser () (use-package geiser :commands run-geiser - :init - (progn - (spacemacs/register-repl 'geiser 'geiser-mode-switch-to-repl "geiser")) + :init (spacemacs/register-repl 'geiser 'geiser-mode-switch-to-repl "geiser") :config (progn + ;; prefixes (spacemacs/declare-prefix-for-mode 'scheme-mode "mc" "compiling") (spacemacs/declare-prefix-for-mode 'scheme-mode "mg" "navigation") (spacemacs/declare-prefix-for-mode 'scheme-mode "mh" "documentation") (spacemacs/declare-prefix-for-mode 'scheme-mode "mi" "insertion") (spacemacs/declare-prefix-for-mode 'scheme-mode "mm" "macroexpansion") (spacemacs/declare-prefix-for-mode 'scheme-mode "ms" "repl") - + ;; key bindings (spacemacs/set-leader-keys-for-major-mode 'scheme-mode "'" 'geiser-mode-switch-to-repl "," 'lisp-state-toggle-lisp-state diff --git a/layers/+lang/shaders/config.el b/layers/+lang/shaders/config.el deleted file mode 100644 index 127217248..000000000 --- a/layers/+lang/shaders/config.el +++ /dev/null @@ -1,14 +0,0 @@ -;;; config.el --- Shaders Layer configuration File for Spacemacs -;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors -;; -;; Author: Boris Buliga -;; URL: https://github.com/syl20bnr/spacemacs -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 - -;; Variables - -(spacemacs|defvar-company-backends glsl-mode) diff --git a/layers/+lang/shaders/packages.el b/layers/+lang/shaders/packages.el index 5378da578..209d3e657 100644 --- a/layers/+lang/shaders/packages.el +++ b/layers/+lang/shaders/packages.el @@ -10,23 +10,18 @@ ;;; License: GLPv3 (setq shaders-packages '(glsl-mode - company - (company-glsl - :location (recipe - :fetcher github - :repo "Kaali/company-glsl") - :toggle (and (configuration-layer/package-usedp 'company) - (executable-find "glslangValidator"))))) - -(defun shaders/post-init-company () - (spacemacs|add-company-hook glsl-mode)) + (company-glsl :location (recipe + :fetcher github + :repo "Kaali/company-glsl") + :toggle (and (configuration-layer/package-usedp 'company) + (executable-find "glslangValidator"))))) (defun shaders/init-company-glsl () (use-package company-glsl :defer t - :init - (push 'company-glsl - company-backends-glsl-mode))) + :init (spacemacs|add-company-backends + :backends company-glsl + :modes glsl-mode))) (defun shaders/init-glsl-mode () "Initialize GLSL mode" diff --git a/layers/+lang/shell-scripts/config.el b/layers/+lang/shell-scripts/config.el index e27a985b0..916f8a6e8 100644 --- a/layers/+lang/shell-scripts/config.el +++ b/layers/+lang/shell-scripts/config.el @@ -10,7 +10,5 @@ ;;; License: GPLv3 ;; variables -(spacemacs|defvar-company-backends sh-mode) -(spacemacs|defvar-company-backends fish-mode) (spacemacs|define-jump-handlers sh-mode) diff --git a/layers/+lang/shell-scripts/packages.el b/layers/+lang/shell-scripts/packages.el index 04c189b5c..71a83cb62 100644 --- a/layers/+lang/shell-scripts/packages.el +++ b/layers/+lang/shell-scripts/packages.el @@ -11,7 +11,6 @@ (setq shell-scripts-packages '( - company (company-shell :toggle (configuration-layer/package-usedp 'company)) fish-mode flycheck @@ -21,17 +20,17 @@ (sh-script :location built-in) )) -(defun shell-scripts/post-init-company () - (spacemacs|add-company-hook sh-mode) - (spacemacs|add-company-hook fish-mode)) - (defun shell-scripts/init-company-shell () (use-package company-shell :defer t :init (progn - (push 'company-shell company-backends-sh-mode) - (push '(company-shell company-fish-shell) company-backends-fish-mode)))) + (spacemacs|add-company-backends + :backends company-shell + :modes sh-mode) + (spacemacs|add-company-backends + :backends (company-shell company-fish-shell) + :modes fish-mode)))) (defun shell-scripts/post-init-flycheck () (spacemacs/add-flycheck-hook 'sh-mode)) diff --git a/layers/+lang/typescript/config.el b/layers/+lang/typescript/config.el index 06af5b7d7..1869b1484 100644 --- a/layers/+lang/typescript/config.el +++ b/layers/+lang/typescript/config.el @@ -9,7 +9,7 @@ ;; ;;; License: GPLv3 -(spacemacs|defvar-company-backends typescript-mode) +;; variables (defvar typescript-fmt-on-save nil "Run formatter on buffer save.") diff --git a/layers/+lang/typescript/packages.el b/layers/+lang/typescript/packages.el index 8beedd47e..a83f34a20 100644 --- a/layers/+lang/typescript/packages.el +++ b/layers/+lang/typescript/packages.el @@ -20,7 +20,10 @@ )) (defun typescript/post-init-company () - (spacemacs|add-company-hook typescript-mode)) + (when (configuration-layer/package-usedp 'tide) + (spacemacs|add-company-backends + :backends company-tide + :modes typescript-mode))) (defun php/post-init-eldoc () (add-hook 'typescript-mode-hook 'eldoc-mode)) @@ -39,7 +42,7 @@ (kbd "C-j") 'tide-find-next-reference (kbd "C-l") 'tide-goto-reference) (add-hook 'typescript-mode-hook 'tide-setup) - (push 'company-tide company-backends-typescript-mode)) + (add-to-list 'spacemacs-jump-handlers-typescript-mode 'tide-jump-to-definition)) :config (progn (spacemacs/declare-prefix-for-mode 'typescript-mode "mg" "goto") diff --git a/layers/+lang/yaml/config.el b/layers/+lang/yaml/config.el deleted file mode 100644 index fa10b6dd6..000000000 --- a/layers/+lang/yaml/config.el +++ /dev/null @@ -1,14 +0,0 @@ -;;; config.el --- YAML Layer configuration File for Spacemacs -;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors -;; -;; Author: Sylvain Benner -;; URL: https://github.com/syl20bnr/spacemacs -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 - -;; variables - -(spacemacs|defvar-company-backends yaml-mode) diff --git a/layers/+lang/yaml/packages.el b/layers/+lang/yaml/packages.el index de5fe7420..ee8f5eb1d 100644 --- a/layers/+lang/yaml/packages.el +++ b/layers/+lang/yaml/packages.el @@ -13,7 +13,7 @@ yaml-mode)) (defun yaml/post-init-company () - (spacemacs|add-company-hook yaml-mode)) + (spacemacs|add-company-backends :modes yaml-mode)) (defun yaml/post-init-flycheck () (spacemacs/add-flycheck-hook 'yaml-mode)) diff --git a/layers/+os/nixos/config.el b/layers/+os/nixos/config.el deleted file mode 100644 index 05f47019b..000000000 --- a/layers/+os/nixos/config.el +++ /dev/null @@ -1 +0,0 @@ -(spacemacs|defvar-company-backends nix-mode) diff --git a/layers/+os/nixos/packages.el b/layers/+os/nixos/packages.el index 91b0e9b7e..f68726bdb 100644 --- a/layers/+os/nixos/packages.el +++ b/layers/+os/nixos/packages.el @@ -1,21 +1,24 @@ (setq nixos-packages '( company - (company-nixos-options :toggle (configuration-layer/package-usedp 'company)) + (company-nixos-options :toggle + (configuration-layer/package-usedp 'company)) (helm-nixos-options :toggle (configuration-layer/package-usedp 'helm)) nix-mode nixos-options )) (defun nixos/post-init-company () - (spacemacs|add-company-hook nix-mode) - (push 'company-capf company-backends-nix-mode)) + (let ((backends '(company-capf))) + (when (configuration-layer/package-usedp 'company-nixos-options) + (add-to-list 'backends 'company-nixos-options t)) + (eval `(spacemacs|add-company-backends + :backends ,backends + :modes nix-mode)))) (defun nixos/init-company-nixos-options () (use-package company-nixos-options - :defer t - :init - (push 'company-nixos-options company-backends-nix-mode))) + :defer t)) (defun nixos/init-helm-nixos-options () (use-package helm-nixos-options diff --git a/layers/+tools/cfengine/config.el b/layers/+tools/cfengine/config.el deleted file mode 100644 index 39d6d7eb2..000000000 --- a/layers/+tools/cfengine/config.el +++ /dev/null @@ -1,12 +0,0 @@ -;;; config.el --- CFEgine Layer configuration File for Spacemacs -;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors -;; -;; Author: Nick Anderson -;; URL: https://github.com/syl20bnr/spacemacs -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 - -(spacemacs|defvar-company-backends cfengine3-mode) diff --git a/layers/+tools/cfengine/packages.el b/layers/+tools/cfengine/packages.el index 7ccba0f02..632885dfb 100644 --- a/layers/+tools/cfengine/packages.el +++ b/layers/+tools/cfengine/packages.el @@ -25,7 +25,7 @@ "j" 'cfengine3-reformat-json-string))) (defun cfengine/post-init-company () - (spacemacs|add-company-hook cfengine3-mode)) + (spacemacs|add-company-backends :modes cfengine3-mode)) (defun cfengine/post-init-eldoc () (add-hook 'cfengine3-mode-hook 'eldoc-mode)) diff --git a/layers/+tools/finance/config.el b/layers/+tools/finance/config.el deleted file mode 100644 index f64dcdf26..000000000 --- a/layers/+tools/finance/config.el +++ /dev/null @@ -1,14 +0,0 @@ -;;; config.el --- Finance Layer configuration File for Spacemacs -;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors -;; -;; Author: Sylvain Benner -;; URL: https://github.com/syl20bnr/spacemacs -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 - -;; Variables - -(spacemacs|defvar-company-backends ledger-mode) diff --git a/layers/+tools/finance/packages.el b/layers/+tools/finance/packages.el index 53876a2a6..d8a2450d4 100644 --- a/layers/+tools/finance/packages.el +++ b/layers/+tools/finance/packages.el @@ -16,6 +16,10 @@ ledger-mode )) +(defun finance/post-init-company () + (spacemacs|add-company-backends + :backends company-capf + :modes ledger-mode)) (defun finance/init-flycheck-ledger () (with-eval-after-load 'flycheck @@ -28,7 +32,6 @@ :init (progn (setq ledger-post-amount-alignment-column 62) - (push 'company-capf company-backends-ledger-mode) (spacemacs/set-leader-keys-for-major-mode 'ledger-mode "hd" 'ledger-delete-current-transaction "a" 'ledger-add-transaction @@ -48,6 +51,3 @@ ;; TODO remove this hack if the limitation is removed upstream (add-hook 'ledger-mode-hook 'evil-normalize-keymaps) (evilified-state-evilify ledger-report-mode ledger-report-mode-map)))) - -(defun finance/post-init-company () - (spacemacs|add-company-hook ledger-mode)) diff --git a/layers/+tools/puppet/config.el b/layers/+tools/puppet/config.el deleted file mode 100644 index a1aee5565..000000000 --- a/layers/+tools/puppet/config.el +++ /dev/null @@ -1,14 +0,0 @@ -;;; config.el --- Puppet layer configuration File for Spacemacs -;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors -;; -;; Author: Sylvain Benner -;; URL: https://github.com/syl20bnr/spacemacs -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 - -;; Variables - -(spacemacs|defvar-company-backends puppet-mode) diff --git a/layers/+tools/puppet/packages.el b/layers/+tools/puppet/packages.el index 4a3f8f801..55e4307e4 100644 --- a/layers/+tools/puppet/packages.el +++ b/layers/+tools/puppet/packages.el @@ -35,7 +35,7 @@ )))) (defun puppet/post-init-company () - (spacemacs|add-company-hook puppet-mode)) + (spacemacs|add-company-backends :modes puppet-mode)) (defun puppet/post-init-flycheck () (spacemacs/add-flycheck-hook 'puppet-mode)) diff --git a/layers/+tools/restclient/config.el b/layers/+tools/restclient/config.el index 5c81909c6..9bfddf39c 100644 --- a/layers/+tools/restclient/config.el +++ b/layers/+tools/restclient/config.el @@ -9,7 +9,7 @@ ;; ;;; License: GPLv3 +;; variables + (defvar restclient-use-org nil "If non-nil use `ob-http' instead of `restclient'.") - -(spacemacs|defvar-company-backends restclient-mode) diff --git a/layers/+tools/restclient/packages.el b/layers/+tools/restclient/packages.el index 0b780a6d3..0fd3bea30 100644 --- a/layers/+tools/restclient/packages.el +++ b/layers/+tools/restclient/packages.el @@ -10,7 +10,6 @@ ;;; License: GPLv3 (setq restclient-packages '( - company (company-restclient :toggle (configuration-layer/package-usedp 'company)) golden-ratio ob-http @@ -53,13 +52,12 @@ "R" 'restclient-http-send-current-raw "y" 'restclient-copy-curl-command)))) -(defun restclient/post-init-company () - (spacemacs|add-company-hook restclient-mode)) - (defun restclient/init-company-restclient () (use-package company-restclient :defer t - :init (push 'company-restclient company-backends-restclient-mode))) + :init (spacemacs|add-company-backends + :backends company-restclient + :modes restclient-mode))) (defun restclient/init-restclient-helm () (use-package restclient-helm diff --git a/layers/+tools/shell/config.el b/layers/+tools/shell/config.el index 2180aa8db..4f6101496 100644 --- a/layers/+tools/shell/config.el +++ b/layers/+tools/shell/config.el @@ -20,8 +20,6 @@ ;; Variables -(spacemacs|defvar-company-backends eshell-mode) - (defvar shell-default-shell (if (eq window-system 'w32) 'eshell 'ansi-term) diff --git a/layers/+tools/shell/packages.el b/layers/+tools/shell/packages.el index 825f84682..2701c8283 100644 --- a/layers/+tools/shell/packages.el +++ b/layers/+tools/shell/packages.el @@ -38,8 +38,7 @@ (spacemacs|use-package-add-hook eshell :post-init (progn - (push 'company-capf company-backends-eshell-mode) - (spacemacs|add-company-hook eshell-mode) + (spacemacs|add-company-backends :backends company-capf :modes eshell-mode) (add-hook 'eshell-directory-change-hook 'spacemacs//toggle-shell-auto-completion-based-on-path) ;; The default frontend screws everything up in short windows like