unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 59689@debbugs.gnu.org
Cc: jostein@kjonigsen.net, eliz@gnu.org, casuri@gmail.com
Subject: bug#59689: 29.0.60; csharp-ts-mode: unable to uncomment region commented using comment-region
Date: Tue, 29 Nov 2022 21:42:46 +0100	[thread overview]
Message-ID: <877czda3w9.fsf@thornhill.no> (raw)
In-Reply-To: <15b365bb-9cd1-03c4-638c-489f93d679e1@secure.kjonigsen.net>

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]


Hi all.

Here's a patch fixing this bug. This also fixes the same problem for all
the ts-modes.

The regression was introduced in
d5dc1dbf7cb263d8ff541a0def028c2d7d24f82b

See attached patch.

Theo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-comment-start-skip-in-ts-modes.patch --]
[-- Type: text/x-diff, Size: 4114 bytes --]

From 396f02d03faf65ded0b01b7b9aa9eb989aff4291 Mon Sep 17 00:00:00 2001
From: Theodor Thornhill <theo@thornhill.no>
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


  reply	other threads:[~2022-11-29 20:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 19:47 bug#59689: 29.0.60; csharp-ts-mode: unable to uncomment region commented using comment-region Jostein Kjønigsen
2022-11-29 20:42 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-11-29 20:51   ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-30 12:44   ` Jostein Kjønigsen
2022-11-30 10:27 ` bug#59689: bug#59690: 29.0.60; typescript-ts-mode: " Yuan Fu
2022-11-30 10:39   ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-02  3:56     ` bug#59689: " Yuan Fu
2022-12-02 12:43       ` bug#59690: " Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877czda3w9.fsf@thornhill.no \
    --to=bug-gnu-emacs@gnu.org \
    --cc=59689@debbugs.gnu.org \
    --cc=casuri@gmail.com \
    --cc=eliz@gnu.org \
    --cc=jostein@kjonigsen.net \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).