emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 96af584af6c 2/2: Fix comment-start-skip in tree-sitter modes (b


From: Yuan Fu
Subject: emacs-29 96af584af6c 2/2: Fix comment-start-skip in tree-sitter modes (bug#59690)
Date: Sat, 3 Dec 2022 17:50:13 -0500 (EST)

branch: emacs-29
commit 96af584af6c8ea50f9cf871db9ffca91040fb85d
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    Fix comment-start-skip in tree-sitter modes (bug#59690)
    
    * lisp/progmodes/c-ts-mode.el (c-ts-mode)
    (c++-ts-mode)
    * lisp/progmodes/csharp-mode.el (csharp-ts-mode)
    * lisp/progmodes/java-ts-mode.el (java-ts-mode)
    * lisp/progmodes/js.el (js-ts-mode)
    * lisp/progmodes/typescript-ts-mode.el (tsx-ts-mode): Remove the group
    from the regexp.
---
 lisp/progmodes/c-ts-mode.el          | 6 ++++--
 lisp/progmodes/csharp-mode.el        | 3 ++-
 lisp/progmodes/java-ts-mode.el       | 3 ++-
 lisp/progmodes/js.el                 | 3 ++-
 lisp/progmodes/typescript-ts-mode.el | 4 +++-
 5 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index fcabb5beac8..a8189a0f3da 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -566,7 +566,8 @@ the subtrees."
   ;; Comments.
   (setq-local comment-start "/* ")
   (setq-local comment-end " */")
-  (setq-local comment-start-skip (rx (group "/" (or (+ "/") (+ "*")))
+  (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+                                         (seq "/" (+ "*")))
                                      (* (syntax whitespace))))
   (setq-local comment-end-skip
               (rx (* (syntax whitespace))
@@ -596,7 +597,8 @@ the subtrees."
   ;; Comments.
   (setq-local comment-start "// ")
   (setq-local comment-end "")
-  (setq-local comment-start-skip (rx (group "/" (or (+ "/") (+ "*")))
+  (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+                                         (seq "/" (+ "*")))
                                      (* (syntax whitespace))))
   (setq-local comment-end-skip
               (rx (* (syntax whitespace))
diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index 3da3079f089..054dabfed07 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -900,7 +900,8 @@ Key bindings:
   ;; Comments.
   (setq-local comment-start "// ")
   (setq-local comment-end "")
-  (setq-local comment-start-skip (rx (group "/" (or (+ "/") (+ "*")))
+  (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+                                         (seq "/" (+ "*")))
                                      (* (syntax whitespace))))
   (setq-local comment-end-skip
               (rx (* (syntax whitespace))
diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el
index cf2482bb6ee..2c42505ac94 100644
--- a/lisp/progmodes/java-ts-mode.el
+++ b/lisp/progmodes/java-ts-mode.el
@@ -301,7 +301,8 @@ the subtrees."
   ;; Comments.
   (setq-local comment-start "// ")
   (setq-local comment-end "")
-  (setq-local comment-start-skip (rx (group "/" (or (+ "/") (+ "*")))
+  (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+                                         (seq "/" (+ "*")))
                                      (* (syntax whitespace))))
   (setq-local comment-end-skip
               (rx (* (syntax whitespace))
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index ad1fe62d429..389096147ac 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3849,7 +3849,8 @@ Currently there are `js-mode' and `js-ts-mode'."
     ;; Comment.
     (setq-local comment-start "// ")
     (setq-local comment-end "")
-    (setq-local comment-start-skip (rx (group "/" (or (+ "/") (+ "*")))
+    (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+                                           (seq "/" (+ "*")))
                                        (* (syntax whitespace))))
     (setq-local comment-end-skip
                 (rx (* (syntax whitespace))
diff --git a/lisp/progmodes/typescript-ts-mode.el 
b/lisp/progmodes/typescript-ts-mode.el
index e09bacdcb1b..48ac1169fe8 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -362,7 +362,9 @@ Argument LANGUAGE is either `typescript' or `tsx'."
     ;; Comments.
     (setq-local comment-start "// ")
     (setq-local comment-end "")
-    (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
+    (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+                                           (seq "/" (+ "*")))
+                                       (* (syntax whitespace))))
     (setq-local comment-end-skip
                 (rx (* (syntax whitespace))
                     (group (or (syntax comment-end)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]