5
5
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc -->
6
6
** Table of Contents**
7
7
8
- - [ Installation via MELPA] ( #installation-via-melpa )
9
- - [ Manual Installation] ( #manual-installation )
8
+ - [ Installation] ( #installation )
9
+ - [ Melpa] ( #melpa )
10
+ - [ use-package and straight] ( #use-package-and-straight )
11
+ - [ Manual Installation] ( #manual-installation )
10
12
- [ Indentation] ( #indentation )
11
13
- [ rustfmt] ( #rustfmt )
12
14
- [ Tests] ( #tests )
15
+ - [ LSP] ( #lsp )
16
+ - [ eglot] ( #eglot )
17
+ - [ lsp-mode] ( #lsp-mode )
13
18
- [ Other useful packages] ( #other-useful-packages )
14
19
15
20
<!-- markdown-toc end -->
16
21
17
- # Installation via MELPA
22
+ # Installation
23
+
24
+ ## Melpa
18
25
19
26
` rust-mode ` makes editing [ Rust] ( http://rust-lang.org ) code with Emacs
20
27
enjoyable. It requires Emacs 24 or later.
@@ -36,7 +43,26 @@ And put this in your config to load rust-mode automatically:
36
43
37
44
` (require 'rust-mode) `
38
45
39
- # Manual Installation
46
+ ## use-package and straight
47
+
48
+ ``` elisp
49
+ (defvar bootstrap-version)
50
+ (let ((bootstrap-file
51
+ (expand-file-name "~/tmp/git/straight.el/bootstrap.el" user-emacs-directory))
52
+ (bootstrap-version 5))
53
+ (unless (file-exists-p bootstrap-file)
54
+ (with-current-buffer
55
+ (url-retrieve-synchronously
56
+ "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
57
+ 'silent 'inhibit-cookies)
58
+ (goto-char (point-max))
59
+ (eval-print-last-sexp)))
60
+ (load bootstrap-file nil 'nomessage))
61
+
62
+ (use-package rust-mode)
63
+ ```
64
+
65
+ ## Manual Installation
40
66
41
67
Add this to your init.el:
42
68
@@ -71,6 +97,24 @@ The file `rust-mode-tests.el` contains tests that can be run via
71
97
You can use ` run_rust_emacs_tests.sh ` to run them in batch mode, if
72
98
you set the environment variable EMACS to a program that runs emacs.
73
99
100
+ # LSP
101
+
102
+ ## eglot
103
+
104
+ ``` elisp
105
+ (require 'eglot)
106
+ (add-hook 'rust-mode-hook 'eglot-ensure)
107
+ ```
108
+
109
+ ## lsp-mode
110
+
111
+ ``` elisp
112
+ (require 'lsp-mode)
113
+ (add-hook 'rust-mode-hook #'lsp)
114
+ ```
115
+
116
+ You can find more information in the [ lsp-mode wiki] ( https://github.com/emacs-lsp/lsp-mode/wiki/Rust ) .
117
+
74
118
# Other useful packages
75
119
76
120
* [ cargo.el] ( https://github.com/kwrooijen/cargo.el ) Emacs Minor Mode for Cargo, Rust's Package Manager
0 commit comments