bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Stephen Berman
Subject: bug#43941: HTML+ mode: dangerous apostrophe after fullwidth parenthesis
Date: Mon, 12 Oct 2020 23:26:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

On Mon, 12 Oct 2020 20:38:15 +0300 Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Stephen Berman <stephen.berman@gmx.net>
>> Cc: Stephen Berman <stephen.berman@gmx.net>,  jidanni@jidanni.org,
>>   43941@debbugs.gnu.org
>> Date: Mon, 12 Oct 2020 19:21:08 +0200
>> 
>> 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?
>
> It shouldn't be hard to add to the list some of the characters that
> have the paired bracket semantics, see uni-brackets.el.

Some, but which?  I used the following the code to add all the
paired-bracket characters listed in that file:

diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index f3d8695e24..c2c3f61e3d 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -192,8 +192,20 @@ sgml-mode-syntax-table
   "Syntax table used in SGML mode.  See also `sgml-specials'.")

 (defconst sgml-tag-syntax-table
-  (let ((table (sgml-make-syntax-table sgml-specials)))
-    (dolist (char '(?\( ?\) ?\{ ?\} ?\[ ?\] ?$ ?% ?& ?* ?+ ?/))
+  (let ((table (sgml-make-syntax-table sgml-specials))
+       brackets)
+    (setq brackets (delete-dups
+                   (flatten-tree
+                    (map-char-table
+                     (lambda (key value)
+                       (setq brackets (cons (list
+                                             (if (consp key)
+                                                 (list (car key) (cdr key))
+                                               key)
+                                             value)
+                                            brackets)))
+                     (unicode-property-table-internal 'paired-bracket)))))
+    (dolist (char (append brackets (list ?$ ?% ?& ?* ?+ ?/)))
       (modify-syntax-entry char "." table))
     (unless (memq ?' sgml-specials)
       ;; Avoid that skipping a tag backwards skips any "'" prefixing it.
But this fails to prevent the unwanted string face fontification.
According to the above code, there are 120 different paired-bracket
characters, so it will be time-consuming to isolate just the ones that
work.

>                                                          But some
> SGML/HTML expert should say if that is TRT, indeed.

Yes, hopefully before Someone™ toils through the 120 characters.

Steve Berman

reply via email to

[Prev in Thread] Current Thread [Next in Thread]