From fb3c4dd6080bc8a41d5a5828ac5ac6b8dad99e55 Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Tue, 2 Jun 2015 23:18:31 -0400 Subject: [PATCH] rust layer: fix flycheck setup --- contrib/!lang/rust/packages.el | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/contrib/!lang/rust/packages.el b/contrib/!lang/rust/packages.el index f4b870454..8a4a7f04a 100644 --- a/contrib/!lang/rust/packages.el +++ b/contrib/!lang/rust/packages.el @@ -12,6 +12,7 @@ (defvar rust-packages '( + flycheck flycheck-rust rust-mode toml-mode @@ -19,11 +20,16 @@ "List of all packages to install and/or initialize. Built-in packages which require an initialization must be listed explicitly in the list.") -(defun rust/init-flycheck-rust () - (use-package flycheck-rust - :defer t - :init - (add-hook 'flycheck-mode-hook #'flycheck-rust-setup))) +(defun rust/post-init-flycheck () + (add-hook 'rust-mode-hook 'flycheck-mode)) + +(when (configuration-layer/layer-usedp 'syntax-checking) + (defun rust/init-flycheck-rust () + (use-package flycheck-rust + :if (configuration-layer/package-usedp 'flycheck) + :defer t + :init + (add-hook 'flycheck-mode-hook #'flycheck-rust-setup)))) (defun rust/init-rust-mode () (use-package rust-mode