aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuan Fu2024-04-23 22:28:25 -0700
committerYuan Fu2024-04-23 22:55:36 -0700
commitc8c319e0b024eb2441cda786c282a094a9cd30fb (patch)
tree8651258421a4b22d32465395e219ed2f299b15ca
parent67ef1d54e7e3983bb03840cf8f2990d579942710 (diff)
downloademacs-c8c319e0b024eb2441cda786c282a094a9cd30fb.tar.gz
emacs-c8c319e0b024eb2441cda786c282a094a9cd30fb.zip
Make c-ts-common-comment-indent-new-line work for rust doc comment
* lisp/progmodes/c-ts-common.el (c-ts-common-comment-indent-new-line): Support //! comment directives.
-rw-r--r--lisp/progmodes/c-ts-common.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/progmodes/c-ts-common.el b/lisp/progmodes/c-ts-common.el
index c06295b8a87..cc8254c5701 100644
--- a/lisp/progmodes/c-ts-common.el
+++ b/lisp/progmodes/c-ts-common.el
@@ -296,9 +296,10 @@ and /* */ comments. SOFT works the same as in
296 ;; auto-fill or other smart features. 296 ;; auto-fill or other smart features.
297 (cond 297 (cond
298 ;; Line starts with //, or ///, or ////... 298 ;; Line starts with //, or ///, or ////...
299 ;; Or //! (used in rust).
299 ((save-excursion 300 ((save-excursion
300 (beginning-of-line) 301 (beginning-of-line)
301 (looking-at (rx "//" (group (* "/") (* " "))))) 302 (looking-at (rx "//" (group (* (any "/!")) (* " ")))))
302 (let ((whitespaces (match-string 1))) 303 (let ((whitespaces (match-string 1)))
303 (if soft (insert-and-inherit ?\n) (newline 1)) 304 (if soft (insert-and-inherit ?\n) (newline 1))
304 (delete-region (line-beginning-position) (point)) 305 (delete-region (line-beginning-position) (point))
@@ -316,7 +317,7 @@ and /* */ comments. SOFT works the same as in
316 ;; Line starts with *. 317 ;; Line starts with *.
317 ((save-excursion 318 ((save-excursion
318 (beginning-of-line) 319 (beginning-of-line)
319 (looking-at (rx (group (* " ") (or "*" "|") (* " "))))) 320 (looking-at (rx (group (* " ") (any "*|") (* " ")))))
320 (let ((prefix (match-string 1))) 321 (let ((prefix (match-string 1)))
321 (if soft (insert-and-inherit ?\n) (newline 1)) 322 (if soft (insert-and-inherit ?\n) (newline 1))
322 (delete-region (line-beginning-position) (point)) 323 (delete-region (line-beginning-position) (point))