Skip to content

Commit 315cc59

Browse files
committed
Re-indent on }
Before: fn test() { // Do something }▎ After: fn test() { // Do something }▎
1 parent 3517321 commit 315cc59

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

rust-mode.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
(require 'url-vars))
2020

2121
(defvar electric-pair-inhibit-predicate)
22+
(defvar electric-indent-chars)
2223

2324
;; for GNU Emacs < 24.3
2425
(eval-when-compile
@@ -1299,6 +1300,11 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
12991300
(setq-local comment-end "")
13001301
(setq-local indent-tabs-mode nil)
13011302

1303+
;; Auto indent on }
1304+
(setq-local
1305+
electric-indent-chars (cons ?} (and (boundp 'electric-indent-chars)
1306+
electric-indent-chars)))
1307+
13021308
;; Allow paragraph fills for comments
13031309
(setq-local comment-start-skip "\\(?://[/!]*\\|/\\*[*!]?\\)[[:space:]]*")
13041310
(setq-local paragraph-start

0 commit comments

Comments
 (0)