doomemacs/modules/lang/rust/config.el

41 lines
1.1 KiB
EmacsLisp
Raw Normal View History

;;; lang/rust/config.el -*- lexical-binding: t; -*-
2015-09-30 12:28:52 -04:00
2017-03-20 15:55:58 -04:00
(defvar +rust-ext-dir (concat doom-etc-dir "rust/")
"TODO")
(def-package! rust-mode
2015-09-30 12:28:52 -04:00
:mode "\\.rs$"
2017-02-19 18:57:16 -05:00
:init
(add-hook 'rust-mode-hook #'flycheck-mode)
:config
(set! :build 'run-cargo '(rust-mode toml-mode) #'+rust/run-cargo
:when #'+rust-cargo-project-p))
2015-09-30 12:28:52 -04:00
(def-package! racer
:after rust-mode
:preface
2017-02-19 18:57:16 -05:00
:init
(add-hook! 'rust-mode-hook #'(racer-mode eldoc-mode flycheck-rust-setup))
:config
2017-03-20 15:55:58 -04:00
(setq racer-cmd (expand-file-name "racer/target/release/racer" +rust-ext-dir)
racer-rust-src-path (expand-file-name "rust/src/" +rust-ext-dir))
(unless (file-exists-p racer-cmd)
(warn "rust-mode: racer binary can't be found; auto-completion is disabled"))
;; TODO Unit test keybinds
(map! :map rust-mode-map :m "gd" #'racer-find-definition))
2017-02-19 18:57:16 -05:00
(def-package! company-racer
:when (featurep! :completion company)
:after racer
:config (set! :company-backend 'rust-mode '(company-racer)))
2017-02-19 18:57:16 -05:00
(def-package! flycheck-rust
:when (featurep! :feature syntax-checker)
2017-02-19 18:57:16 -05:00
:after rust-mode)
2015-09-30 12:28:52 -04:00