From: Jason Rumney Date: Wed, 9 Apr 2008 14:28:36 +0000 (+0000) Subject: 2008-04-09 Lennart Borgman X-Git-Tag: emacs-pretest-23.0.90~6392 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=44e8d8d318bce3bf103a9ab02665bf2696708736;p=emacs.git 2008-04-09 Lennart Borgman * nxml/nxml-mode.el (nxml-cleanup): New function. (nxml-mode): Add it to change-major-mode-hook. --- diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index 01637795c6b..508f0633640 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -550,6 +550,8 @@ Many aspects this mode can be customized using (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 @@ Many aspects this mode can be customized using (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