unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eason Huang <aqua0210@foxmail.com>
Cc: 60087@debbugs.gnu.org
Subject: bug#60087: 29.0.60; c++-ts-mode conflict with electric-pair-mode
Date: Thu, 15 Dec 2022 13:24:13 +0100	[thread overview]
Message-ID: <m1a63oyhw2.fsf@yahoo.es> (raw)
In-Reply-To: <tencent_1B37E4865F924A32900237D8C19DD7223609@qq.com> (Eason Huang's message of "Thu, 15 Dec 2022 19:17:19 +0800")

Eason Huang <aqua0210@foxmail.com> writes:

> Hello Emacs dev team,
>
> I found that the c++-ts-mode conflict with electric-pair-mode.
> My build is based on commit a15cd55044c6bb4d4e9f9aec23b8b5b9cbcb38ac
>
> May be the issue was introduced by this commit:
> https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-29&id=480f41c7deb4d3a45a862a5308950b35085f835d
>
> I can confirm that Before the commit 480f41c7, It work well.
>
> steps to reproduce:
>
> 1. emacs -Q, start Emacs
> 2. C-x, C-f ~/test.cpp, open any cpp file.
> 3. M-x c++-ts-mode, enable c++ tree-sitter support
> 4. M-x electric-pair-mode, enable electric-pair-mode
> 4. Type the following code in the test.cpp buffer.
> ```
> #include <
> ```
> you will the the result as below:
> ```
> #include <<
> ```
>
> expected result is:
> ```
> #include <>
> ```
>

Thanks for the report.  I think the bug is that we need a second
character in the syntax table entry, to set the correct matching
delimiter.

Does the following patch solve this issue and bug#60049?

diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index ff2ff63fd8..11b2b9408c 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -86,8 +86,8 @@ c-ts-mode--syntax-table
 (defvar c++-ts-mode--syntax-table
   (let ((table (make-syntax-table c-ts-mode--syntax-table)))
     ;; Template delimiters.
-    (modify-syntax-entry ?<  "("     table)
-    (modify-syntax-entry ?>  ")"     table)
+    (modify-syntax-entry ?<  "(>"     table)
+    (modify-syntax-entry ?>  ")<"     table)
     table)
   "Syntax table for `c++-ts-mode'.")
 





  reply	other threads:[~2022-12-15 12:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 11:17 bug#60087: 29.0.60; c++-ts-mode conflict with electric-pair-mode Eason Huang
2022-12-15 12:24 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-12-15 13:10   ` João Távora
2022-12-15 21:34     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-15 21:43       ` João Távora
2022-12-27  9:03         ` Eason Huang
2022-12-29  6:10           ` Eason Huang
2022-12-29  6:33             ` Eli Zaretskii
2022-12-29  8:43             ` Yuan Fu
2022-12-29  9:07               ` João Távora
2022-12-15 13:05 ` João Távora
2022-12-15 13:21   ` Eason Huang

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=m1a63oyhw2.fsf@yahoo.es \
    --to=bug-gnu-emacs@gnu.org \
    --cc=60087@debbugs.gnu.org \
    --cc=aqua0210@foxmail.com \
    --cc=mardani29@yahoo.es \
    /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).