From 0bb36ec255071afee2bdf8928290f47ee0e3d7ab Mon Sep 17 00:00:00 2001 From: JD Smith Date: Sat, 10 Jan 2026 15:25:02 -0500 Subject: [PATCH] Limit yanks to a single set of modification hook calls * lisp/subr.el (insert-for-yank-1): Locally set `inhibit-modification-hooks' to t prior to changing yanked text properties. Bug#77221 --- lisp/subr.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index 4ae3647b7d4..e9a8623595b 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4837,6 +4837,7 @@ It also runs the string through `yank-transform-functions'." (param (or (nth 1 handler) string)) (opoint (point)) (inhibit-read-only inhibit-read-only) + (inhibit-modification-hooks inhibit-modification-hooks) end) ;; FIXME: This throws away any yank-undo-function set by previous calls @@ -4847,9 +4848,10 @@ It also runs the string through `yank-transform-functions'." (insert param)) (setq end (point)) - ;; Prevent read-only properties from interfering with the - ;; following text property changes. - (setq inhibit-read-only t) + ;; Prevent read-only properties from interfering with the following + ;; text property changes, and inhibit further modification hook + ;; calls. + (setq inhibit-read-only t inhibit-modification-hooks t) (unless (nth 2 handler) ; NOEXCLUDE (remove-yank-excluded-properties opoint end))