Skip to content

Commit 518bd07

Browse files
committed
auto merge of #8830 : andersk/rust/indent-4, r=catamorphism
`default-tab-width` is standardly 8, but most programmers and style guides prefer an indentation width smaller than that. Rust itself uses 4 space indents. Most other Emacs modes define the indentation width as 4 or 2 spaces, independently of the width of a Tab character. Depending on `default-tab-width` makes especially little sense for rust-mode because it sets `indent-tabs-mode` to `nil`.
2 parents 89d0400 + 60e8480 commit 518bd07

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/etc/emacs/rust-mode.el

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@
2929

3030
table))
3131

32-
(defcustom rust-indent-offset default-tab-width
33-
"*Indent Rust code by this number of spaces.
34-
35-
The initializer is `DEFAULT-TAB-WIDTH'.")
32+
(defcustom rust-indent-offset 4
33+
"*Indent Rust code by this number of spaces.")
3634

3735
(defun rust-paren-level () (nth 0 (syntax-ppss)))
3836
(defun rust-in-str-or-cmnt () (nth 8 (syntax-ppss)))
@@ -61,7 +59,7 @@ The initializer is `DEFAULT-TAB-WIDTH'.")
6159

6260
;; If we're in any other token-tree / sexp, then:
6361
;; - [ or ( means line up with the opening token
64-
;; - { means indent to either nesting-level * tab width,
62+
;; - { means indent to either nesting-level * rust-indent-offset,
6563
;; or one further indent from that if either current line
6664
;; begins with 'else', or previous line didn't end in
6765
;; semi, comma or brace, and wasn't an attribute. PHEW.

0 commit comments

Comments
 (0)