unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 43941@debbugs.gnu.org, jidanni@jidanni.org
Subject: bug#43941: HTML+ mode: dangerous apostrophe after fullwidth parenthesis
Date: Mon, 12 Oct 2020 23:26:15 +0200	[thread overview]
Message-ID: <878scbyw3s.fsf@rub.de> (raw)
In-Reply-To: <83blh72vlk.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 12 Oct 2020 20:38:15 +0300")

[-- Attachment #1: Type: text/plain, Size: 1299 bytes --]

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sgml-mode-syntax-table patch --]
[-- Type: text/x-patch, Size: 1115 bytes --]

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.

[-- Attachment #3: Type: text/plain, Size: 429 bytes --]


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	other threads:[~2020-10-12 21:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-11 14:30 bug#43941: HTML+ mode: dangerous apostrophe after fullwidth parenthesis 積丹尼 Dan Jacobson
2020-10-12 14:48 ` Eli Zaretskii
2020-10-12 14:52   ` 積丹尼 Dan Jacobson
2020-10-12 15:11   ` Stephen Berman
2020-10-12 15:20     ` Eli Zaretskii
2020-10-12 16:17       ` Stephen Berman
2020-10-12 16:29         ` Eli Zaretskii
2020-10-12 17:21           ` Stephen Berman
2020-10-12 17:38             ` Eli Zaretskii
2020-10-12 21:26               ` Stephen Berman [this message]
2020-10-13 10:37                 ` Stephen Berman
2021-06-13 12:21                   ` bug#43941: bug#40844: html mode sometimes fooled by apostrophe Lars Ingebrigtsen
2021-06-13 18:14                     ` Stephen Berman
2021-06-14 13:00                       ` bug#43941: bug#46312: HTML+ mode vs. quotes Lars Ingebrigtsen
2021-06-14 13:02                         ` bug#40844: " Eli Zaretskii
2021-06-14 13:52                         ` Stephen Berman
2021-06-14 13:58                           ` bug#43941: " Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878scbyw3s.fsf@rub.de \
    --to=stephen.berman@gmx.net \
    --cc=43941@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jidanni@jidanni.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).