aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoam Postavsky2019-05-18 14:54:36 -0400
committerNoam Postavsky2019-06-04 08:42:50 -0400
commit3f2bfe9a1955df3832a78bdfbb03314875601730 (patch)
tree986ebbfe1b0cb25fd743d4e7834e34d66fd2368e
parentd414c93b062cc3e245a6db0cb764d354d037bd42 (diff)
downloademacs-3f2bfe9a1955df3832a78bdfbb03314875601730.tar.gz
emacs-3f2bfe9a1955df3832a78bdfbb03314875601730.zip
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.
-rw-r--r--lisp/nxml/nxml-mode.el1
-rw-r--r--lisp/nxml/nxml-rap.el6
2 files changed, 7 insertions, 0 deletions
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index 1eb728f23a5..5c906a9d510 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -544,6 +544,7 @@ Many aspects this mode can be customized using
544 (setq-local syntax-ppss-table sgml-tag-syntax-table) 544 (setq-local syntax-ppss-table sgml-tag-syntax-table)
545 (setq-local syntax-propertize-function #'nxml-syntax-propertize) 545 (setq-local syntax-propertize-function #'nxml-syntax-propertize)
546 (add-hook 'change-major-mode-hook #'nxml-cleanup nil t) 546 (add-hook 'change-major-mode-hook #'nxml-cleanup nil t)
547 (add-hook 'after-change-functions #'nxml-maybe-rescan-prolog nil t)
547 548
548 ;; Emacs 23 handles the encoding attribute on the xml declaration 549 ;; Emacs 23 handles the encoding attribute on the xml declaration
549 ;; transparently to nxml-mode, so there is no longer a need for the below 550 ;; 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 21dbaded25a..3be413ae00b 100644
--- a/lisp/nxml/nxml-rap.el
+++ b/lisp/nxml/nxml-rap.el
@@ -108,6 +108,12 @@ Return nil if the character at POS is not inside."
108 (setq nxml-prolog-regions (xmltok-forward-prolog)) 108 (setq nxml-prolog-regions (xmltok-forward-prolog))
109 (setq nxml-prolog-end (point)))) 109 (setq nxml-prolog-end (point))))
110 110
111(defun nxml-maybe-rescan-prolog (start _end _length)
112 "Reparse the prolog if START lies within it.
113`nxml-mode' adds this function on `after-change-functions'."
114 (when (<= start nxml-prolog-end)
115 (save-excursion
116 (nxml-scan-prolog))))
111 117
112;;; Random access parsing 118;;; Random access parsing
113 119