From unknown Fri Aug 15 21:25:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13844: [PATCH] Fix html-mode quotes syntax in text Resent-From: Dale Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Mar 2013 01:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13844 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 13844@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.136210258432328 (code B ref -1); Fri, 01 Mar 2013 01:50:01 +0000 Received: (at submit) by debbugs.gnu.org; 1 Mar 2013 01:49:44 +0000 Received: from localhost ([127.0.0.1]:57024 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBF6V-0008PL-GJ for submit@debbugs.gnu.org; Thu, 28 Feb 2013 20:49:44 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35703) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBENy-0007JJ-7O for submit@debbugs.gnu.org; Thu, 28 Feb 2013 20:03:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UBEM0-0003Pu-Ka for submit@debbugs.gnu.org; Thu, 28 Feb 2013 20:01:43 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:46535) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBEM0-0003Pq-Hd for submit@debbugs.gnu.org; Thu, 28 Feb 2013 20:01:40 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47052) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBELx-00078u-VM for bug-gnu-emacs@gnu.org; Thu, 28 Feb 2013 20:01:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UBELt-0003P2-Uj for bug-gnu-emacs@gnu.org; Thu, 28 Feb 2013 20:01:37 -0500 Received: from mail-ie0-x236.google.com ([2607:f8b0:4001:c03::236]:49458) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBELt-0003Ou-Qy for bug-gnu-emacs@gnu.org; Thu, 28 Feb 2013 20:01:33 -0500 Received: by mail-ie0-f182.google.com with SMTP id k14so2935069iea.13 for ; Thu, 28 Feb 2013 17:01:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=5/NRwXbW5ekQo3sfX818kQFLVCWOdbLdwcgE4HjAaZ4=; b=d+pkBTVcosU3u6T47QhkzARQ+zTzyt3jqPK+BtedTVO4h45M5dT8Hkh3glPZBRVCd0 i9CAG93vaXE05oqyPYyboDbsTVuaibd4Y2WvkXsxpF9Zvx9fOp3HW9QuxjdF2DxIy2nT 0cFBTFIMS4It5RpvarOLC43XjDEITOy+ClqAsWfc0P14bVCQlTaq8EK37tO+mMIOgfrr fzbg9U20viouUhEvxV+FqpkodHrAgght4KIjbC4BWiRvGFVECfs1vBGNtDFNGlUKX7WZ jYVcaUrHZRei2dAsP8/bop8t3tNc/7Pi+Rm79NAVcOsmSYAPdEohhBvp1VbRpnnmqUP9 qzTg== X-Received: by 10.50.47.200 with SMTP id f8mr11610219ign.98.1362099692519; Thu, 28 Feb 2013 17:01:32 -0800 (PST) Received: from dale.caliginous.net (c-67-165-179-226.hsd1.il.comcast.net. [67.165.179.226]) by mx.google.com with ESMTPS id wo8sm7991584igb.6.2013.02.28.17.01.31 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Feb 2013 17:01:31 -0800 (PST) Message-ID: <512FFDEA.6040000@codefu.org> Date: Thu, 28 Feb 2013 19:01:30 -0600 From: Dale User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnpgByojkSKjh2rnKoZLPmbJp3ozXwogKKwtwXJPtdKV6Xlj7gTMfx6aNvw4M83KrWWWWLd X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-Mailman-Approved-At: Thu, 28 Feb 2013 20:49:41 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Hi, I noticed Emacs was colorizing the following sample wrong in html-mode: ~~~~~~
" Dangling quote makes the closing tag get highlighted as a string
" Highlighting now fixed:
Additionally, if you have apostrophe in sgml-specials, this more common usage will break: Dave's bar Now this tag will have incorrect highlighting:
~~~~~~ I believe I've tracked this down to two problems: 1. sgml-syntax-propertize-function is already prepared to correctly set the syntax on " (double quotes) within text, but returns "." for the syntax-table property value. That's not a valid value for syntax-table propertize. It needs to use (string-to-syntax "."). 2. sgml-syntax-propertize-function doesn't account for the fact that you could have set ' (apostrophe) in sgml-specials, which causes apostrophe to be set as string syntax in the syntax table, just like " is by default. The patch below hopefully fixes both problems. I believe I have filed my copyright assignment with the FSF for Emacs already. ChangeLog entry: ~~~~~~ 2013-02-28 Dale Sedivec * textmodes/sgml-mode.el (sgml-syntax-propertize-function): Return valid syntax-table property value when converting quotes within text from string syntax to punctuation syntax. Also perform this adjustment when apostrophe (?') is in sgml-specials. ~~~~~~ Patch against Git master follows. Dale *** /var/folders/l1/l_tpw26n35zbm0fp4x22_vjh0000kk/T//85VjC0_sgml-mode.el 2013-02-28 19:00:02.000000000 -0600 --- lisp/textmodes/sgml-mode.el 2013-02-28 18:54:52.000000000 -0600 *************** *** 312,328 **** (defconst sgml-syntax-propertize-function (syntax-propertize-rules ! ;; Use the `b' style of comments to avoid interference with the -- ... -- ! ;; comments recognized when `sgml-specials' includes ?-. ! ;; FIXME: beware of blabla !! ("\\(<\\)!--" (1 "< b")) ! ("--[ \t\n]*\\(>\\)" (1 "> b")) ! ;; Double quotes outside of tags should not introduce strings. ! ;; Be careful to call `syntax-ppss' on a position before the one we're ! ;; going to change, so as not to need to flush the data we just computed. ! ("\"" (0 (if (prog1 (zerop (car (syntax-ppss (match-beginning 0)))) ! (goto-char (match-end 0))) ! ".")))) "Syntactic keywords for `sgml-mode'.") ;; internal --- 312,335 ---- (defconst sgml-syntax-propertize-function (syntax-propertize-rules ! ;; Use the `b' style of comments to avoid interference with the -- ... -- ! ;; comments recognized when `sgml-specials' includes ?-. ! ;; FIXME: beware of blabla !! ("\\(<\\)!--" (1 "< b")) ! ("--[ \t\n]*\\(>\\)" (1 "> b")) ! ;; Quotes (single or double) outside of tags should not introduce ! ;; strings. Be careful to call `syntax-ppss' on a position before ! ;; the one we're going to change, so as not to need to flush the ! ;; data we just computed. ! ((let (string-delimiters) ! (when (memq ?\" sgml-specials) ! (setq string-delimiters (cons ?\" string-delimiters))) ! (when (memq ?' sgml-specials) ! (setq string-delimiters (cons ?' string-delimiters))) ! (regexp-opt-charset string-delimiters)) ! (0 (if (prog1 (zerop (car (syntax-ppss (match-beginning 0)))) ! (goto-char (match-end 0))) ! (string-to-syntax "."))))) "Syntactic keywords for `sgml-mode'.") ;; internal From unknown Fri Aug 15 21:25:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13844: [PATCH] Fix html-mode quotes syntax in text Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Mar 2013 03:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13844 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dale Cc: 13844@debbugs.gnu.org Received: via spool by 13844-submit@debbugs.gnu.org id=B13844.136210962010288 (code B ref 13844); Fri, 01 Mar 2013 03:47:01 +0000 Received: (at 13844) by debbugs.gnu.org; 1 Mar 2013 03:47:00 +0000 Received: from localhost ([127.0.0.1]:57119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBGvy-0002fs-CC for submit@debbugs.gnu.org; Thu, 28 Feb 2013 22:46:59 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:64968) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBGvv-0002fi-LF for 13844@debbugs.gnu.org; Thu, 28 Feb 2013 22:46:56 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFpaTU/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOIYZwZgV6DFQ X-IPAS-Result: Av4EABK/CFFFpaTU/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOIYZwZgV6DFQ X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="2743100" Received: from 69-165-164-212.dsl.teksavvy.com (HELO pastel.home) ([69.165.164.212]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 28 Feb 2013 22:44:54 -0500 Received: by pastel.home (Postfix, from userid 20848) id 1FA186A65A; Thu, 28 Feb 2013 22:44:55 -0500 (EST) From: Stefan Monnier Message-ID: References: <512FFDEA.6040000@codefu.org> Date: Thu, 28 Feb 2013 22:44:55 -0500 In-Reply-To: <512FFDEA.6040000@codefu.org> (dale@codefu.org's message of "Thu, 28 Feb 2013 19:01:30 -0600") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > The patch below hopefully fixes both problems. > I believe I have filed my copyright assignment with the FSF for > Emacs already. Thanks. I installed the first part, but the second breaks compilation (because the regexp is computed during compilation, at which point sgml-specials is not yet defined). Stefan From unknown Fri Aug 15 21:25:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13844: [PATCH] Fix html-mode quotes syntax in text Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Feb 2016 05:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13844 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 13844@debbugs.gnu.org, Dale Received: via spool by 13844-submit@debbugs.gnu.org id=B13844.145629263516346 (code B ref 13844); Wed, 24 Feb 2016 05:44:01 +0000 Received: (at 13844) by debbugs.gnu.org; 24 Feb 2016 05:43:55 +0000 Received: from localhost ([127.0.0.1]:42234 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYSEt-0004FY-7O for submit@debbugs.gnu.org; Wed, 24 Feb 2016 00:43:55 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:36517) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYSEr-0004FQ-Pr for 13844@debbugs.gnu.org; Wed, 24 Feb 2016 00:43:54 -0500 Received: from cpe-60-225-211-161.nsw.bigpond.net.au ([60.225.211.161] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aYSEQ-000288-Vg; Wed, 24 Feb 2016 06:43:27 +0100 From: Lars Ingebrigtsen References: <512FFDEA.6040000@codefu.org> Date: Wed, 24 Feb 2016 16:43:22 +1100 In-Reply-To: (Stefan Monnier's message of "Thu, 28 Feb 2013 22:44:55 -0500") Message-ID: <87h9gyfyth.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1aYSEQ-000288-Vg X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1456897408.22507@M6KToGLZNiu/lMHTIOsDXA X-Spam-Status: No X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Stefan Monnier writes: >> The patch below hopefully fixes both problems. >> I believe I have filed my copyright assignment with the FSF for >> Emacs already. > > Thanks. I installed the first part, but the second breaks compilation > (because the regexp is computed during compilation, at which point > sgml-specials is not yet defined). --- Additionally, if you have apostrophe in sgml-specials, this more common usage will break: Dave's bar Now this tag will have incorrect highlighting:
--- This is now done correctly in the Emacs trunk, apparently, so I'm closing this bug report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 24 00:44:00 2016 Received: (at control) by debbugs.gnu.org; 24 Feb 2016 05:44:00 +0000 Received: from localhost ([127.0.0.1]:42237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYSEy-0004Fu-Ei for submit@debbugs.gnu.org; Wed, 24 Feb 2016 00:44:00 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:36524) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYSEw-0004Fj-7E for control@debbugs.gnu.org; Wed, 24 Feb 2016 00:43:58 -0500 Received: from cpe-60-225-211-161.nsw.bigpond.net.au ([60.225.211.161] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aYSEZ-00028R-9Z for control@debbugs.gnu.org; Wed, 24 Feb 2016 06:43:36 +0100 Date: Wed, 24 Feb 2016 16:43:31 +1100 Message-Id: <87fuwifyt8.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #13844 X-MailScanner-ID: 1aYSEZ-00028R-9Z X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1456897416.08196@PH+rR/qIiHbJypZvBASs1A X-Spam-Status: No X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) tags 13844 fixed close 13844