From: Noam Postavsky <npostavs@gmail.com>
To: Vincent Lefevre <vincent@vinc17.net>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 36092@debbugs.gnu.org
Subject: bug#36092: 27.0.50; incorrect highlighting in nXML mode with ' and raw > characters
Date: Tue, 04 Jun 2019 21:14:33 -0400 [thread overview]
Message-ID: <874l544yva.fsf@gmail.com> (raw)
In-Reply-To: <87zhmxie7n.fsf@vinc17.net> (Vincent Lefevre's message of "Tue, 04 Jun 2019 17:04:44 +0200")
[-- Attachment #1: Type: text/plain, Size: 573 bytes --]
Vincent Lefevre <vincent@vinc17.net> 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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 2602 bytes --]
From ed59843b7fa456e0614c2c63e1479458642671ea Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
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 "<root>\n"
+ (make-string 1794 ?a) "\n"
+ "'>"
+ (make-string 196 ?a) "\n"
+ "</root>")
+ (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
next prev parent reply other threads:[~2019-06-05 1:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-04 15:04 bug#36092: 27.0.50; incorrect highlighting in nXML mode with ' and raw > characters Vincent Lefevre
2019-06-05 1:14 ` Noam Postavsky [this message]
2019-06-05 1:48 ` Stefan Monnier
2019-06-05 11:28 ` Vincent Lefevre
2019-06-05 13:14 ` Noam Postavsky
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=874l544yva.fsf@gmail.com \
--to=npostavs@gmail.com \
--cc=36092@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=vincent@vinc17.net \
/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).