summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rust-mode.el20
1 files changed, 13 insertions, 7 deletions
diff --git a/rust-mode.el b/rust-mode.el
index 4867e77..2c97433 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -201,14 +201,20 @@ function or trait. When nil, where will be aligned with fn or trait."
(defun rust-paren-level () (nth 0 (syntax-ppss)))
(defun rust-in-str-or-cmnt () (nth 8 (syntax-ppss)))
(defun rust-rewind-past-str-cmnt () (goto-char (nth 8 (syntax-ppss))))
+
(defun rust-rewind-irrelevant ()
- (let ((starting (point)))
- (skip-chars-backward "[:space:]\n")
- (if (rust-looking-back-str "*/") (backward-char))
- (if (rust-in-str-or-cmnt)
- (rust-rewind-past-str-cmnt))
- (if (/= starting (point))
- (rust-rewind-irrelevant))))
+ (let ((continue t))
+ (while continue
+ (let ((starting (point)))
+ (skip-chars-backward "[:space:]\n")
+ (when (rust-looking-back-str "*/")
+ (backward-char))
+ (when (rust-in-str-or-cmnt)
+ (rust-rewind-past-str-cmnt))
+ ;; Rewind until the point no longer moves
+ (setq continue (/= starting (point)))))))
+
+
(defun rust-in-macro ()
(save-excursion
(when (> (rust-paren-level) 0)