]> git.eshelyaron.com Git - emacs.git/commitdiff
(rng-do-some-validation): Fix dangerous use of `with-silent-modifications`
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 10 Jun 2024 14:43:14 +0000 (10:43 -0400)
committerEshel Yaron <me@eshelyaron.com>
Wed, 12 Jun 2024 09:26:17 +0000 (11:26 +0200)
* 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.

(cherry picked from commit 018a6d2ee903e0d09cda1d9e3b65bab73eda998f)

lisp/nxml/rng-valid.el

index 1c9998345fb3251522b6615c3dce61027e93fadb..9a44356835e793cd3d0faa88839d0f050a9bf67e 100644 (file)
@@ -444,8 +444,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)))
-                (with-silent-modifications
-                  (rng-do-some-validation-1 continue-p-function))))
+                (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
        ;; will get mysteriously stuck at a single place
@@ -585,10 +584,8 @@ Return t if there is work to do, nil otherwise."
 
 (defun rng-cache-state (pos)
   "Save the current state in a text property on the character at pos."
-  (put-text-property pos
-                    (1+ pos)
-                    'rng-state
-                    (rng-get-state)))
+  (with-silent-modifications
+    (put-text-property pos (1+ pos) 'rng-state (rng-get-state))))
 
 (defun rng-state-matches-current (state)
   (and state