GNU bug report logs -
#72068
show-paren-mode does not match Chinese parentheses correctly
Previous Next
To reply to this bug, email your comments to 72068 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72068
; Package
emacs
.
(Fri, 12 Jul 2024 05:04:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Siyuan Chen <chansey97 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 12 Jul 2024 05:04:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Reproduce steps:
1. Emacs -Q
2. M-x eval-expression
```
(progn
(setq cursor-type 'bar)
(show-paren-mode 1))
```
3. Paste the following text in any .el file
```
(英文括号)
(英文 括号)
(中文括号)
(中文 括号)
```
4. Place the cursor at the first position (or last position) of each line.
The expected behavior: All of the four lines above match and highlight
correctly
The actual behavior: The 4th line mismatched. Note the middle SPC character.
P.s.
1. This issue only occurs in lisp-like modes. It is OK in c-mode and
python-mode.
2. 【】「」『』have the same problem. They are also commonly used in lisp comment.
3. A simple investigation found that it may be related to `scan-sexps` or
syntax-table, because `(scan-sexps outside dir)` in the
`show-paren--default` returns the wrong value in the 4th case.
4. More screenshots and test code can be found in
https://emacs-china.org/t/show-paren-mode/15160
Emacs 29.3 on Windows.
Thanks.
Best regards
Siyuan Chen
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72068
; Package
emacs
.
(Fri, 12 Jul 2024 06:03:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 72068 <at> debbugs.gnu.org (full text, mbox):
> From: Siyuan Chen <chansey97 <at> gmail.com>
> Date: Fri, 12 Jul 2024 13:03:42 +0800
>
> Reproduce steps:
>
> 1. Emacs -Q
>
> 2. M-x eval-expression
>
> ```
> (progn
> (setq cursor-type 'bar)
> (show-paren-mode 1))
> ```
>
> 3. Paste the following text in any .el file
> ```
> (英文括号)
> (英文 括号)
> (中文括号)
> (中文 括号)
> ```
>
> 4. Place the cursor at the first position (or last position) of each line.
>
> The expected behavior: All of the four lines above match and highlight correctly
>
> The actual behavior: The 4th line mismatched. Note the middle SPC character.
>
> P.s.
>
> 1. This issue only occurs in lisp-like modes. It is OK in c-mode and python-mode.
>
> 2. 【】「」『』have the same problem. They are also commonly used in lisp comment.
>
> 3. A simple investigation found that it may be related to `scan-sexps` or syntax-table, because `(scan-sexps
> outside dir)` in the `show-paren--default` returns the wrong value in the 4th case.
>
> 4. More screenshots and test code can be found in https://emacs-china.org/t/show-paren-mode/15160
>
> Emacs 29.3 on Windows.
I'm not sure this is a bug, since I think Lisp allows those characters
to be treated as symbol-constituent. Stefan, am I right?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72068
; Package
emacs
.
(Fri, 12 Jul 2024 12:46:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 72068 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii [2024-07-12 09:02:49] wrote:
> I'm not sure this is a bug, since I think Lisp allows those characters
> to be treated as symbol-constituent. Stefan, am I right?
I think that's the idea, indeed. Of course, we don't have to obey the
Emacs Lisp syntax, but I think it makes sense to do so.
Admittedly, it would be nice to allow the use of other syntax rules inside
comments and string for these kinds of situations.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72068
; Package
emacs
.
(Wed, 24 Jul 2024 20:13:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 72068 <at> debbugs.gnu.org (full text, mbox):
severity 72068 wishlist
thanks
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:
> Eli Zaretskii [2024-07-12 09:02:49] wrote:
>> I'm not sure this is a bug, since I think Lisp allows those characters
>> to be treated as symbol-constituent. Stefan, am I right?
>
> I think that's the idea, indeed. Of course, we don't have to obey the
> Emacs Lisp syntax, but I think it makes sense to do so.
> Admittedly, it would be nice to allow the use of other syntax rules inside
> comments and string for these kinds of situations.
I'm not sure if this should be closed as notabug or not, but I'm tagging
it as wishlist at least. Feel free to close if that makes more sense.
Severity set to 'wishlist' from 'normal'
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Wed, 24 Jul 2024 20:13:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72068
; Package
emacs
.
(Thu, 25 Jul 2024 05:22:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 72068 <at> debbugs.gnu.org (full text, mbox):
> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Wed, 24 Jul 2024 13:11:37 -0700
> Cc: 72068 <at> debbugs.gnu.org, Siyuan Chen <chansey97 <at> gmail.com>
>
> severity 72068 wishlist
> thanks
>
> Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs <at> gnu.org> writes:
>
> > Eli Zaretskii [2024-07-12 09:02:49] wrote:
> >> I'm not sure this is a bug, since I think Lisp allows those characters
> >> to be treated as symbol-constituent. Stefan, am I right?
> >
> > I think that's the idea, indeed. Of course, we don't have to obey the
> > Emacs Lisp syntax, but I think it makes sense to do so.
> > Admittedly, it would be nice to allow the use of other syntax rules inside
> > comments and string for these kinds of situations.
>
> I'm not sure if this should be closed as notabug or not, but I'm tagging
> it as wishlist at least. Feel free to close if that makes more sense.
What solution is possible except changing the syntax table? And if
changing the syntax table is the solution, users can already do that
if they want, right?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72068
; Package
emacs
.
(Thu, 25 Jul 2024 11:36:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 72068 <at> debbugs.gnu.org (full text, mbox):
>> > I think that's the idea, indeed. Of course, we don't have to obey the
>> > Emacs Lisp syntax, but I think it makes sense to do so.
>> > Admittedly, it would be nice to allow the use of other syntax rules inside
>> > comments and string for these kinds of situations.
>>
>> I'm not sure if this should be closed as notabug or not, but I'm tagging
>> it as wishlist at least. Feel free to close if that makes more sense.
>
> What solution is possible except changing the syntax table?
A solution would be to make "syntax tables" more complex so as to be
able to have a notion of "context" (so the same character can behave
differently inside a string than outside), or equivalently a way to
use different syntax tables in different contexts.
> And if changing the syntax table is the solution, users can already do
> that if they want, right?
Other than via things like `mmm-mode` (which I've never seen used to
use different modes in strings than in code), I don't think they can.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72068
; Package
emacs
.
(Thu, 01 Aug 2024 01:11:02 GMT)
Full text and
rfc822 format available.
Message #25 received at 72068 <at> debbugs.gnu.org (full text, mbox):
On 25/07/2024 14:34, Stefan Monnier via Bug reports for GNU Emacs, the
Swiss army knife of text editors wrote:
>> And if changing the syntax table is the solution, users can already do
>> that if they want, right?
> Other than via things like `mmm-mode` (which I've never seen used to
> use different modes in strings than in code), I don't think they can.
IIRC Steve Purcell (who shares his config publicly for many other users)
used to have mmm-mode apply sql-mode inside Ruby heredocs (which are
fancy multiline strings, basically) that are "tagged" to contain SQL.
And here's somebody else who wanted to have html-mode inside a JS
string: https://github.com/dgutov/mmm-mode/issues/142 The intermediate
conclusion there is to use a ts-based config, though.
And as far as show-paren-mode goes, this might be something that
mmm-mode itself could have workarounds for anyway.
This bug report was last modified 323 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.