emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/nxml/nxml-mode.el,v


From: Jason Rumney
Subject: [Emacs-diffs] Changes to emacs/lisp/nxml/nxml-mode.el,v
Date: Wed, 09 Apr 2008 14:28:36 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Jason Rumney <jasonr>   08/04/09 14:28:36

Index: nxml-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/nxml/nxml-mode.el,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- nxml-mode.el        18 Feb 2008 02:04:38 -0000      1.10
+++ nxml-mode.el        9 Apr 2008 14:28:36 -0000       1.11
@@ -550,6 +550,8 @@
   (when nxml-syntax-highlight-flag
     (add-hook 'fontification-functions 'nxml-fontify nil t))
   (add-hook 'after-change-functions 'nxml-after-change nil t)
+  (add-hook 'change-major-mode-hook 'nxml-cleanup 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
   ;; hook. The hook also had the drawback of overriding explicit user
@@ -565,6 +567,21 @@
   (nxml-enable-unicode-char-name-sets)
   (run-hooks 'nxml-mode-hook))
 
+(defun nxml-cleanup ()
+  "Clean up after nxml-mode."
+  ;; Disable associated minor modes.
+  (rng-validate-mode -1)
+  ;; Clean up fontification.
+  (save-excursion
+    (widen)
+    (let ((inhibit-read-only t)
+         (buffer-undo-list t)
+         (modified (buffer-modified-p)))
+      (nxml-with-invisible-motion
+       (remove-text-properties (point-min) (point-max) '(face)))
+      (set-buffer-modified-p modified)))
+  (remove-hook 'change-major-mode-hook 'nxml-cleanup t))
+
 (defun nxml-degrade (context err)
   (message "Internal nXML mode error in %s (%s), degrading"
           context




reply via email to

[Prev in Thread] Current Thread [Next in Thread]