diff options
| author | Jason Rumney | 2008-04-09 14:28:36 +0000 |
|---|---|---|
| committer | Jason Rumney | 2008-04-09 14:28:36 +0000 |
| commit | 44e8d8d318bce3bf103a9ab02665bf2696708736 (patch) | |
| tree | ede846539956b9333b488f64ea86e357c1679a55 | |
| parent | 8d28646bf8bb5ff19406a4c86d07c4d9c6f000d0 (diff) | |
| download | emacs-44e8d8d318bce3bf103a9ab02665bf2696708736.tar.gz emacs-44e8d8d318bce3bf103a9ab02665bf2696708736.zip | |
2008-04-09 Lennart Borgman <lennart.borgman@gmail.com>
* nxml/nxml-mode.el (nxml-cleanup): New function.
(nxml-mode): Add it to change-major-mode-hook.
| -rw-r--r-- | lisp/nxml/nxml-mode.el | 17 |
1 files changed, 17 insertions, 0 deletions
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 | |||
| 550 | (when nxml-syntax-highlight-flag | 550 | (when nxml-syntax-highlight-flag |
| 551 | (add-hook 'fontification-functions 'nxml-fontify nil t)) | 551 | (add-hook 'fontification-functions 'nxml-fontify nil t)) |
| 552 | (add-hook 'after-change-functions 'nxml-after-change nil t) | 552 | (add-hook 'after-change-functions 'nxml-after-change nil t) |
| 553 | (add-hook 'change-major-mode-hook 'nxml-cleanup nil t) | ||
| 554 | |||
| 553 | ;; Emacs 23 handles the encoding attribute on the xml declaration | 555 | ;; Emacs 23 handles the encoding attribute on the xml declaration |
| 554 | ;; transparently to nxml-mode, so there is no longer a need for the below | 556 | ;; transparently to nxml-mode, so there is no longer a need for the below |
| 555 | ;; hook. The hook also had the drawback of overriding explicit user | 557 | ;; hook. The hook also had the drawback of overriding explicit user |
| @@ -565,6 +567,21 @@ Many aspects this mode can be customized using | |||
| 565 | (nxml-enable-unicode-char-name-sets) | 567 | (nxml-enable-unicode-char-name-sets) |
| 566 | (run-hooks 'nxml-mode-hook)) | 568 | (run-hooks 'nxml-mode-hook)) |
| 567 | 569 | ||
| 570 | (defun nxml-cleanup () | ||
| 571 | "Clean up after nxml-mode." | ||
| 572 | ;; Disable associated minor modes. | ||
| 573 | (rng-validate-mode -1) | ||
| 574 | ;; Clean up fontification. | ||
| 575 | (save-excursion | ||
| 576 | (widen) | ||
| 577 | (let ((inhibit-read-only t) | ||
| 578 | (buffer-undo-list t) | ||
| 579 | (modified (buffer-modified-p))) | ||
| 580 | (nxml-with-invisible-motion | ||
| 581 | (remove-text-properties (point-min) (point-max) '(face))) | ||
| 582 | (set-buffer-modified-p modified))) | ||
| 583 | (remove-hook 'change-major-mode-hook 'nxml-cleanup t)) | ||
| 584 | |||
| 568 | (defun nxml-degrade (context err) | 585 | (defun nxml-degrade (context err) |
| 569 | (message "Internal nXML mode error in %s (%s), degrading" | 586 | (message "Internal nXML mode error in %s (%s), degrading" |
| 570 | context | 587 | context |