emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/rust-mode 315cc59 233/486: Re-indent on }


From: ELPA Syncer
Subject: [nongnu] elpa/rust-mode 315cc59 233/486: Re-indent on }
Date: Sat, 7 Aug 2021 09:25:26 -0400 (EDT)

branch: elpa/rust-mode
commit 315cc59ec5a8dfe3150ce74191da4647fe14c515
Author: Steven Allen <steven@stebalien.com>
Commit: Steven Allen <steven@stebalien.com>

    Re-indent on }
    
    Before:
    
        fn test() {
            // Do something
            }▎
    
    After:
    
        fn test() {
            // Do something
        }▎
---
 rust-mode.el | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/rust-mode.el b/rust-mode.el
index 56657d6..632c380 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -19,6 +19,7 @@
                    (require 'url-vars))
 
 (defvar electric-pair-inhibit-predicate)
+(defvar electric-indent-chars)
 
 ;; for GNU Emacs < 24.3
 (eval-when-compile
@@ -1299,6 +1300,11 @@ This is written mainly to be used as 
`end-of-defun-function' for Rust."
   (setq-local comment-end   "")
   (setq-local indent-tabs-mode nil)
 
+  ;; Auto indent on }
+  (setq-local
+   electric-indent-chars (cons ?} (and (boundp 'electric-indent-chars)
+                                       electric-indent-chars)))
+
   ;; Allow paragraph fills for comments
   (setq-local comment-start-skip "\\(?://[/!]*\\|/\\*[*!]?\\)[[:space:]]*")
   (setq-local paragraph-start



reply via email to

[Prev in Thread] Current Thread [Next in Thread]