diff options
author | Yuan Fu <casouri@gmail.com> | 2022-12-02 17:03:21 -0800 |
---|---|---|
committer | Yuan Fu <casouri@gmail.com> | 2022-12-03 14:49:38 -0800 |
commit | 96af584af6c8ea50f9cf871db9ffca91040fb85d (patch) | |
tree | 71e85c4b991520c32ab3aa2d66ead1d0ebd913d8 | |
parent | 520a4e12f8e6e42d0c66cc6b3cf3be05c411fe6f (diff) | |
download | emacs-96af584af6c8ea50f9cf871db9ffca91040fb85d.tar.gz |
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.
-rw-r--r-- | lisp/progmodes/c-ts-mode.el | 6 | ||||
-rw-r--r-- | lisp/progmodes/csharp-mode.el | 3 | ||||
-rw-r--r-- | lisp/progmodes/java-ts-mode.el | 3 | ||||
-rw-r--r-- | lisp/progmodes/js.el | 3 | ||||
-rw-r--r-- | 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) |