unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
@ 2014-10-28 14:34 Vincent Lefevre
  2016-03-01 16:15 ` Marcin Borkowski
  2019-05-18 18:58 ` Noam Postavsky
  0 siblings, 2 replies; 9+ messages in thread
From: Vincent Lefevre @ 2014-10-28 14:34 UTC (permalink / raw)
  To: 18871


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))





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
  2014-10-28 14:34 bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure Vincent Lefevre
@ 2016-03-01 16:15 ` Marcin Borkowski
  2016-03-01 18:02   ` Vincent Lefevre
  2016-03-02 12:28   ` Vincent Lefevre
  2019-05-18 18:58 ` Noam Postavsky
  1 sibling, 2 replies; 9+ messages in thread
From: Marcin Borkowski @ 2016-03-01 16:15 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: 18871

On 2014-10-28, at 15:34, Vincent Lefevre <vincent@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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
  2016-03-01 16:15 ` Marcin Borkowski
@ 2016-03-01 18:02   ` Vincent Lefevre
  2016-03-02 12:28   ` Vincent Lefevre
  1 sibling, 0 replies; 9+ messages in thread
From: Vincent Lefevre @ 2016-03-01 18:02 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: 18871

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@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)





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
  2016-03-01 16:15 ` Marcin Borkowski
  2016-03-01 18:02   ` Vincent Lefevre
@ 2016-03-02 12:28   ` Vincent Lefevre
  2016-03-02 12:43     ` Marcin Borkowski
  1 sibling, 1 reply; 9+ messages in thread
From: Vincent Lefevre @ 2016-03-02 12:28 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: 18871

[-- Attachment #1: Type: text/plain, Size: 1437 bytes --]

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@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)

[-- Attachment #2: screenshot1.png --]
[-- Type: image/png, Size: 21746 bytes --]

[-- Attachment #3: screenshot2.png --]
[-- Type: image/png, Size: 19020 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
  2016-03-02 12:28   ` Vincent Lefevre
@ 2016-03-02 12:43     ` Marcin Borkowski
  0 siblings, 0 replies; 9+ messages in thread
From: Marcin Borkowski @ 2016-03-02 12:43 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: 18871


On 2016-03-02, at 13:28, Vincent Lefevre <vincent@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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
  2014-10-28 14:34 bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure Vincent Lefevre
  2016-03-01 16:15 ` Marcin Borkowski
@ 2019-05-18 18:58 ` Noam Postavsky
  2019-05-18 23:11   ` Vincent Lefevre
  1 sibling, 1 reply; 9+ messages in thread
From: Noam Postavsky @ 2019-05-18 18:58 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: 18871

[-- Attachment #1: Type: text/plain, Size: 856 bytes --]

tags 18871 + patch
merge 18871 23668
quit

Vincent Lefevre <vincent@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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1832 bytes --]

From 5f6abb03b3b0d10dd39ece8c151a8a7857b85895 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
  2019-05-18 18:58 ` Noam Postavsky
@ 2019-05-18 23:11   ` Vincent Lefevre
  2019-05-18 23:22     ` Noam Postavsky
  0 siblings, 1 reply; 9+ messages in thread
From: Vincent Lefevre @ 2019-05-18 23:11 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 18871

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@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@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)





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
  2019-05-18 23:11   ` Vincent Lefevre
@ 2019-05-18 23:22     ` Noam Postavsky
  2019-06-04 12:59       ` Noam Postavsky
  0 siblings, 1 reply; 9+ messages in thread
From: Noam Postavsky @ 2019-05-18 23:22 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: 18871

[-- Attachment #1: Type: text/plain, Size: 230 bytes --]

Vincent Lefevre <vincent@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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1834 bytes --]

From b8c659dc0c6ef41adc19db3c1884f73c1a10c8d8 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
  2019-05-18 23:22     ` Noam Postavsky
@ 2019-06-04 12:59       ` Noam Postavsky
  0 siblings, 0 replies; 9+ messages in thread
From: Noam Postavsky @ 2019-06-04 12:59 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: 18871

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






^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-06-04 12:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-28 14:34 bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure Vincent Lefevre
2016-03-01 16:15 ` Marcin Borkowski
2016-03-01 18:02   ` Vincent Lefevre
2016-03-02 12:28   ` Vincent Lefevre
2016-03-02 12:43     ` Marcin Borkowski
2019-05-18 18:58 ` Noam Postavsky
2019-05-18 23:11   ` Vincent Lefevre
2019-05-18 23:22     ` Noam Postavsky
2019-06-04 12:59       ` Noam Postavsky

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).