GNU bug report logs -
#60087
29.0.60; c++-ts-mode conflict with electric-pair-mode
Previous Next
Reported by: Eason Huang <aqua0210 <at> foxmail.com>
Date: Thu, 15 Dec 2022 11:34:02 UTC
Severity: normal
Found in version 29.0.60
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Eason Huang <aqua0210 <at> 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'.")
This bug report was last modified 2 years and 142 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.