unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Vincent Lefevre <vincent@vinc17.net>
Cc: 18871@debbugs.gnu.org
Subject: bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure
Date: Sat, 18 May 2019 19:22:13 -0400	[thread overview]
Message-ID: <87k1encpqy.fsf@gmail.com> (raw)
In-Reply-To: <20190518231117.GA10282@zira.vinc17.org> (Vincent Lefevre's message of "Sun, 19 May 2019 01:11:17 +0200")

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


  reply	other threads:[~2019-05-18 23:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2019-06-04 12:59       ` 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=87k1encpqy.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=18871@debbugs.gnu.org \
    --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).