[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode 5cf4207 1/3: copy command rustic-toggle-mutabili
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode 5cf4207 1/3: copy command rustic-toggle-mutability from #194 |
Date: |
Sat, 27 Nov 2021 12:57:54 -0500 (EST) |
branch: elpa/rust-mode
commit 5cf4207916a54a711c16351719dddc8f1b4e2d48
Author: brotzeit <brotzeitmacher@gmail.com>
Commit: brotzeit <brotzeitmacher@gmail.com>
copy command rustic-toggle-mutability from #194
---
rust-utils.el | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/rust-utils.el b/rust-utils.el
index 022973b..d44a609 100644
--- a/rust-utils.el
+++ b/rust-utils.el
@@ -77,6 +77,15 @@ visit the new file."
(delete-pair))
(t (rust-insert-dbg)))))))
+(defun rustic-toggle-mutability ()
+ "Toggles the mutability of the variable defined on the current line"
+ (interactive)
+ (save-excursion
+ (back-to-indentation)
+ (forward-word)
+ (if (string= " mut" (buffer-substring (point) (+ (point) 4)))
+ (delete-region (point) (+ (point) 4))
+ (insert " mut"))))
;;; _
(provide 'rust-utils)
;;; rust-utils.el ends here