Subject: Re: bug#43941: HTML+ mode: dangerous apostrophe after fullwidth parenthesis

From: Stephen Berman <[email-masked]>
Date: Mon, 12 Oct 2020 19:21:08 +0200

On Mon, 12 Oct 2020 19:29:07 +0300 Eli Zaretskii <[email-masked]> wrote:

>> From: Stephen Berman <[email-masked]>
>> Cc: Stephen Berman <[email-masked]>,  [email-masked],
>>   [email-masked]
>> Date: Mon, 12 Oct 2020 18:17:41 +0200
>> 
>> >> But the face does not change if `(' is used instead of `（', e.g. copy
>> >> the following two lines into a buffer and type `M-x html-mode' (or `M-x
>> >> mhtml-mode', the face change appears in both):
>> >
>> > So which of them is a bug?
>> 
>> In the context of the OP it seems clear that string face is wrong.  So
>> in my simpler example, that means the display of the second line
>> containing FULLWIDTH LEFT PARENTHESIS is buggy.
>
> Do the ASCII parentheses have some syntactic significance in this
> context, then?  If not, why do the parentheses affect the meaning of
> the apostrophe?

It seems they do have some syntactic significance, since the following
patch prevents string face in the examples with FULLWIDTH LEFT
PARENTHESIS:

diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index f3d8695e24..92a2215ed7 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -193,7 +193,7 @@ sgml-mode-syntax-table
 
 (defconst sgml-tag-syntax-table
   (let ((table (sgml-make-syntax-table sgml-specials)))
-    (dolist (char '(?\( ?\) ?\{ ?\} ?\[ ?\] ?$ ?% ?& ?* ?+ ?/))
+    (dolist (char '(?\( ?\) ?\{ ?\} ?\[ ?\] ?$ ?% ?& ?* ?+ ?/ ?（))
       (modify-syntax-entry char "." table))
     (unless (memq ?' sgml-specials)
       ;; Avoid that skipping a tag backwards skips any "'" prefixing it.

If this is the right approach, then all such characters would have to be
added, or is there a better alternative?

Steve Berman