aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2024-06-10 10:43:14 -0400
committerStefan Monnier2024-06-10 10:43:14 -0400
commit018a6d2ee903e0d09cda1d9e3b65bab73eda998f (patch)
tree02006f2c0a2431c8de6a54bf49f52f4e8c16eb11
parent8a55f4d0b06c96c95a2a2a7eb4a9a7fedb105e70 (diff)
downloademacs-018a6d2ee903e0d09cda1d9e3b65bab73eda998f.tar.gz
emacs-018a6d2ee903e0d09cda1d9e3b65bab73eda998f.zip
(rng-do-some-validation): Fix dangerous use of `with-silent-modifications`
* lisp/nxml/rng-valid.el (rng-do-some-validation): Don't let-bind `inhibit-modification-hooks` around code which can wait. (rng-cache-state): Bind it here instead.
-rw-r--r--lisp/nxml/rng-valid.el9
1 files changed, 3 insertions, 6 deletions
diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el
index 1c9998345fb..9a44356835e 100644
--- a/lisp/nxml/rng-valid.el
+++ b/lisp/nxml/rng-valid.el
@@ -444,8 +444,7 @@ The schema is set like `rng-auto-set-schema'."
444 (condition-case-unless-debug err 444 (condition-case-unless-debug err
445 (and (rng-validate-prepare) 445 (and (rng-validate-prepare)
446 (let ((rng-dt-namespace-context-getter '(nxml-ns-get-context))) 446 (let ((rng-dt-namespace-context-getter '(nxml-ns-get-context)))
447 (with-silent-modifications 447 (rng-do-some-validation-1 continue-p-function)))
448 (rng-do-some-validation-1 continue-p-function))))
449 ;; errors signaled from a function run by an idle timer 448 ;; errors signaled from a function run by an idle timer
450 ;; are ignored; if we don't catch them, validation 449 ;; are ignored; if we don't catch them, validation
451 ;; will get mysteriously stuck at a single place 450 ;; will get mysteriously stuck at a single place
@@ -585,10 +584,8 @@ Return t if there is work to do, nil otherwise."
585 584
586(defun rng-cache-state (pos) 585(defun rng-cache-state (pos)
587 "Save the current state in a text property on the character at pos." 586 "Save the current state in a text property on the character at pos."
588 (put-text-property pos 587 (with-silent-modifications
589 (1+ pos) 588 (put-text-property pos (1+ pos) 'rng-state (rng-get-state))))
590 'rng-state
591 (rng-get-state)))
592 589
593(defun rng-state-matches-current (state) 590(defun rng-state-matches-current (state)
594 (and state 591 (and state