From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#43941: HTML+ mode: dangerous apostrophe after fullwidth parenthesis Date: Tue, 13 Oct 2020 12:37:32 +0200 Message-ID: <87sgai76oj.fsf@gmx.net> References: <87pn5oq1hj.5.fsf@jidanni.org> <831ri34i0b.fsf@gnu.org> <87o8l7zdh6.fsf@rub.de> <83o8l731yd.fsf@gnu.org> <87h7qzzae2.fsf@rub.de> <83lfgb2yss.fsf@gnu.org> <87d01nz7gb.fsf@rub.de> <83blh72vlk.fsf@gnu.org> <878scbyw3s.fsf@rub.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5332"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 43941@debbugs.gnu.org, jidanni@jidanni.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 13 12:38:55 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kSHhn-0001Ij-Gg for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Oct 2020 12:38:55 +0200 Original-Received: from localhost ([::1]:46746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSHhm-0004Ve-97 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Oct 2020 06:38:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSHgx-0004Lv-VZ for bug-gnu-emacs@gnu.org; Tue, 13 Oct 2020 06:38:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33759) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kSHgv-00047V-TG for bug-gnu-emacs@gnu.org; Tue, 13 Oct 2020 06:38:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kSHgv-0005lB-Qd for bug-gnu-emacs@gnu.org; Tue, 13 Oct 2020 06:38:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Oct 2020 10:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43941 X-GNU-PR-Package: emacs Original-Received: via spool by 43941-submit@debbugs.gnu.org id=B43941.160258546922121 (code B ref 43941); Tue, 13 Oct 2020 10:38:01 +0000 Original-Received: (at 43941) by debbugs.gnu.org; 13 Oct 2020 10:37:49 +0000 Original-Received: from localhost ([127.0.0.1]:45305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kSHgj-0005kj-Ab for submit@debbugs.gnu.org; Tue, 13 Oct 2020 06:37:49 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:40991) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kSHgh-0005kT-0V for 43941@debbugs.gnu.org; Tue, 13 Oct 2020 06:37:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1602585456; bh=2w9/Rc44M+p0D8FHnQbwr6rIIFM1xq1ppAtcTTjY3fg=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=G/02zVMfeOCUPOwaookfm1gzwpEU3yuyo543XyBNq5pk2NTR2ly/GOcYKiQVqEh6k 7UilrA7ABMOJ5SBRSAlGBJklVsXlyPSTRKXyGYb9C6vuQuUSAR/8AfZ6Afdsu+ioyk I8mGOT8jBxs5ifCIaV6fmSsJSmUOQi7Q070CNMyA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from strobe-jhalfs ([188.109.195.67]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MDhlV-1kaIIJ0FWh-00An3D; Tue, 13 Oct 2020 12:37:36 +0200 In-Reply-To: <878scbyw3s.fsf@rub.de> (Stephen Berman's message of "Mon, 12 Oct 2020 23:26:15 +0200") X-Provags-ID: V03:K1:a6e7yMQ+itwcYJHyP4Fswdkf/UVAtkj5iQGzhKWgJFl5szlS+69 Qtwx7SwIc+5xtPA2XonsP8YZpGsRAN294lkvHBhaPUCy0IDT5KxH4JsPIsNpVv+3al2eOfv AmV0kmPSXTUblCz+I8rdJHPleF9uiJhYIKiWYAUQG8nFtR6I8/5T/gpQEWQBgpvP5wkZ7mo H+j2mgRlJaq4Nlm1yWZCg== X-UI-Out-Filterresults: notjunk:1;V03:K0:IYfYX28BDWA=:LOcYptCpD7nWaWM+30FI/1 v6kON9VyS2nanDFr3GBuP411EdoX36Bs+6bOPiXKcrInZQgV7C4edni7XHWMggOGhIGb6bX+c AWsOfFxJ2CoY2PRcwnZHXuKaQOkgEK938QRc1zsp/qPGbyoIBubbFmkYBOCZgqajBm4w4QpAc gKUaXkrtsGIpn9og+Se/01DT3Ycu13vU0yRpCrn3Bl+D61teej5WpOHhP+ees2m+dZ4tLpIhA p6OgmN4xoOVUP7vbcL2rm/8ASTgn7yWDqvOLiFsEkqooFxDsRlMhrtxrlA0IpbN0yzI4Bt6bq JHpuwtKtWlWnnhzKnFx+j1zHVH9yHMaOLYSVhaW3ItOavmfUYMWILUq0WKDvNJvAxSrF1e49+ LC32I5QC8pk5gyyHk7ygl0OUlAu0AE3Plrw3bACZ0MZzqNX5sYJVaHJHcMhNWkpRHLX4xfFo5 hpO7xlT6yPjRK3bVahdUwy1DKo/MuJOkXUvyLxEBZ0ouZDE06FhyQQnzl1mbPMByE3B0pYwNl 7tAQpOklQdkNE6SJTIi+5QoqD/q0CBvjLdkvs2MAog4bqTvOjfFXfaCWywnH5cETPyvf7gzDr qtNo19cA4GlmbVISplgInZljD519rmQq7lYLA6g4Yz2vjdgFOXeJeZ46c+C90/0WewVFwtmAE 2ntfgKD1GoNuBrzJy7U0GDY+fvONo4gpBVEff7eaF3PE15Y3ng5RLUa0KT9wv3T3gcMcxnM/T UCnqWbQSqS95JbAIhAFxyGGh80PSl28vxdCQ/4yu8l6t9+3KWqt4nBX57MY84xhojiS4lEn5 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:190411 Archived-At: --=-=-= Content-Type: text/plain On Mon, 12 Oct 2020 23:26:15 +0200 Stephen Berman wrote: > On Mon, 12 Oct 2020 20:38:15 +0300 Eli Zaretskii wrote: > [...] >> 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: [...] > But this fails to prevent the unwanted string face fontification. I made a silly mistake (it was late and I was tired). Here is a corrected version: --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: sgml-mode-syntax-table patch Content-Transfer-Encoding: quoted-printable diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index f3d8695e24..26ca536004 100644 =2D-- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -192,8 +192,19 @@ 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) + (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)) + (setq brackets (delete-dups (flatten-tree brackets))) + (dolist (char (append brackets (list ?$ ?% ?& ?* ?+ ?/))) (modify-syntax-entry char "." table)) (unless (memq ?' sgml-specials) ;; Avoid that skipping a tag backwards skips any "'" prefixing it. --=-=-= Content-Type: text/plain With this patch, when any of the paired-bracket characters is followed by `'' in html-mode, there is indeed no string face fontification on the latter (and following characters). The following function demonstrates this: (defun sgml-test-brackets () "Test fontification of apostrophe preceded by paired-bracket character." (interactive) (let ((buf (get-buffer-create "*sgml-test*")) brackets results) (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)) (setq brackets (delete-dups (flatten-tree brackets))) (setq brackets (append brackets (list ?$ ?% ?& ?* ?+ ?/))) (while brackets (let ((char (string (pop brackets))) (face "default")) (with-current-buffer buf ;; (erase-buffer) (fundamental-mode) (insert (concat "

" char "'s

\n")) (html-mode) ;; (let ((val (get-text-property 5 'face))) ;; (when val (setq face (symbol-name val)))) ;; (push (concat char " : " face "\n") results) ))) ;; (with-current-buffer buf ;; (newline) ;; (while results ;; (insert (pop results)))) (switch-to-buffer buf))) I wanted to turn this function into a test, and that's what the commented out lines are supposed to do. But when I uncomment these lines and call this function with the unpatched (i.e. current) version of sgml-mode-syntax-table, it still shows default face for `'' with all the paired-bracket characters. Yet when I step through the function with Ediff, I do see some cases with font-lock-string-face. I don't understand what's going on here. Steve Berman --=-=-=--