GNU bug report logs - #33887
26.1; Emacs hangs for several seconds when going to the end of an XML file in nXML mode

Previous Next

Package: emacs;

Reported by: Vincent Lefevre <vincent <at> vinc17.net>

Date: Thu, 27 Dec 2018 10:14:02 UTC

Severity: normal

Tags: fixed

Merged with 25176

Found in versions 26.0.50, 26.1

Fixed in version 27.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #94 received at 33887 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Vincent Lefevre <vincent <at> vinc17.net>, 33887 <at> debbugs.gnu.org
Subject: Re: bug#33887: 26.1;
 Emacs hangs for several seconds when going to the end of an XML file
 in nXML mode
Date: Mon, 20 May 2019 16:47:11 -0400
[Message part 1 (text/plain, inline)]
> There's an issue with the following XML file, which does not have
> any special character, except a single quote in the middle of the
> text.
>
> <root>
> <a>12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
> </a>
> </root>
>
> Note that the newline character before the </a> is important.

Right, this is due to chunking by syntax-propertize.  Here's the fix:

[0001-Handle-lone-quote-500-characters-away-from-XML-tag-B.patch (text/plain, attachment)]
[Message part 3 (text/plain, inline)]
Note that you have to be sure to recompile sgml-mode.el AND nxml-mode.el
after applying these patches, 'make' isn't smart enough to do it
automatically (yes, I figured this out the hard way).

>> <t>>1</t>
>>
>> (syntax-ppss) on the location of "1" in the above, gives (-1 ...).  And
>> then (syntax-ppss) on the "/" will give (0 ...).  So the syntax
>> propertize rule for quote use of (zerop (car (syntax-ppss))) no longer
>> works correctly to see whether it's inside or outside a tag.
>>
>> ">" outside of tags should be set to syntax ".", but I would assume that
>> adding a syntax-propertize rule which calls syntax-ppss for every ">"
>> (to check whether it's inside a tag or not) will be very slow, just like
>> calling it for every quote was.

Oh, I figured it out, we can just look at (nth 9 ppss), because the list
of open parens is still okay, regardless of unmatched close parens.

[0002-Handle-outside-SGML-XML-tags-Bug-33887.patch (text/plain, attachment)]

This bug report was last modified 5 years and 353 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.