From cec01a4a3ebd07fe34dc7a54972b422e1a8c2a8b Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 1 Sep 2016 18:05:31 +0200 Subject: spacemacs: add irony as company backend This should provide auto-completion with clang's help. --- spacemacs/.emacs.d/private/irony-mode/packages.el | 44 +++++++++++++++++++++++ spacemacs/.spacemacs | 14 +++++--- 2 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 spacemacs/.emacs.d/private/irony-mode/packages.el diff --git a/spacemacs/.emacs.d/private/irony-mode/packages.el b/spacemacs/.emacs.d/private/irony-mode/packages.el new file mode 100644 index 0000000..ab7fd30 --- /dev/null +++ b/spacemacs/.emacs.d/private/irony-mode/packages.el @@ -0,0 +1,44 @@ +(setq irony-mode-packages + '(irony + company-irony + flycheck-irony)) + +(setq irony-mode-excluded-packages + '(auto-complete-clang)) + +(defun irony-mode/init-irony () + (use-package irony + :defer t + :init + (progn + (add-hook 'c++-mode-hook 'irony-mode) + (add-hook 'c-mode-hook 'irony-mode) + (add-hook 'objc-mode-hook 'irony-mode) + (add-hook 'irony-mode-hook + (lambda () + (define-key irony-mode-map [remap completion-at-point] + 'irony-completion-at-point-async) + (define-key irony-mode-map [remap complete-symbol] + 'irony-completion-at-point-async))) + (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options) + (spacemacs|diminish irony-mode " Ⓘ" " I")))) + +(defun irony-mode/init-company-irony () + (use-package company-irony + :defer t + :init + (progn + (eval-after-load 'company + '(add-to-list 'company-backends 'company-irony)) + (add-hook 'irony-mode-hook 'company-irony-setup-begin-commands) + (add-hook 'irony-mode-hook 'company-mode)))) + +(defun irony-mode/init-flycheck-irony () + (use-package flycheck-irony + ;; :defer t ; fix this ??? + :init + (progn + (eval-after-load 'flycheck + '(add-to-list 'flycheck-checkers 'irony)) + (add-hook 'irony-mode-hook 'flycheck-mode)))) + diff --git a/spacemacs/.spacemacs b/spacemacs/.spacemacs index bac8acc..4cc25ea 100644 --- a/spacemacs/.spacemacs +++ b/spacemacs/.spacemacs @@ -3,6 +3,9 @@ dotspacemacs-distribution 'spacemacs dotspacemacs-configuration-layers '( auto-completion + irony-mode + version-control + git haskell python c-c++ @@ -27,19 +30,20 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - '(ac-ispell-requires 4) + '(ac-ispell-requires 4 t) '(ahs-case-fold-search nil) '(ahs-default-range (quote ahs-range-whole-buffer)) '(ahs-idle-interval 0.25) '(ahs-idle-timer 0 t) '(ahs-inhibit-face-list nil) + '(c-basic-offset 4) '(haskell-interactive-popup-error nil t) '(haskell-mode-hook (quote (spacemacs/init-haskell-mode ghc-init)) t) - '(haskell-notify-p t) - '(haskell-process-auto-import-loaded-modules t) - '(haskell-process-suggest-remove-import-lines t) + '(haskell-notify-p t t) + '(haskell-process-auto-import-loaded-modules t t) + '(haskell-process-suggest-remove-import-lines t t) '(haskell-process-type (quote auto)) - '(haskell-stylish-on-save nil) + '(haskell-stylish-on-save nil t) '(haskell-tags-on-save t) '(ring-bell-function (quote ignore) t) '(safe-local-variable-values (quote ((encoding . utf-8))))) -- cgit v1.2.3