>From 396f02d03faf65ded0b01b7b9aa9eb989aff4291 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Tue, 29 Nov 2022 21:33:42 +0100 Subject: [PATCH] Fix comment-start-skip in *-ts-modes The new rx-based regex didn't work correctly with C++ style comments, so we revert back to the old non-rx-based comment-start-skip. * lisp/progmodes/c-ts-mode.el (c-ts-mode): Use new regex. * lisp/progmodes/csharp-mode.el (csharp-ts-mode): Use new regex. * lisp/progmodes/java-ts-mode.el (java-ts-mode): Use new regex. * lisp/progmodes/js.el (js-ts-mode): Use new regex. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode): Use new regex. Fixes (Bug#59689) --- lisp/progmodes/c-ts-mode.el | 3 +-- lisp/progmodes/csharp-mode.el | 3 +-- lisp/progmodes/java-ts-mode.el | 3 +-- lisp/progmodes/js.el | 3 +-- lisp/progmodes/typescript-ts-mode.el | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index a79dabcd31..18d0e2a87b 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -546,8 +546,7 @@ c-ts-mode ;; Comments. (setq-local comment-start "/* ") (setq-local comment-end " */") - (setq-local comment-start-skip (rx (group "/" (or (+ "/") (+ "*"))) - (* (syntax whitespace)))) + (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *") (setq-local comment-end-skip (rx (* (syntax whitespace)) (group (or (syntax comment-end) diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index 3da3079f08..451fedce1b 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -900,8 +900,7 @@ csharp-ts-mode ;; Comments. (setq-local comment-start "// ") (setq-local comment-end "") - (setq-local comment-start-skip (rx (group "/" (or (+ "/") (+ "*"))) - (* (syntax whitespace)))) + (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *") (setq-local comment-end-skip (rx (* (syntax whitespace)) (group (or (syntax comment-end) diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index cf2482bb6e..ea3d2144df 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -301,8 +301,7 @@ java-ts-mode ;; Comments. (setq-local comment-start "// ") (setq-local comment-end "") - (setq-local comment-start-skip (rx (group "/" (or (+ "/") (+ "*"))) - (* (syntax whitespace)))) + (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *") (setq-local comment-end-skip (rx (* (syntax whitespace)) (group (or (syntax comment-end) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index ad1fe62d42..f8d510625c 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3849,8 +3849,7 @@ js-ts-mode ;; Comment. (setq-local comment-start "// ") (setq-local comment-end "") - (setq-local comment-start-skip (rx (group "/" (or (+ "/") (+ "*"))) - (* (syntax whitespace)))) + (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *") (setq-local comment-end-skip (rx (* (syntax whitespace)) (group (or (syntax comment-end) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 6c926a4e3e..8a5e537213 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -301,8 +301,7 @@ typescript-ts-mode ;; Comments. (setq-local comment-start "// ") (setq-local comment-end "") - (setq-local comment-start-skip (rx (group "/" (or (+ "/") (+ "*"))) - (* (syntax whitespace)))) + (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *") (setq-local comment-end-skip (rx (* (syntax whitespace)) (group (or (syntax comment-end) -- 2.34.1