From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#36092: 27.0.50; incorrect highlighting in nXML mode with ' and raw > characters Date: Tue, 04 Jun 2019 21:14:33 -0400 Message-ID: <874l544yva.fsf@gmail.com> References: <87zhmxie7n.fsf@vinc17.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="11431"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: Stefan Monnier , 36092@debbugs.gnu.org To: Vincent Lefevre Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 05 03:15:33 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hYKWa-0002nY-9r for geb-bug-gnu-emacs@m.gmane.org; Wed, 05 Jun 2019 03:15:32 +0200 Original-Received: from localhost ([127.0.0.1]:33672 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYKWY-0002j9-UV for geb-bug-gnu-emacs@m.gmane.org; Tue, 04 Jun 2019 21:15:30 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYKWL-0002Px-OK for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2019 21:15:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYKWJ-0003xM-5o for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2019 21:15:17 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60798) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hYKW6-0003qJ-SP for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2019 21:15:09 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hYKW6-0003Oq-M7 for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2019 21:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 Jun 2019 01:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36092 X-GNU-PR-Package: emacs Original-Received: via spool by 36092-submit@debbugs.gnu.org id=B36092.155969728413028 (code B ref 36092); Wed, 05 Jun 2019 01:15:02 +0000 Original-Received: (at 36092) by debbugs.gnu.org; 5 Jun 2019 01:14:44 +0000 Original-Received: from localhost ([127.0.0.1]:46107 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hYKVo-0003O3-9m for submit@debbugs.gnu.org; Tue, 04 Jun 2019 21:14:44 -0400 Original-Received: from mail-it1-f170.google.com ([209.85.166.170]:55680) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hYKVl-0003Nm-Mb for 36092@debbugs.gnu.org; Tue, 04 Jun 2019 21:14:42 -0400 Original-Received: by mail-it1-f170.google.com with SMTP id i21so1050963ita.5 for <36092@debbugs.gnu.org>; Tue, 04 Jun 2019 18:14:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=DEacyXONeqMFXT2m9TZT4YO4ZFBcCgm6gGGKsti2Y8A=; b=hLmWfZcCIi5bHCLmIwNpL1r5d2tZoLE1lsVrSEFKUFXO5rkn1hXEOEhlGgNZJT53UB PZ9MerDjrtuu7XfrnxHdAGYYt9QwO22EvrkfdTQz0Gy0LRGZHTGaGfAC8qGMVdyImcgg iAFFZNjZMM46Pi+10PHF1d6R5SFDTaHAxMsLdhdI3p+GqOyeKYGcE/amopsWLkScZ0kg 5bfd6u5uTizqxsc3es5DP2+fezGyWCurbk0HAmSc5LcdGalDeJNeWRI+vrU8KMEChOWX yzSx8ZoALPmDjSN0V6cmvFCUCSpbGXXwFNnUksuFH76kr/c+cqpsFt16WX4Zz5AbsiGI MW6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=DEacyXONeqMFXT2m9TZT4YO4ZFBcCgm6gGGKsti2Y8A=; b=KtByvTeJ9esOd4TCcBwztOj/QacW9pk1UBPLTaZybDddfSEkj21MLu7NbOorvQeT3S 3+lpoledm4H/Mp1iTnpl6Nb3UwFMKZcjAIeI8pS4qgyXvkOImnAbTYGZtx7bVQkpwzI6 wmUOTKCt7N9bSsNEUCLcJDZ+0pwCA7+runp6sVhZZ3yrJapy6Kn1+MTJiYW18IRPWD/s X4JRZx5KGMTWSSQQaNTGdFB4ij02iEMStYSk/wEqA/jHZoZRwBzRDbeVHTIr6nnZcnA1 1kOF/sKEghTE7+fnASCaWM8zDcAla2RO+HywMZDwzQk/4M3f4d4754q1WG/lIsrC6wM/ OuKg== X-Gm-Message-State: APjAAAXwfIzECuTFJoo2XjVgRge9FWOhWQKTg9veWkvdQKxDUGiuHoPd jSD/5cVC3jKCEfCS2V7XMQA= X-Google-Smtp-Source: APXvYqzWGeZSp/XkASi8Y3SjsPCZiKVhHhDSwmjjshUfCIgVv1cjxBLpuHVxpqD4DcTZuSvMfslPkg== X-Received: by 2002:a24:b07:: with SMTP id 7mr21267419itd.59.1559697275987; Tue, 04 Jun 2019 18:14:35 -0700 (PDT) Original-Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id q79sm9104427itb.15.2019.06.04.18.14.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Jun 2019 18:14:34 -0700 (PDT) In-Reply-To: <87zhmxie7n.fsf@vinc17.net> (Vincent Lefevre's message of "Tue, 04 Jun 2019 17:04:44 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:160127 Archived-At: --=-=-= Content-Type: text/plain Vincent Lefevre writes: > On the following file, lines 26 and below are not highlighted > (i.e. they get the normal color). This is reproducible with > and without the -Q option. It's hitting an assertion failure during syntax-propertizing. The problem seems to be that the parse-partial-sexp call in sgml--syntax-propertize-ppss isn't using the right syntax table. I wonder why it doesn't happen for sgml-mode though (as far I can tell). Stefan, any thoughts about that? Patch below fixes it, but it might just be papering over another problem. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-nxml-syntax-propertizing-assertion-failure-Bug-3.patch Content-Description: patch >From ed59843b7fa456e0614c2c63e1479458642671ea Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Tue, 4 Jun 2019 21:08:26 -0400 Subject: [PATCH] Fix nxml syntax propertizing assertion failure (Bug#36092) * lisp/textmodes/sgml-mode.el (sgml-syntax-propertize): Use the syntax-ppss-table syntax-table. * test/lisp/nxml/nxml-mode-tests.el (nxml-mode->-after-quote): New test. --- lisp/textmodes/sgml-mode.el | 17 +++++++++-------- test/lisp/nxml/nxml-mode-tests.el | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 0c5d5e56a6..09211e1661 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -399,14 +399,15 @@ (eval-and-compile (defun sgml-syntax-propertize (start end) "Syntactic keywords for `sgml-mode'." - (setq sgml--syntax-propertize-ppss (cons start (syntax-ppss start))) - (cl-assert (>= (cadr sgml--syntax-propertize-ppss) 0)) - (sgml-syntax-propertize-inside end) - (funcall - (syntax-propertize-rules sgml-syntax-propertize-rules) - start end) - ;; Catch any '>' after the last quote. - (sgml--syntax-propertize-ppss end)) + (with-syntax-table syntax-ppss-table + (setq sgml--syntax-propertize-ppss (cons start (syntax-ppss start))) + (cl-assert (>= (cadr sgml--syntax-propertize-ppss) 0)) + (sgml-syntax-propertize-inside end) + (funcall + (syntax-propertize-rules sgml-syntax-propertize-rules) + start end) + ;; Catch any '>' after the last quote. + (sgml--syntax-propertize-ppss end))) (defun sgml-syntax-propertize-inside (end) (let ((ppss (syntax-ppss))) diff --git a/test/lisp/nxml/nxml-mode-tests.el b/test/lisp/nxml/nxml-mode-tests.el index 70816bb9de..53416b4280 100644 --- a/test/lisp/nxml/nxml-mode-tests.el +++ b/test/lisp/nxml/nxml-mode-tests.el @@ -99,5 +99,20 @@ (ert-deftest nxml-mode-prolog-comment () (should (nth 4 (syntax-ppss))) (search-forward "comment3"))) +(ert-deftest nxml-mode->-after-quote () + "Reduction from Bug#36092." + (with-temp-buffer + (insert "\n" + (make-string 1794 ?a) "\n" + "'>" + (make-string 196 ?a) "\n" + "") + (nxml-mode) + (syntax-propertize 2001) + (syntax-propertize (point-max)) ; Triggered an assert failure. + ;; Check that last tag is parsed as a tag. + (should (= 1 (- (car (syntax-ppss (1- (point-max)))) + (car (syntax-ppss (point-max)))))))) + (provide 'nxml-mode-tests) ;;; nxml-mode-tests.el ends here -- 2.11.0 --=-=-=--