Skip to content

Commit 06b3b60

Browse files
brotzeitmookid
authored andcommitted
update readme (#327)
1 parent 74c2647 commit 06b3b60

File tree

2 files changed

+38
-67
lines changed

2 files changed

+38
-67
lines changed

README.md

Lines changed: 37 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,67 @@
1-
`rust-mode`: A major Emacs mode for editing Rust source code
2-
============================================================
1+
[![MELPA](https://melpa.org/packages/rust-mode-badge.svg)](https://melpa.org/#/rust-mode)
32

4-
`rust-mode` makes editing [Rust](http://rust-lang.org) code with Emacs
5-
enjoyable. `rust-mode` requires Emacs 24 or later.
6-
7-
## Installation
8-
9-
### Manual Installation
3+
# Emacs mode for editing Rust source code
104

11-
To install manually, check out this repository and add this to your
12-
`.emacs` file:
5+
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc -->
6+
**Table of Contents**
137

14-
```lisp
15-
(add-to-list 'load-path "/path/to/rust-mode/")
16-
(autoload 'rust-mode "rust-mode" nil t)
17-
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
18-
```
8+
- [Installation via MELPA](#installation-via-melpa)
9+
- [Manual Installation](#manual-installation)
10+
- [rustfmt](#rustfmt)
11+
- [Tests](#tests)
12+
- [Other useful packages](#other-useful-packages)
1913

20-
This associates `rust-mode` with `.rs` files. To enable it explicitly, do
21-
<kbd>M-x rust-mode</kbd>.
14+
<!-- markdown-toc end -->
2215

23-
### `package.el` installation via MELPA
16+
# Installation via MELPA
2417

25-
It can be more convenient to use Emacs's package manager to handle
26-
installation for you if you use many elisp libraries. If you have
27-
`package.el` but haven't added MELPA, the community
28-
package source, yet, add this to `~/.emacs.d/init.el`:
18+
`rust-mode` makes editing [Rust](http://rust-lang.org) code with Emacs
19+
enjoyable. It requires Emacs 24 or later.
20+
The package is available on MELPA. Add this to your init.el.
2921

30-
```lisp
22+
``` elisp
3123
(require 'package)
3224
(add-to-list 'package-archives
3325
'("melpa" . "https://melpa.org/packages/") t)
3426
(package-initialize)
27+
(package-refresh-contents)
3528
```
3629

37-
Then do this to load the package listing:
38-
39-
* <kbd>M-x eval-buffer</kbd>
40-
* <kbd>M-x package-refresh-contents</kbd>
30+
Now you can install `rust-mode` with:
4131

42-
#### MELPA stable
32+
`M-x package-install rust-mode`
4333

44-
MELPA stable only updates when a new version tag is created. There isn't a
45-
specified frequency for this project to release versions; if you are a MELPA
46-
stable user and feel that the last release tag is too far out of date, open a
47-
pull request that updates the version header in `rust-mode.el` and note that a
48-
new version tag should be added when the request is merged.
49-
See [Pull Request #178](https://github.com/rust-lang/rust-mode/pull/178) (the
50-
first such pull request)) for an example of this.
34+
And put this in your config to load rust-mode automatically:
5135

52-
#### Install `rust-mode`
36+
`(require 'rust-mode)`
5337

54-
One you have `package.el`, you can install `rust-mode` or any other
55-
modes by choosing them from a list:
38+
# Manual Installation
5639

57-
* <kbd>M-x package-list-packages</kbd>
40+
Add this to your init.el:
5841

59-
Now, to install packages, move your cursor to them and press
60-
<kbd>i</kbd>. This will mark the packages for installation. When
61-
you're done with marking, press <kbd>x</kbd>, and ELPA will install
62-
the packages for you (under `~/.emacs.d/elpa/`).
42+
``` elisp
43+
(add-to-list 'load-path "/path/to/rust-mode/")
44+
(autoload 'rust-mode "rust-mode" nil t)
45+
```
6346

64-
* or using <kbd>M-x package-install rust-mode</kbd>
47+
# rustfmt
6548

66-
### Package installation on Debian
49+
The `rust-format-buffer` function will format your code with
50+
[rustfmt](https://github.com/rust-lang/rustfmt) if installed. By default,
51+
this is bound to `C-c C-f`.
6752

68-
```bash
69-
apt install elpa-rust-mode
70-
```
53+
Placing `(setq rust-format-on-save t)` in your init.el will enable automatic
54+
running of `rust-format-buffer` when you save a buffer.
7155

72-
### Tests via ERT
56+
# Tests
7357

7458
The file `rust-mode-tests.el` contains tests that can be run via
7559
[ERT](http://www.gnu.org/software/emacs/manual/html_node/ert/index.html).
7660
You can use `run_rust_emacs_tests.sh` to run them in batch mode, if
7761
you set the environment variable EMACS to a program that runs emacs.
7862

79-
## Features
80-
81-
### Formatting with [rustfmt][rfmt]
82-
83-
The `rust-format-buffer` function will format your code with
84-
[rustfmt][rfmt] if installed. By default, this is bound to `C-c C-f`.
85-
86-
Placing `(setq rust-format-on-save t)` in your `~/.emacs` will enable automatic
87-
running of `rust-format-buffer` when you save a buffer.
88-
89-
[rfmt]: https://crates.io/crates/rustfmt/
90-
91-
## License
92-
93-
`rust-mode` is distributed under the terms of both the MIT license and the
94-
Apache License (Version 2.0).
63+
# Other useful packages
9564

96-
See [LICENSE-MIT](LICENSE-MIT) and [LICENSE-APACHE](LICENSE-APACHE) for details.
65+
[cargo.el](https://github.com/kwrooijen/cargo.el) Emacs Minor Mode for Cargo, Rust's Package Manager
66+
[emacs-racer](https://github.com/racer-rust/emacs-racer) Racer support for Emacs
67+
[rustic](https://github.com/brotzeit/rustic) Rust development environment for Emacs

rust-mode.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;;; rust-mode.el --- A major emacs mode for editing Rust source code -*-lexical-binding: t-*-
22

3-
;; Version: 0.4.0
3+
;; Version: 0.5.0
44
;; Author: Mozilla
55
;; Url: https://github.com/rust-lang/rust-mode
66
;; Keywords: languages

0 commit comments

Comments
 (0)