diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2025-03-28 01:01:17 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2025-03-29 17:49:49 -0400 |
commit | 1d07a6d7e34677be1653b1d4d464ff00cabfa102 (patch) | |
tree | 9f27c30bd71b3ab9f7f5ed14e31f66e6b0fa85a6 /lisp/subr.el | |
parent | 468c2aebae0ee13273f4b06e92f4188c4c46d2b3 (diff) | |
download | emacs-1d07a6d7e34677be1653b1d4d464ff00cabfa102.tar.gz emacs-1d07a6d7e34677be1653b1d4d464ff00cabfa102.tar.bz2 emacs-1d07a6d7e34677be1653b1d4d464ff00cabfa102.zip |
Use `replace-region-contents` to replace insert+delete
* lisp/minibuffer.el (completion--replace):
* lisp/emacs-lisp/cl-lib.el (cl--set-buffer-substring):
* lisp/subr.el (replace-string-in-region):
Use `replace-region-contents` instead of insert+delete.
* lisp/help-fns.el (help-fns--signature):
Use `replace-region-contents` instead of `cl--set-buffer-substring`.
* lisp/language/japan-util.el (japanese-replace-region):
Rewrite using `replace-region-contents` and mark obsolete.
(japanese-katakana-region, japanese-hankaku-region):
Use `replace-region-contents` instead.
* lisp/progmodes/flymake-proc.el (flymake-proc--replace-region):
Rewrite using `replace-region-contents` and mark obsolete.
(flymake-proc--check-patch-master-file-buffer):
Use `replace-region-contents` instead.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 66b73cbf6cc..017ab3e16bb 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4798,8 +4798,8 @@ Comparisons and replacements are done with fixed case." (let ((matches 0) (case-fold-search nil)) (while (search-forward string nil t) - (delete-region (match-beginning 0) (match-end 0)) - (insert replacement) + (replace-region-contents (match-beginning 0) (match-end 0) + replacement 0) (setq matches (1+ matches))) (and (not (zerop matches)) matches))))) |