1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-28 10:56:36 +00:00

* lisp/nxml/nxml-util.el (nxml-with-unmodifying-text-property-changes):

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.
This commit is contained in:
Leo Liu 2013-03-23 10:21:25 +08:00
parent a320a2dbc9
commit 7e74b0fb88
7 changed files with 23 additions and 33 deletions

View File

@ -1,5 +1,16 @@
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.

View File

@ -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))))

View File

@ -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)))))

View File

@ -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)))

View File

@ -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))

View File

@ -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))))

View File

@ -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