rust: replace :if keyword with when around use-package call
This commit is contained in:
parent
259a69d95f
commit
10189cf277
46
init.el
46
init.el
@ -758,39 +758,37 @@ inserted between the braces between the braces."
|
|||||||
;;; For **tab completion** and **lsp** support add [my common settings
|
;;; For **tab completion** and **lsp** support add [my common settings
|
||||||
;;; for programming modes] and then add
|
;;; for programming modes] and then add
|
||||||
|
|
||||||
(defun my-rustic-mode-hook-fn ()
|
(when (>= emacs-major-version 26)
|
||||||
"needed for lsp-format-buffer to indent with 4 spaces"
|
(defun my-rustic-mode-hook-fn ()
|
||||||
(setq tab-width 4
|
"needed for lsp-format-buffer to indent with 4 spaces"
|
||||||
indent-tabs-mode nil))
|
(setq tab-width 4
|
||||||
|
indent-tabs-mode nil))
|
||||||
|
|
||||||
(use-package rustic
|
(use-package rustic
|
||||||
:if (>= emacs-major-version 26)
|
:init
|
||||||
:init
|
;; to use rustic-mode even if rust-mode also installed
|
||||||
;; to use rustic-mode even if rust-mode also installed
|
(setq auto-mode-alist (delete '("\\.rs\\'" . rust-mode) auto-mode-alist))
|
||||||
(setq auto-mode-alist (delete '("\\.rs\\'" . rust-mode) auto-mode-alist))
|
:hook (rustic-mode . my-rustic-mode-hook-fn)))
|
||||||
:hook (rustic-mode . my-rustic-mode-hook-fn))
|
|
||||||
|
|
||||||
;;; But if you have Emacs older than 26 than you should install
|
;;; But if you have Emacs older than 26 than you should install
|
||||||
;;; [racer](https://github.com/racer-rust/racer) and for **tab
|
;;; [racer](https://github.com/racer-rust/racer) and for **tab
|
||||||
;;; completion** add [my common settings for programming modes] and
|
;;; completion** add [my common settings for programming modes] and
|
||||||
;;; then add
|
;;; then add
|
||||||
|
|
||||||
(use-package cargo
|
(when (< emacs-major-version 26)
|
||||||
:if (< emacs-major-version 26)
|
(use-package cargo
|
||||||
:defer)
|
:defer)
|
||||||
|
|
||||||
(use-package racer
|
(use-package racer
|
||||||
:if (< emacs-major-version 26)
|
:defer)
|
||||||
:defer)
|
|
||||||
|
|
||||||
(use-package rust-mode
|
(use-package rust-mode
|
||||||
:if (< emacs-major-version 26)
|
:init
|
||||||
:init
|
(setq rust-format-on-save t)
|
||||||
(setq rust-format-on-save t)
|
:hook ((rust-mode . company-mode)
|
||||||
:hook ((rust-mode . company-mode)
|
(rust-mode . cargo-minor-mode)
|
||||||
(rust-mode . cargo-minor-mode)
|
(rust-mode . racer-mode)
|
||||||
(rust-mode . racer-mode)
|
(rust-mode . eldoc-mode))))
|
||||||
(rust-mode . eldoc-mode)))
|
|
||||||
|
|
||||||
|
|
||||||
;;; ### Meson build system ###
|
;;; ### Meson build system ###
|
||||||
|
Loading…
x
Reference in New Issue
Block a user