2015-05-07 13:19:56 +00:00
|
|
|
;;; packages.el --- Rust Layer packages File for Spacemacs
|
|
|
|
;;
|
|
|
|
;; Copyright (c) 2012-2014 Sylvain Benner
|
|
|
|
;; Copyright (c) 2015 Chris Hoeppner & Contributors
|
|
|
|
;;
|
|
|
|
;; Author: Chris Hoeppner <me@mkaito.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2015-07-01 05:37:31 +00:00
|
|
|
(setq rust-packages
|
2015-05-07 13:19:56 +00:00
|
|
|
'(
|
2015-07-01 05:37:31 +00:00
|
|
|
company
|
|
|
|
company-racer
|
2015-08-24 16:00:19 +00:00
|
|
|
racer
|
2015-06-03 03:18:31 +00:00
|
|
|
flycheck
|
2015-05-28 01:26:33 +00:00
|
|
|
flycheck-rust
|
2015-05-07 13:19:56 +00:00
|
|
|
rust-mode
|
|
|
|
toml-mode
|
2015-07-01 05:37:31 +00:00
|
|
|
))
|
2015-05-07 13:19:56 +00:00
|
|
|
|
2015-06-03 03:18:31 +00:00
|
|
|
(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
|
2015-07-01 05:37:31 +00:00
|
|
|
:init (add-hook 'flycheck-mode-hook #'flycheck-rust-setup))))
|
2015-05-28 01:26:33 +00:00
|
|
|
|
2015-05-07 13:19:56 +00:00
|
|
|
(defun rust/init-rust-mode ()
|
|
|
|
(use-package rust-mode
|
|
|
|
:defer t
|
|
|
|
:config
|
2015-05-12 01:30:31 +00:00
|
|
|
(progn
|
2015-07-01 05:37:31 +00:00
|
|
|
(when (fboundp 'sp-local-pair)
|
|
|
|
;; Don't pair lifetime specifiers
|
2015-05-12 01:30:31 +00:00
|
|
|
(sp-local-pair 'rust-mode "'" nil :actions nil))
|
|
|
|
|
|
|
|
(evil-leader/set-key-for-mode 'rust-mode
|
2015-05-14 03:45:26 +00:00
|
|
|
"mcc" 'spacemacs/rust-cargo-build
|
2015-06-16 08:27:54 +00:00
|
|
|
"mct" 'spacemacs/rust-cargo-test
|
2015-07-01 05:37:31 +00:00
|
|
|
"mcd" 'spacemacs/rust-cargo-doc
|
|
|
|
"mcx" 'spacemacs/rust-cargo-run))))
|
2015-05-07 13:19:56 +00:00
|
|
|
|
|
|
|
(defun rust/init-toml-mode ()
|
|
|
|
(use-package toml-mode
|
2015-07-01 05:37:31 +00:00
|
|
|
:defer t))
|
2015-06-16 08:27:54 +00:00
|
|
|
|
|
|
|
(when (configuration-layer/layer-usedp 'auto-completion)
|
|
|
|
(defun rust/post-init-company ()
|
|
|
|
(spacemacs|add-company-hook rust-mode))
|
|
|
|
|
|
|
|
(defun rust/init-company-racer ()
|
|
|
|
(use-package company-racer
|
|
|
|
:if (configuration-layer/package-usedp 'company)
|
|
|
|
:defer t
|
|
|
|
:init (push 'company-racer company-backends-rust-mode))))
|
2015-08-24 16:00:19 +00:00
|
|
|
|
|
|
|
(defun rust/init-racer ()
|
|
|
|
(use-package racer
|
|
|
|
:if rust-enable-racer
|
|
|
|
:defer t
|
2015-08-27 02:36:09 +00:00
|
|
|
:init (spacemacs/add-to-hook 'rust-mode-hook '(racer-mode eldoc-mode))))
|