diff options
| author | brotzeit <brotzeitmacher@gmail.com> | 2021-11-27 17:57:33 +0100 |
|---|---|---|
| committer | brotzeit <brotzeitmacher@gmail.com> | 2021-11-27 17:57:33 +0100 |
| commit | 5cf4207916a54a711c16351719dddc8f1b4e2d48 (patch) | |
| tree | c3ab97d5db235136e9e2abd2c7e05fe6f0800fd7 /rust-utils.el | |
| parent | 63ea805a19cfefccb7fd047b418ad743680c2f2d (diff) | |
| download | rust-mode-5cf4207916a54a711c16351719dddc8f1b4e2d48.tar.gz | |
copy command rustic-toggle-mutability from #194
Diffstat (limited to 'rust-utils.el')
| -rw-r--r-- | rust-utils.el | 9 |
1 files changed, 9 insertions, 0 deletions
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 |
