Remove.
* lisp/nxml/rng-valid.el (rng-validate-mode)
(rng-after-change-function, rng-do-some-validation):
* lisp/nxml/rng-maint.el (rng-validate-buffer):
* lisp/nxml/nxml-rap.el (nxml-tokenize-forward, nxml-ensure-scan-up-to-date):
* lisp/nxml/nxml-outln.el (nxml-show-all, nxml-set-outline-state):
* lisp/nxml/nxml-mode.el (nxml-mode, nxml-degrade, nxml-after-change)
(nxml-extend-after-change-region): Use with-silent-modifications.
2013-03-23 Leo Liu <sdl.web@gmail.com>
+ * 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.
(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)))))
(save-excursion
(save-restriction
(widen)
- (nxml-with-unmodifying-text-property-changes
+ (with-silent-modifications
(nxml-clear-inside (point-min) (point-max))))))
;;; Change management
(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)))))))))
(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))))
(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)))
(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)))))
(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)))
'(comment
processing-instruction
cdata-section))
- (nxml-with-unmodifying-text-property-changes
+ (with-silent-modifications
(nxml-set-inside (1+ xmltok-start)
(point)
xmltok-type)))
(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))
(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))))
(> (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)))
(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.
(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