aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2026-01-10 23:51:46 -0500
committerStefan Monnier2026-01-10 23:51:46 -0500
commit0e4a8ae1faaa399c422f0bc6c073f72fd0014eb6 (patch)
tree71384194c4089bbf0c4913f0667533ef432462e1
parent25a6f28ad5f647519eabc99177769bd310250235 (diff)
downloademacs-0e4a8ae1faaa399c422f0bc6c073f72fd0014eb6.tar.gz
emacs-0e4a8ae1faaa399c422f0bc6c073f72fd0014eb6.zip
lisp/subr.el (insert-for-yank-1): Use `with-silent-modifications`
-rw-r--r--lisp/subr.el20
1 files 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'."
4836 (get-text-property 0 'yank-handler string))) 4836 (get-text-property 0 'yank-handler string)))
4837 (param (or (nth 1 handler) string)) 4837 (param (or (nth 1 handler) string))
4838 (opoint (point)) 4838 (opoint (point))
4839 (inhibit-read-only inhibit-read-only)
4840 (inhibit-modification-hooks inhibit-modification-hooks)
4841 end) 4839 end)
4842 4840
4843 ;; FIXME: This throws away any yank-undo-function set by previous calls 4841 ;; 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'."
4848 (insert param)) 4846 (insert param))
4849 (setq end (point)) 4847 (setq end (point))
4850 4848
4851 ;; Prevent read-only properties from interfering with the following 4849 (with-silent-modifications
4852 ;; text property changes, and inhibit further modification hook 4850 (unless (nth 2 handler) ; NOEXCLUDE
4853 ;; calls. 4851 (remove-yank-excluded-properties opoint end))
4854 (setq inhibit-read-only t inhibit-modification-hooks t)
4855 4852
4856 (unless (nth 2 handler) ; NOEXCLUDE 4853 ;; If last inserted char has properties, mark them as rear-nonsticky.
4857 (remove-yank-excluded-properties opoint end)) 4854 (if (and (> end opoint)
4858 4855 (text-properties-at (1- end)))
4859 ;; If last inserted char has properties, mark them as rear-nonsticky. 4856 (put-text-property (1- end) end 'rear-nonsticky t)))
4860 (if (and (> end opoint)
4861 (text-properties-at (1- end)))
4862 (put-text-property (1- end) end 'rear-nonsticky t))
4863 4857
4864 (if (eq yank-undo-function t) ; not set by FUNCTION 4858 (if (eq yank-undo-function t) ; not set by FUNCTION
4865 (setq yank-undo-function (nth 3 handler))) ; UNDO 4859 (setq yank-undo-function (nth 3 handler))) ; UNDO