From: Vili Aapro <vili.aapro@iki.fi>
To: 75224@debbugs.gnu.org
Subject: bug#75224: RNG validation unnecessarily marks buffer as changed
Date: Tue, 31 Dec 2024 14:31:27 +0200 [thread overview]
Message-ID: <20241231143127.1fd67698@vilij-LIFEBOOK-E744> (raw)
[-- Attachment #1: Type: text/plain, Size: 924 bytes --]
Gentle people,
I found a bug in RNG Validation mode in the file `nxml/rng-valid.el' that unnecessarily marks buffer as changed. The bug can be fixed with a simple application of `with-silent-modifications' in the function `rng-do-some-validation-1'. I've attached a patch that does so. However, in the long run, in my opinion the application of `with-silent-modifications' should be moved to `rng-clear-cached-state'; that is where it properly belongs. Perhaps this has been left undone because of efficiency reasons; perhaps there is work to be done to make `with-silent-modifications' less expensive.
To reproduce, visit a big enough RNG-validatable XML file, such as the included `rdfxml.rng'; goto and end-tag, say on line 22; kill it; undo.
Undo runs `after-change-functions' and thus `rng-after-change-function' and thus `rng-do-some-validation-1', reproducing the bug.
Best regards and thank you,
Vili Aapro
[-- Attachment #2: 0001-Fix-bug-in-rng-valid-that-unnecessarily-marks-buffer.patch --]
[-- Type: text/x-patch, Size: 889 bytes --]
From b5f7706165cfd2ef2c865303fe4530699d33d41b Mon Sep 17 00:00:00 2001
From: viliaapro <vili.aapro@iki.fi>
Date: Tue, 31 Dec 2024 14:07:43 +0200
Subject: [PATCH] Fix bug in rng-valid that unnecessarily marks buffer as
changed
---
lisp/nxml/rng-valid.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el
index 9a44356835e..b533545c52c 100644
--- a/lisp/nxml/rng-valid.el
+++ b/lisp/nxml/rng-valid.el
@@ -545,7 +545,8 @@ rng-do-some-validation-1
((or (>= pos next-cache-point)
(not continue))
(setq next-cache-point (+ pos rng-state-cache-distance))
- (rng-clear-cached-state remove-start pos)
+ (with-silent-modifications
+ (rng-clear-cached-state remove-start pos))
(when have-remaining-chars
(rng-cache-state (1- pos)))
(setq remove-start pos)
--
2.34.1
[-- Attachment #3: rdfxml.rng --]
[-- Type: application/xml, Size: 12775 bytes --]
next reply other threads:[~2024-12-31 12:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-31 12:31 Vili Aapro [this message]
2025-01-05 13:43 ` bug#75224: RNG validation unnecessarily marks buffer as changed Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241231143127.1fd67698@vilij-LIFEBOOK-E744 \
--to=vili.aapro@iki.fi \
--cc=75224@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.