Subject: bug#72068: show-paren-mode does not match Chinese parentheses correctly

From: Siyuan Chen <[email-masked]>
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.

Thanks.

Best regards
Siyuan Chen