GNU bug report logs - #18871
24.4; nxml-mode: DTD edition breaks the file structure

Previous Next

Package: emacs;

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

Date: Tue, 28 Oct 2014 14:36:02 UTC

Severity: normal

Tags: fixed, patch

Merged with 23668

Found in versions 24.4, 25.0.94, 26.1

Fixed in version 27.1

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18871 in the body.
You can then email your comments to 18871 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18871; Package emacs. (Tue, 28 Oct 2014 14:36:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vincent Lefevre <vincent <at> vinc17.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 28 Oct 2014 14:36:02 GMT) Full text and rfc822 format available.

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

From: Vincent Lefevre <vincent <at> vinc17.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4; nxml-mode: DTD edition breaks the file structure
Date: Tue, 28 Oct 2014 15:34:33 +0100
Consider the following XML file:

------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE root [
<!ELEMENT root (item)*>
<!ELEMENT item (#PCDATA)>
]>

<root>
<!-- 1234567890 1234567890 1234567890 1234567890 1234567890 -->
</root>
------------------------------------------------------------------

1. Open it with "emacs -Q".
2. Go to line 2 and type C-SPC.
3. Go to line 6 and type C-w to delete the DTD.

The highlighting gets completely wrong. And if I delete the closing
tag </root> (with C-k) and type C-c C-f, I get the error:

  No matching start-tag

In more complex files, slightly editing the DTD gives the same behavior.



In GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.3)
 of 2014-10-25 on trouble, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11601000
System Description:	Debian GNU/Linux unstable (sid)

Configured using:
 `configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LC_COLLATE: POSIX
  value of $LC_CTYPE: en_US.UTF-8
  value of $LC_TIME: en_DK
  value of $LANG: POSIX
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  display-time-mode: t
  show-paren-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<escape> x r e p o r t - e m <tab> <return>

Recent messages:
ledger removed but not purged, skipping setup
Loading /etc/emacs/site-start.d/50ledger.el (source)...done
Loading /etc/emacs/site-start.d/50maxima-emacs.el (source)...done
Loading /etc/emacs/site-start.d/50psvn.el (source)...done
Loading /etc/emacs/site-start.d/50python-docutils.el (source)...done
Loading /etc/emacs/site-start.d/50rnc-mode.el (source)...done
Loading /etc/emacs/site-start.d/50w3m-el.el (source)...done
Loading /home/vlefevre/share/emacs/site-lisp/mutteditor.el (source)...done
Loading time...done
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
/usr/share/emacs24/site-lisp/css-mode/css-mode hides /usr/share/emacs/site-lisp/css-mode/css-mode
/usr/share/emacs/24.4/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/site-lisp/autoconf/autotest-mode hides /usr/share/emacs/site-lisp/autotest-mode
/usr/share/emacs24/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
/usr/share/emacs24/site-lisp/flim/hex-util hides /usr/share/emacs/24.4/lisp/hex-util
/usr/share/emacs24/site-lisp/flim/md4 hides /usr/share/emacs/24.4/lisp/md4
/usr/share/emacs24/site-lisp/html-helper-mode/tempo hides /usr/share/emacs/24.4/lisp/tempo
/usr/share/emacs/site-lisp/rst hides /usr/share/emacs/24.4/lisp/textmodes/rst
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.4/lisp/textmodes/ispell
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.4/lisp/textmodes/flyspell
/usr/share/emacs24/site-lisp/css-mode/css-mode hides /usr/share/emacs/24.4/lisp/textmodes/css-mode
/usr/share/emacs24/site-lisp/flim/hmac-md5 hides /usr/share/emacs/24.4/lisp/net/hmac-md5
/usr/share/emacs24/site-lisp/flim/sasl-ntlm hides /usr/share/emacs/24.4/lisp/net/sasl-ntlm
/usr/share/emacs24/site-lisp/flim/ntlm hides /usr/share/emacs/24.4/lisp/net/ntlm
/usr/share/emacs24/site-lisp/flim/sasl hides /usr/share/emacs/24.4/lisp/net/sasl
/usr/share/emacs24/site-lisp/flim/sasl-cram hides /usr/share/emacs/24.4/lisp/net/sasl-cram
/usr/share/emacs24/site-lisp/flim/sasl-digest hides /usr/share/emacs/24.4/lisp/net/sasl-digest
/usr/share/emacs24/site-lisp/flim/hmac-def hides /usr/share/emacs/24.4/lisp/net/hmac-def
/usr/share/emacs24/site-lisp/latex-cjk-thai/thai-word hides /usr/share/emacs/24.4/lisp/language/thai-word
/usr/share/emacs24/site-lisp/html-helper-mode/tempo hides /usr/share/emacs/site-lisp/html-helper-mode/tempo
/usr/share/emacs24/site-lisp/html-helper-mode/visual-basic-mode hides /usr/share/emacs/site-lisp/html-helper-mode/visual-basic-mode
/usr/share/emacs24/site-lisp/html-helper-mode/hhm-config hides /usr/share/emacs/site-lisp/html-helper-mode/hhm-config
/usr/share/emacs24/site-lisp/html-helper-mode/html-helper-mode hides /usr/share/emacs/site-lisp/html-helper-mode/html-helper-mode

Features:
(shadow sort gnus-util mail-extr warnings emacsbug message format-spec
rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util help-fns mail-prsvr mail-utils time cus-start
cus-load paren cc-styles cc-align cc-engine cc-vars cc-defs w3m-load
time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode prog-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind gfilenotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)

Memory information:
((conses 16 90937 6945)
 (symbols 48 20074 0)
 (miscs 40 96 93)
 (strings 32 15093 5150)
 (string-bytes 1 437464)
 (vectors 16 9916)
 (vector-slots 8 393379 6312)
 (floats 8 69 257)
 (intervals 56 232 0)
 (buffers 960 12)
 (heap 1024 42678 1099))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18871; Package emacs. (Tue, 01 Mar 2016 16:16:02 GMT) Full text and rfc822 format available.

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

From: Marcin Borkowski <mbork <at> mbork.pl>
To: Vincent Lefevre <vincent <at> vinc17.net>
Cc: 18871 <at> debbugs.gnu.org
Subject: Re: bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
Date: Tue, 01 Mar 2016 17:15:41 +0100
On 2014-10-28, at 15:34, Vincent Lefevre <vincent <at> vinc17.net> wrote:

> Consider the following XML file:
>
> ------------------------------------------------------------------
> <?xml version="1.0" encoding="utf-8"?>
> <!DOCTYPE root [
> <!ELEMENT root (item)*>
> <!ELEMENT item (#PCDATA)>
> ]>
>
> <root>
> <!-- 1234567890 1234567890 1234567890 1234567890 1234567890 -->
> </root>
> ------------------------------------------------------------------
>
> 1. Open it with "emacs -Q".
> 2. Go to line 2 and type C-SPC.
> 3. Go to line 6 and type C-w to delete the DTD.
>
> The highlighting gets completely wrong. And if I delete the closing
> tag </root> (with C-k) and type C-c C-f, I get the error:
>
>   No matching start-tag
>
> In more complex files, slightly editing the DTD gives the same behavior.

Hello and thanks for your report.

However, I have just tried to reproduce this behavior on GNU Emacs
25.1.50.4 (commit f182640), and could not.  Could you confirm that this
is no longer a problem?  (If you do not want to compile Emacs from the
Git repo, maybe try the latest pretest, see
http://alpha.gnu.org/gnu/emacs/pretest/)

Best,

-- 
Marcin Borkowski




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18871; Package emacs. (Tue, 01 Mar 2016 18:03:02 GMT) Full text and rfc822 format available.

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

From: Vincent Lefevre <vincent <at> vinc17.net>
To: Marcin Borkowski <mbork <at> mbork.pl>
Cc: 18871 <at> debbugs.gnu.org
Subject: Re: bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
Date: Tue, 1 Mar 2016 19:02:54 +0100
Hi,

On 2016-03-01 17:15:41 +0100, Marcin Borkowski wrote:
> However, I have just tried to reproduce this behavior on GNU Emacs
> 25.1.50.4 (commit f182640), and could not.  Could you confirm that this
> is no longer a problem?  (If you do not want to compile Emacs from the
> Git repo, maybe try the latest pretest, see
> http://alpha.gnu.org/gnu/emacs/pretest/)

With the current Debian package 24.5+1-6, the bug still occurs.
I'll try the pretest later.

-- 
Vincent Lefèvre <vincent <at> vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18871; Package emacs. (Wed, 02 Mar 2016 12:29:02 GMT) Full text and rfc822 format available.

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

From: Vincent Lefevre <vincent <at> vinc17.net>
To: Marcin Borkowski <mbork <at> mbork.pl>
Cc: 18871 <at> debbugs.gnu.org
Subject: Re: bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
Date: Wed, 2 Mar 2016 13:28:30 +0100
[Message part 1 (text/plain, inline)]
On 2016-03-01 17:15:41 +0100, Marcin Borkowski wrote:
> However, I have just tried to reproduce this behavior on GNU Emacs
> 25.1.50.4 (commit f182640), and could not.  Could you confirm that this
> is no longer a problem?  (If you do not want to compile Emacs from the
> Git repo, maybe try the latest pretest, see
> http://alpha.gnu.org/gnu/emacs/pretest/)

The bug is still present with GNU Emacs 25.0.91.1 (latest pretest).

zira:~> emacs --version
GNU Emacs 25.0.91.1
Copyright (C) 2016 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
zira:~> cat file.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE root [
<!ELEMENT root (item)*>
<!ELEMENT item (#PCDATA)>
]>

<root>
<!-- 1234567890 1234567890 1234567890 1234567890 1234567890 -->
</root>
zira:~> emacs -Q -nw file.xml

I've attached 2 screenshots:

screenshot1.png: after opening the file, typing C-SPC on line 2
and going to line 6. The highlighting is still OK.

screenshot2.png: after typing C-w. The highlighting is wrong.

And I still have the error with C-c C-f.

-- 
Vincent Lefèvre <vincent <at> vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
[screenshot1.png (image/png, attachment)]
[screenshot2.png (image/png, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18871; Package emacs. (Wed, 02 Mar 2016 12:45:01 GMT) Full text and rfc822 format available.

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

From: Marcin Borkowski <mbork <at> mbork.pl>
To: Vincent Lefevre <vincent <at> vinc17.net>
Cc: 18871 <at> debbugs.gnu.org
Subject: Re: bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
Date: Wed, 02 Mar 2016 13:43:53 +0100
On 2016-03-02, at 13:28, Vincent Lefevre <vincent <at> vinc17.net> wrote:

> On 2016-03-01 17:15:41 +0100, Marcin Borkowski wrote:
>> However, I have just tried to reproduce this behavior on GNU Emacs
>> 25.1.50.4 (commit f182640), and could not.  Could you confirm that this
>> is no longer a problem?  (If you do not want to compile Emacs from the
>> Git repo, maybe try the latest pretest, see
>> http://alpha.gnu.org/gnu/emacs/pretest/)
>
> The bug is still present with GNU Emacs 25.0.91.1 (latest pretest).

OK, I can see it now.  Thanks for your patience!

Confirmed on GNU Emacs 25.1.50.5 (commit f182640).

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18871; Package emacs. (Sat, 18 May 2019 19:00:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Vincent Lefevre <vincent <at> vinc17.net>
Cc: 18871 <at> debbugs.gnu.org
Subject: Re: bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
Date: Sat, 18 May 2019 14:58:53 -0400
[Message part 1 (text/plain, inline)]
tags 18871 + patch
merge 18871 23668
quit

Vincent Lefevre <vincent <at> vinc17.net> writes:

> Consider the following XML file:
>
> ------------------------------------------------------------------
> <?xml version="1.0" encoding="utf-8"?>
> <!DOCTYPE root [
> <!ELEMENT root (item)*>
> <!ELEMENT item (#PCDATA)>
> ]>
>
> <root>
> <!-- 1234567890 1234567890 1234567890 1234567890 1234567890 -->
> </root>
> ------------------------------------------------------------------
>
> 1. Open it with "emacs -Q".
> 2. Go to line 2 and type C-SPC.
> 3. Go to line 6 and type C-w to delete the DTD.
>
> The highlighting gets completely wrong. And if I delete the closing
> tag </root> (with C-k) and type C-c C-f, I get the error:
>
>   No matching start-tag
>
> In more complex files, slightly editing the DTD gives the same behavior.

Should be fixed by this patch.

[0001-Keep-nxml-prolog-end-up-to-date-Bug-18871.patch (text/x-diff, inline)]
From 5f6abb03b3b0d10dd39ece8c151a8a7857b85895 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Sat, 18 May 2019 14:54:36 -0400
Subject: [PATCH] Keep nxml-prolog-end up to date (Bug#18871)

The change on 2016-01-16 "lisp/nxml: Use syntax-tables for comments"
removed the update of nxml-prolog-end, although it already failed to
work correctly after 2013-10-07 "* lisp/nxml/nxml-mode.el: Use
lexical-binding and syntax-propertize."
* lisp/nxml/nxml-rap.el: New function.
* lisp/nxml/nxml-mode.el (nxml-mode): Add it to
after-change-functions.
---
 lisp/nxml/nxml-mode.el | 1 +
 lisp/nxml/nxml-rap.el  | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index 7c39c5023c..b816bba819 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -534,6 +534,7 @@ nxml-mode
   (setq-local syntax-ppss-table sgml-tag-syntax-table)
   (setq-local syntax-propertize-function #'nxml-syntax-propertize)
   (add-hook 'change-major-mode-hook #'nxml-cleanup nil t)
+  (add-hook 'after-change-functions #'nxml-maybe-rescan-prolog nil t)
 
   ;; Emacs 23 handles the encoding attribute on the xml declaration
   ;; transparently to nxml-mode, so there is no longer a need for the below
diff --git a/lisp/nxml/nxml-rap.el b/lisp/nxml/nxml-rap.el
index 21dbaded25..2be3981047 100644
--- a/lisp/nxml/nxml-rap.el
+++ b/lisp/nxml/nxml-rap.el
@@ -108,6 +108,12 @@ nxml-scan-prolog
     (setq nxml-prolog-regions (xmltok-forward-prolog))
     (setq nxml-prolog-end (point))))
 
+(defun nxml-maybe-rescan-prolog (start _end _length)
+  "Reparse the prolog if START lies within it.
+`nxml-mode' adds this function on `after-change-functions'."
+  (when (<= beg nxml-prolog-end)
+    (save-excursion
+      (nxml-scan-prolog))))
 
 ;;; Random access parsing
 
-- 
2.11.0


Added tag(s) patch. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 18 May 2019 19:00:02 GMT) Full text and rfc822 format available.

Merged 18871 23668. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 18 May 2019 19:00:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18871; Package emacs. (Sat, 18 May 2019 23:12:01 GMT) Full text and rfc822 format available.

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

From: Vincent Lefevre <vincent <at> vinc17.net>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 18871 <at> debbugs.gnu.org
Subject: Re: bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
Date: Sun, 19 May 2019 01:11:17 +0200
On 2019-05-18 14:58:53 -0400, Noam Postavsky wrote:
> Should be fixed by this patch.

> From 5f6abb03b3b0d10dd39ece8c151a8a7857b85895 Mon Sep 17 00:00:00 2001
> From: Noam Postavsky <npostavs <at> gmail.com>
> Date: Sat, 18 May 2019 14:54:36 -0400
> Subject: [PATCH] Keep nxml-prolog-end up to date (Bug#18871)
[...]

This patch makes 6 tests fail (when applied to the Debian package):

SUMMARY OF TEST RESULTS
-----------------------
Files examined: 186
Ran 2588 tests, 2565 results as expected, 6 unexpected, 17 skipped
2 files contained unexpected results:
  lisp/textmodes/tildify-tests.log
  lisp/nxml/nxml-mode-tests.log

lisp/textmodes/tildify-tests.log contains:

Test tildify-space-test-xml backtrace:
  nxml-maybe-rescan-prolog(1 38 0)
  insert("Testing `tildify-space' in nxml-mode\n" "Lorem v ")
  (let ((header (concat "Testing `tildify-space' in " (symbol-name mod
  (let ((mode (car --dolist-tail--))) (funcall mode) (if set-space-str
  (while --dolist-tail-- (let ((mode (car --dolist-tail--))) (funcall 
  (let ((--dolist-tail-- modes)) (while --dolist-tail-- (let ((mode (c
  (progn (set (make-local-variable 'buffer-file-coding-system) 'utf-8)
  (unwind-protect (progn (set (make-local-variable 'buffer-file-coding
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-b
  tildify-space-test--test((nxml-mode) " " "<! -- ")
  (closure (t) nil (tildify-space-test--test '(nxml-mode) " " "<! -- "
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name tildify-space-test-xml :documentation
  ert-run-or-rerun-test(#s(ert--stats :selector (not (or (tag :expensi
  ert-run-tests((not (or (tag :expensive-test) (tag :unstable))) #f(co
  ert-run-tests-batch((not (or (tag :expensive-test) (tag :unstable)))
  ert-run-tests-batch-and-exit((not (or (tag :expensive-test) (tag :un
  eval((ert-run-tests-batch-and-exit '(not (or (tag :expensive-test) (
  command-line-1(("-L" ":/tmp/mkdebs-I43HVfoe/emacs-26.1+1/debian/buil
  command-line()
  normal-top-level()
Test tildify-space-test-xml condition:
    (void-variable beg)
   FAILED   4/18  tildify-space-test-xml

Test tildify-space-undo-test-xml backtrace:
  nxml-maybe-rescan-prolog(1 41 0)
  insert("Testing double-space-undos in nxml-mode\n" "Lorem v" " " " "
  (let ((header (concat "Testing double-space-undos in " (symbol-name 
  (let ((mode (car --dolist-tail--))) (funcall mode) (if set-space-str
  (while --dolist-tail-- (let ((mode (car --dolist-tail--))) (funcall 
  (let ((--dolist-tail-- modes)) (while --dolist-tail-- (let ((mode (c
  (progn (set (make-local-variable 'buffer-file-coding-system) 'utf-8)
  (unwind-protect (progn (set (make-local-variable 'buffer-file-coding
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-b
  tildify-space-undo-test--test((nxml-mode) " " "<! -- ")
  (closure (t) nil (tildify-space-undo-test--test '(nxml-mode) " " "<!
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name tildify-space-undo-test-xml :document
  ert-run-or-rerun-test(#s(ert--stats :selector (not (or (tag :expensi
  ert-run-tests((not (or (tag :expensive-test) (tag :unstable))) #f(co
  ert-run-tests-batch((not (or (tag :expensive-test) (tag :unstable)))
  ert-run-tests-batch-and-exit((not (or (tag :expensive-test) (tag :un
  eval((ert-run-tests-batch-and-exit '(not (or (tag :expensive-test) (
  command-line-1(("-L" ":/tmp/mkdebs-I43HVfoe/emacs-26.1+1/debian/buil
  command-line()
  normal-top-level()
Test tildify-space-undo-test-xml condition:
    (void-variable beg)
   FAILED   8/18  tildify-space-undo-test-xml

Test tildify-test-xml backtrace:
  nxml-maybe-rescan-prolog(1 39 0)
  insert("Testing `tildify-buffer' in nxml-mode\n" "<p>Lorem ipsum v d
  (let ((header (concat "Testing `tildify-buffer' in " (symbol-name mo
  (let ((mode (car --dolist-tail--))) (erase-buffer) (funcall mode) (l
  (while --dolist-tail-- (let ((mode (car --dolist-tail--))) (erase-bu
  (let ((--dolist-tail-- modes)) (while --dolist-tail-- (let ((mode (c
  (progn (set (make-local-variable 'buffer-file-coding-system) 'utf-8)
  (unwind-protect (progn (set (make-local-variable 'buffer-file-coding
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-b
  tildify-test--test((nxml-mode) "<p>Lorem ipsum v dolor sit amet, a c
  (let* ((sentence (tildify-test--example-sentence " ")) (with-nbsp (t
  (closure (t) nil (let* ((sentence (tildify-test--example-sentence " 
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name tildify-test-xml :documentation "Test
  ert-run-or-rerun-test(#s(ert--stats :selector (not (or (tag :expensi
  ert-run-tests((not (or (tag :expensive-test) (tag :unstable))) #f(co
  ert-run-tests-batch((not (or (tag :expensive-test) (tag :unstable)))
  ert-run-tests-batch-and-exit((not (or (tag :expensive-test) (tag :un
  eval((ert-run-tests-batch-and-exit '(not (or (tag :expensive-test) (
  command-line-1(("-L" ":/tmp/mkdebs-I43HVfoe/emacs-26.1+1/debian/buil
  command-line()
  normal-top-level()
Test tildify-test-xml condition:
    (void-variable beg)
   FAILED  18/18  tildify-test-xml

lisp/nxml/nxml-mode-tests.log contains:

Test nxml-balanced-close-start-tag-inline backtrace:
  nxml-maybe-rescan-prolog(1 15 0)
  insert("<a><b c=\"\"</a>")
  (progn (nxml-mode) (insert "<a><b c=\"\"</a>") (search-backward "</a
  (unwind-protect (progn (nxml-mode) (insert "<a><b c=\"\"</a>") (sear
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-b
  (closure (t) nil (let ((temp-buffer (generate-new-buffer " *temp*"))
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name nxml-balanced-close-start-tag-inline 
  ert-run-or-rerun-test(#s(ert--stats :selector (not (or (tag :expensi
  ert-run-tests((not (or (tag :expensive-test) (tag :unstable))) #f(co
  ert-run-tests-batch((not (or (tag :expensive-test) (tag :unstable)))
  ert-run-tests-batch-and-exit((not (or (tag :expensive-test) (tag :un
  eval((ert-run-tests-batch-and-exit '(not (or (tag :expensive-test) (
  command-line-1(("-L" ":/tmp/mkdebs-I43HVfoe/emacs-26.1+1/debian/buil
  command-line()
  normal-top-level()
Test nxml-balanced-close-start-tag-inline condition:
    (void-variable beg)
   FAILED  1/4  nxml-balanced-close-start-tag-inline

Test nxml-indent-line-after-attribute backtrace:
  nxml-maybe-rescan-prolog(1 303 0)
  insert("\n<settings\n    xmlns=\"http://maven.apache.org/SETTINGS/1.
  (progn (nxml-mode) (insert str) (indent-region (point-min) (point-ma
  (unwind-protect (progn (nxml-mode) (insert str) (indent-region (poin
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-b
  nxml-mode-tests-correctly-indented-string("\n<settings\n    xmlns=\"
  apply(nxml-mode-tests-correctly-indented-string "\n<settings\n    xm
  (setq value-2 (apply fn-0 args-1))
  (unwind-protect (setq value-2 (apply fn-0 args-1)) (setq form-descri
  (if (unwind-protect (setq value-2 (apply fn-0 args-1)) (setq form-de
  (let (form-description-4) (if (unwind-protect (setq value-2 (apply f
  (let ((value-2 'ert-form-evaluation-aborted-3)) (let (form-descripti
  (let* ((fn-0 (function nxml-mode-tests-correctly-indented-string)) (
  (closure (t) nil (let* ((fn-0 (function nxml-mode-tests-correctly-in
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name nxml-indent-line-after-attribute :doc
  ert-run-or-rerun-test(#s(ert--stats :selector (not (or (tag :expensi
  ert-run-tests((not (or (tag :expensive-test) (tag :unstable))) #f(co
  ert-run-tests-batch((not (or (tag :expensive-test) (tag :unstable)))
  ert-run-tests-batch-and-exit((not (or (tag :expensive-test) (tag :un
  eval((ert-run-tests-batch-and-exit '(not (or (tag :expensive-test) (
  command-line-1(("-L" ":/tmp/mkdebs-I43HVfoe/emacs-26.1+1/debian/buil
  command-line()
  normal-top-level()
Test nxml-indent-line-after-attribute condition:
    (void-variable beg)
   FAILED  2/4  nxml-indent-line-after-attribute

Test nxml-mode-font-lock-quotes backtrace:
  nxml-maybe-rescan-prolog(1 66 0)
  insert("<x a=\"dquote attr\" b='squote attr'>\"dquote text\"'squote 
  (progn (nxml-mode) (insert "<x a=\"dquote attr\" b='squote attr'>\"d
  (unwind-protect (progn (nxml-mode) (insert "<x a=\"dquote attr\" b='
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-b
  (closure (t) nil (let ((temp-buffer (generate-new-buffer " *temp*"))
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name nxml-mode-font-lock-quotes :documenta
  ert-run-or-rerun-test(#s(ert--stats :selector (not (or (tag :expensi
  ert-run-tests((not (or (tag :expensive-test) (tag :unstable))) #f(co
  ert-run-tests-batch((not (or (tag :expensive-test) (tag :unstable)))
  ert-run-tests-batch-and-exit((not (or (tag :expensive-test) (tag :un
  eval((ert-run-tests-batch-and-exit '(not (or (tag :expensive-test) (
  command-line-1(("-L" ":/tmp/mkdebs-I43HVfoe/emacs-26.1+1/debian/buil
  command-line()
  normal-top-level()
Test nxml-mode-font-lock-quotes condition:
    (void-variable beg)
   FAILED  4/4  nxml-mode-font-lock-quotes

-- 
Vincent Lefèvre <vincent <at> vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18871; Package emacs. (Sat, 18 May 2019 23:23:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Vincent Lefevre <vincent <at> vinc17.net>
Cc: 18871 <at> debbugs.gnu.org
Subject: Re: bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
Date: Sat, 18 May 2019 19:22:13 -0400
[Message part 1 (text/plain, inline)]
Vincent Lefevre <vincent <at> vinc17.net> writes:

> This patch makes 6 tests fail (when applied to the Debian package):

>     (void-variable beg)

Dang it, I had thought I had fixed that before posting.  Here's the
correct version.

[0001-Keep-nxml-prolog-end-up-to-date-Bug-18871.patch (text/x-diff, inline)]
From b8c659dc0c6ef41adc19db3c1884f73c1a10c8d8 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Sat, 18 May 2019 14:54:36 -0400
Subject: [PATCH] Keep nxml-prolog-end up to date (Bug#18871)

The change on 2016-01-16 "lisp/nxml: Use syntax-tables for comments"
removed the update of nxml-prolog-end, although it already failed to
work correctly after 2013-10-07 "* lisp/nxml/nxml-mode.el: Use
lexical-binding and syntax-propertize."
* lisp/nxml/nxml-rap.el: New function.
* lisp/nxml/nxml-mode.el (nxml-mode): Add it to
after-change-functions.
---
 lisp/nxml/nxml-mode.el | 1 +
 lisp/nxml/nxml-rap.el  | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index 7c39c5023c..b816bba819 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -534,6 +534,7 @@ nxml-mode
   (setq-local syntax-ppss-table sgml-tag-syntax-table)
   (setq-local syntax-propertize-function #'nxml-syntax-propertize)
   (add-hook 'change-major-mode-hook #'nxml-cleanup nil t)
+  (add-hook 'after-change-functions #'nxml-maybe-rescan-prolog nil t)
 
   ;; Emacs 23 handles the encoding attribute on the xml declaration
   ;; transparently to nxml-mode, so there is no longer a need for the below
diff --git a/lisp/nxml/nxml-rap.el b/lisp/nxml/nxml-rap.el
index 21dbaded25..3be413ae00 100644
--- a/lisp/nxml/nxml-rap.el
+++ b/lisp/nxml/nxml-rap.el
@@ -108,6 +108,12 @@ nxml-scan-prolog
     (setq nxml-prolog-regions (xmltok-forward-prolog))
     (setq nxml-prolog-end (point))))
 
+(defun nxml-maybe-rescan-prolog (start _end _length)
+  "Reparse the prolog if START lies within it.
+`nxml-mode' adds this function on `after-change-functions'."
+  (when (<= start nxml-prolog-end)
+    (save-excursion
+      (nxml-scan-prolog))))
 
 ;;; Random access parsing
 
-- 
2.11.0


Merged 18871 23668 32823. Request was from npostavs <at> gmail.com to control <at> debbugs.gnu.org. (Mon, 27 May 2019 19:23:02 GMT) Full text and rfc822 format available.

Disconnected #32823 from all other report(s). Request was from npostavs <at> gmail.com to control <at> debbugs.gnu.org. (Mon, 27 May 2019 20:36:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18871; Package emacs. (Tue, 04 Jun 2019 13:00:03 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Vincent Lefevre <vincent <at> vinc17.net>
Cc: 18871 <at> debbugs.gnu.org
Subject: Re: bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
Date: Tue, 04 Jun 2019 08:59:43 -0400
tags 18871 fixed
close 18871 27.1
quit

> Subject: [PATCH] Keep nxml-prolog-end up to date (Bug#18871)

Pushed to master.

3f2bfe9a19 2019-06-04T08:42:50-04:00 "Keep nxml-prolog-end up to date (Bug#18871)"
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=3f2bfe9a1955df3832a78bdfbb03314875601730





Added tag(s) fixed. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 04 Jun 2019 13:00:06 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 18871 <at> debbugs.gnu.org and Vincent Lefevre <vincent <at> vinc17.net> Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 04 Jun 2019 13:00:08 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 03 Jul 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 270 days ago.

Previous Next


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