From 0e4a8ae1faaa399c422f0bc6c073f72fd0014eb6 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 10 Jan 2026 23:51:46 -0500 Subject: [PATCH] lisp/subr.el (insert-for-yank-1): Use `with-silent-modifications` --- lisp/subr.el | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index e9a8623595b..63c3e8b8684 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4836,8 +4836,6 @@ It also runs the string through `yank-transform-functions'." (get-text-property 0 'yank-handler string))) (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 @@ -4848,18 +4846,14 @@ 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, and inhibit further modification hook - ;; calls. - (setq inhibit-read-only t inhibit-modification-hooks t) + (with-silent-modifications + (unless (nth 2 handler) ; NOEXCLUDE + (remove-yank-excluded-properties opoint end)) - (unless (nth 2 handler) ; NOEXCLUDE - (remove-yank-excluded-properties opoint end)) - - ;; If last inserted char has properties, mark them as rear-nonsticky. - (if (and (> end opoint) - (text-properties-at (1- end))) - (put-text-property (1- end) end 'rear-nonsticky t)) + ;; If last inserted char has properties, mark them as rear-nonsticky. + (if (and (> end opoint) + (text-properties-at (1- end))) + (put-text-property (1- end) end 'rear-nonsticky t))) (if (eq yank-undo-function t) ; not set by FUNCTION (setq yank-undo-function (nth 3 handler))) ; UNDO