]> git.eshelyaron.com Git - emacs.git/commitdiff
Make c-ts-common-comment-indent-new-line work for rust doc comment
authorYuan Fu <casouri@gmail.com>
Wed, 24 Apr 2024 05:28:25 +0000 (22:28 -0700)
committerEshel Yaron <me@eshelyaron.com>
Wed, 24 Apr 2024 17:43:49 +0000 (19:43 +0200)
* lisp/progmodes/c-ts-common.el (c-ts-common-comment-indent-new-line):
Support //! comment directives.

(cherry picked from commit c8c319e0b024eb2441cda786c282a094a9cd30fb)

lisp/progmodes/c-ts-common.el

index c06295b8a87ea5a4736223a9a791bdb38bdd05f3..cc8254c5701438ce3cce8946b7df7ef23e469247 100644 (file)
@@ -296,9 +296,10 @@ and /* */ comments.  SOFT works the same as in
   ;; auto-fill or other smart features.
   (cond
    ;; Line starts with //, or ///, or ////...
+   ;; Or //! (used in rust).
    ((save-excursion
       (beginning-of-line)
-      (looking-at (rx "//" (group (* "/") (* " ")))))
+      (looking-at (rx "//" (group (* (any "/!")) (* " ")))))
     (let ((whitespaces (match-string 1)))
       (if soft (insert-and-inherit ?\n) (newline 1))
       (delete-region (line-beginning-position) (point))
@@ -316,7 +317,7 @@ and /* */ comments.  SOFT works the same as in
    ;; Line starts with *.
    ((save-excursion
       (beginning-of-line)
-      (looking-at (rx (group (* " ") (or "*" "|") (* " ")))))
+      (looking-at (rx (group (* " ") (any "*|") (* " ")))))
     (let ((prefix (match-string 1)))
       (if soft (insert-and-inherit ?\n) (newline 1))
       (delete-region (line-beginning-position) (point))