diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f79c533465e..9bada64f768 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,16 @@ 2013-03-23 Leo Liu + * nxml/nxml-util.el (nxml-with-unmodifying-text-property-changes): + Remove. + + * nxml/rng-valid.el (rng-validate-mode) + (rng-after-change-function, rng-do-some-validation): + * nxml/rng-maint.el (rng-validate-buffer): + * nxml/nxml-rap.el (nxml-tokenize-forward, nxml-ensure-scan-up-to-date): + * nxml/nxml-outln.el (nxml-show-all, nxml-set-outline-state): + * nxml/nxml-mode.el (nxml-mode, nxml-degrade, nxml-after-change) + (nxml-extend-after-change-region): Use with-silent-modifications. + * nxml/rng-nxml.el (rng-set-state-after): Do not let-bind timer-idle-list. diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index 2ee73235dd0..44271a689cf 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -540,7 +540,7 @@ Many aspects this mode can be customized using (widen) (nxml-clear-dependent-regions (point-min) (point-max)) (setq nxml-scan-end (copy-marker (point-min) nil)) - (nxml-with-unmodifying-text-property-changes + (with-silent-modifications (nxml-clear-inside (point-min) (point-max)) (nxml-with-invisible-motion (nxml-scan-prolog))))) @@ -601,7 +601,7 @@ Many aspects this mode can be customized using (save-excursion (save-restriction (widen) - (nxml-with-unmodifying-text-property-changes + (with-silent-modifications (nxml-clear-inside (point-min) (point-max)))))) ;;; Change management @@ -625,7 +625,7 @@ Many aspects this mode can be customized using (widen) (save-match-data (nxml-with-invisible-motion - (nxml-with-unmodifying-text-property-changes + (with-silent-modifications (nxml-after-change1 start end pre-change-length))))))))) @@ -910,7 +910,7 @@ Called with `font-lock-beg' and `font-lock-end' dynamically bound." (widen) (save-match-data (nxml-with-invisible-motion - (nxml-with-unmodifying-text-property-changes + (with-silent-modifications (nxml-extend-after-change-region1 start end pre-change-length))))))))) (if (consp region) region)))) diff --git a/lisp/nxml/nxml-outln.el b/lisp/nxml/nxml-outln.el index e30aee3de53..dab22f7559f 100644 --- a/lisp/nxml/nxml-outln.el +++ b/lisp/nxml/nxml-outln.el @@ -149,7 +149,7 @@ See the variable `nxml-section-element-name-regexp' for more details." (defun nxml-show-all () "Show all elements in the buffer normally." (interactive) - (nxml-with-unmodifying-text-property-changes + (with-silent-modifications (remove-text-properties (point-min) (point-max) '(nxml-outline-state nil))) @@ -370,7 +370,7 @@ customize which elements are recognized as sections and headings." (get-text-property pos 'nxml-outline-state)) (defun nxml-set-outline-state (pos state) - (nxml-with-unmodifying-text-property-changes + (with-silent-modifications (if state (put-text-property pos (1+ pos) 'nxml-outline-state state) (remove-text-properties pos (1+ pos) '(nxml-outline-state nil))))) diff --git a/lisp/nxml/nxml-rap.el b/lisp/nxml/nxml-rap.el index bc87044cde6..5bc4d74456b 100644 --- a/lisp/nxml/nxml-rap.el +++ b/lisp/nxml/nxml-rap.el @@ -293,7 +293,7 @@ Sets variables like `nxml-token-after'." (cond ((memq xmltok-type '(comment cdata-section processing-instruction)) - (nxml-with-unmodifying-text-property-changes + (with-silent-modifications (nxml-set-inside (1+ xmltok-start) (point) xmltok-type))) (xmltok-dependent-regions (nxml-mark-parse-dependent-regions))) @@ -338,7 +338,7 @@ Leave point unmoved if it is not inside anything special." '(comment processing-instruction cdata-section)) - (nxml-with-unmodifying-text-property-changes + (with-silent-modifications (nxml-set-inside (1+ xmltok-start) (point) xmltok-type))) diff --git a/lisp/nxml/nxml-util.el b/lisp/nxml/nxml-util.el index b2d9cdde183..6ba6d21f7ed 100644 --- a/lisp/nxml/nxml-util.el +++ b/lisp/nxml/nxml-util.el @@ -78,27 +78,6 @@ This is the inverse of `nxml-make-namespace'." (nxml-degrade ,context ,error-symbol)))) `(progn ,@body))) -(defmacro nxml-with-unmodifying-text-property-changes (&rest body) - "Evaluate BODY without any text property changes modifying the buffer. -Any text properties changes happen as usual but the changes are not treated as -modifications to the buffer." - (let ((modified (make-symbol "modified"))) - `(let ((,modified (buffer-modified-p)) - (inhibit-read-only t) - (inhibit-modification-hooks t) - (buffer-undo-list t) - (deactivate-mark nil) - ;; Apparently these avoid file locking problems. - (buffer-file-name nil) - (buffer-file-truename nil)) - (unwind-protect - (progn ,@body) - (unless ,modified - (restore-buffer-modified-p nil)))))) - -(put 'nxml-with-unmodifying-text-property-changes 'lisp-indent-function 0) -(def-edebug-spec nxml-with-unmodifying-text-property-changes t) - (defmacro nxml-with-invisible-motion (&rest body) "Evaluate body without calling any point motion hooks." `(let ((inhibit-point-motion-hooks t)) diff --git a/lisp/nxml/rng-maint.el b/lisp/nxml/rng-maint.el index 74192f213dc..ff73e3718ec 100644 --- a/lisp/nxml/rng-maint.el +++ b/lisp/nxml/rng-maint.el @@ -259,7 +259,7 @@ (defun rng-validate-buffer () (save-restriction (widen) - (nxml-with-unmodifying-text-property-changes + (with-silent-modifications (rng-clear-cached-state (point-min) (point-max))) ;; 1+ to clear empty overlays at (point-max) (rng-clear-overlays (point-min) (1+ (point-max)))) diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el index 9ba2e987718..de18c581421 100644 --- a/lisp/nxml/rng-valid.el +++ b/lisp/nxml/rng-valid.el @@ -244,7 +244,7 @@ to use for finding the schema." (> (prefix-numeric-value arg) 0))) (save-restriction (widen) - (nxml-with-unmodifying-text-property-changes + (with-silent-modifications (rng-clear-cached-state (point-min) (point-max))) ;; 1+ to clear empty overlays at (point-max) (rng-clear-overlays (point-min) (1+ (point-max))) @@ -305,7 +305,7 @@ The schema is set like `rng-auto-set-schema'." (defun rng-after-change-function (start end pre-change-len) (setq rng-message-overlay-inhibit-point nil) - (nxml-with-unmodifying-text-property-changes + (with-silent-modifications (rng-clear-cached-state start end)) ;; rng-validate-up-to-date-end holds the position before the change ;; Adjust it to reflect the change. @@ -469,7 +469,7 @@ The schema is set like `rng-auto-set-schema'." (condition-case-unless-debug err (and (rng-validate-prepare) (let ((rng-dt-namespace-context-getter '(nxml-ns-get-context))) - (nxml-with-unmodifying-text-property-changes + (with-silent-modifications (rng-do-some-validation-1 continue-p-function)))) ;; errors signaled from a function run by an idle timer ;; are ignored; if we don't catch them, validation