Subject: bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure

From: Vincent Lefevre <[email-masked]>
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 <[email-masked]>
> 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 <[email-masked]> - 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)