]> git.eshelyaron.com Git - emacs.git/commitdiff
Use string-replace instead of replace-regexp-in-string
authorMattias Engdegård <mattiase@acm.org>
Sun, 8 Aug 2021 16:58:46 +0000 (18:58 +0200)
committerMattias Engdegård <mattiase@acm.org>
Sun, 8 Aug 2021 17:25:26 +0000 (19:25 +0200)
`string-replace` is easier to understand, less error-prone, much
faster, and results in shorter Lisp and byte code.  Use it where
applicable and obviously safe (erring on the conservative side).

* admin/authors.el (authors-scan-change-log):
* lisp/autoinsert.el (auto-insert-alist):
* lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent)
(calc-edit-macro-combine-ext-command)
(calc-edit-macro-combine-var-name):
* lisp/calc/calc-units.el (math-make-unit-string):
* lisp/calendar/cal-html.el (cal-html-comment):
* lisp/calendar/cal-tex.el (cal-tex-comment):
* lisp/calendar/icalendar.el (icalendar--convert-string-for-export)
(icalendar--convert-string-for-import):
* lisp/calendar/iso8601.el (iso8601--concat-regexps)
(iso8601--full-time-match, iso8601--combined-match):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/todo-mode.el (todo-filter-items-filename):
* lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name)
(cedet-file-name-to-directory-name):
* lisp/comint.el (comint-watch-for-password-prompt):
* lisp/dired-aux.el (dired-do-chmod):
* lisp/dired-x.el (dired-man):
* lisp/dired.el (dired-insert-directory, dired-goto-file-1):
* lisp/emacs-lisp/comp.el (comp-c-func-name):
* lisp/emacs-lisp/re-builder.el (reb-copy):
* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART):
* lisp/files.el (make-backup-file-name-1, files--transform-file-name)
(read-file-modes):
* lisp/fringe.el (fringe-mode):
* lisp/gnus/gnus-art.el (gnus-button-handle-info-url):
* lisp/gnus/gnus-group.el (gnus-group-completing-read):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-search.el (gnus-search-query-parse-date)
(gnus-search-transform-expression, gnus-search-run-search):
* lisp/gnus/gnus-start.el (gnus-dribble-enter):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-mode-string-quote):
* lisp/gnus/message.el (message-put-addresses-in-ecomplete)
(message-parse-mailto-url, message-mailto-1):
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/gnus/mml-smime.el (mml-smime-epg-verify):
* lisp/gnus/mml2015.el (mml2015-epg-verify):
* lisp/gnus/nnmaildir.el (nnmaildir--system-name)
(nnmaildir-request-list, nnmaildir-retrieve-groups)
(nnmaildir-request-group, nnmaildir-retrieve-headers):
* lisp/gnus/nnrss.el (nnrss-node-text):
* lisp/gnus/spam-report.el (spam-report-gmane-internal)
(spam-report-user-mail-address):
* lisp/ibuffer.el (name):
* lisp/image-dired.el (image-dired-pngnq-thumb)
(image-dired-pngcrush-thumb, image-dired-optipng-thumb)
(image-dired-create-thumb-1):
* lisp/info.el (Info-set-mode-line):
* lisp/international/mule-cmds.el (describe-language-environment):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2368.el (rfc2368-parse-mailto-url):
* lisp/mail/rmail.el (rmail-insert-inbox-text)
(rmail-simplified-subject-regexp):
* lisp/mail/rmailout.el (rmail-output-body-to-file):
* lisp/mail/undigest.el (rmail-digest-rfc1153):
* lisp/man.el (Man-default-man-entry):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc--debug):
* lisp/net/browse-url.el (browse-url-mail):
* lisp/net/eww.el (eww-update-header-line-format):
* lisp/net/newst-backend.el (newsticker-save-item):
* lisp/net/rcirc.el (rcirc-sentinel):
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/nxml/rng-cmpct.el (rng-c-literal-2-re):
* lisp/nxml/xmltok.el (let*):
* lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex)
(nnir-run-find-grep):
* lisp/play/dunnet.el (dun-doassign):
* lisp/play/handwrite.el (handwrite):
* lisp/proced.el (proced-format-args):
* lisp/profiler.el (profiler-report-header-line-format):
* lisp/progmodes/gdb-mi.el (gdb-mi-quote):
* lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex)
(makefile-make-font-lock-keywords):
* lisp/progmodes/prolog.el (prolog-guess-fill-prefix):
* lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes):
* lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal):
* lisp/progmodes/which-func.el (which-func-current):
* lisp/replace.el (query-replace-read-from)
(occur-engine, replace-quote):
* lisp/select.el (xselect--encode-string):
* lisp/ses.el (ses-export-tab):
* lisp/subr.el (shell-quote-argument):
* lisp/term/pc-win.el (msdos-show-help):
* lisp/term/w32-win.el (w32--set-selection):
* lisp/term/xterm.el (gui-backend-set-selection):
* lisp/textmodes/picture.el (picture-tab-search):
* lisp/thumbs.el (thumbs-call-setroot-command):
* lisp/tooltip.el (tooltip-show-help-non-mode):
* lisp/transient.el (transient-format-key):
* lisp/url/url-mailto.el (url-mailto):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p):
* lisp/vc/vc-bzr.el (vc-bzr-status):
* lisp/vc/vc-hg.el (vc-hg--glob-to-pcre):
* lisp/vc/vc-svn.el (vc-svn-after-dir-status):
* lisp/xdg.el (xdg-desktop-strings):
* test/lisp/electric-tests.el (defun):
* test/lisp/term-tests.el (term-simple-lines):
* test/lisp/time-stamp-tests.el (formatz-mod-del-colons):
* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-unfinished-edit-01):
* test/src/json-tests.el (json-parse-with-custom-null-and-false-objects):
Use `string-replace` instead of `replace-regexp-in-string`.

88 files changed:
admin/authors.el
lisp/autoinsert.el
lisp/calc/calc-prog.el
lisp/calc/calc-units.el
lisp/calendar/cal-html.el
lisp/calendar/cal-tex.el
lisp/calendar/icalendar.el
lisp/calendar/iso8601.el
lisp/calendar/time-date.el
lisp/calendar/todo-mode.el
lisp/cedet/cedet-files.el
lisp/comint.el
lisp/dired-aux.el
lisp/dired-x.el
lisp/dired.el
lisp/emacs-lisp/comp.el
lisp/emacs-lisp/re-builder.el
lisp/erc/erc-dcc.el
lisp/erc/erc.el
lisp/files.el
lisp/fringe.el
lisp/gnus/gnus-art.el
lisp/gnus/gnus-group.el
lisp/gnus/gnus-icalendar.el
lisp/gnus/gnus-mlspl.el
lisp/gnus/gnus-search.el
lisp/gnus/gnus-start.el
lisp/gnus/gnus-sum.el
lisp/gnus/gnus-util.el
lisp/gnus/message.el
lisp/gnus/mml-sec.el
lisp/gnus/mml-smime.el
lisp/gnus/mml2015.el
lisp/gnus/nnmaildir.el
lisp/gnus/nnrss.el
lisp/gnus/spam-report.el
lisp/ibuffer.el
lisp/image-dired.el
lisp/info.el
lisp/international/mule-cmds.el
lisp/mail/rfc2231.el
lisp/mail/rfc2368.el
lisp/mail/rmail.el
lisp/mail/rmailout.el
lisp/mail/undigest.el
lisp/man.el
lisp/mouse.el
lisp/mpc.el
lisp/net/browse-url.el
lisp/net/eww.el
lisp/net/newst-backend.el
lisp/net/rcirc.el
lisp/net/soap-client.el
lisp/nxml/rng-cmpct.el
lisp/nxml/xmltok.el
lisp/obsolete/nnir.el
lisp/play/dunnet.el
lisp/play/handwrite.el
lisp/proced.el
lisp/profiler.el
lisp/progmodes/gdb-mi.el
lisp/progmodes/make-mode.el
lisp/progmodes/prolog.el
lisp/progmodes/ruby-mode.el
lisp/progmodes/sql.el
lisp/progmodes/which-func.el
lisp/replace.el
lisp/select.el
lisp/ses.el
lisp/subr.el
lisp/term/pc-win.el
lisp/term/w32-win.el
lisp/term/xterm.el
lisp/textmodes/picture.el
lisp/thumbs.el
lisp/tooltip.el
lisp/transient.el
lisp/url/url-mailto.el
lisp/vc/log-edit.el
lisp/vc/vc-bzr.el
lisp/vc/vc-hg.el
lisp/vc/vc-svn.el
lisp/xdg.el
test/lisp/electric-tests.el
test/lisp/term-tests.el
test/lisp/time-stamp-tests.el
test/lisp/wdired-tests.el
test/src/json-tests.el

index 6c81c7872fcadc27572b71679ce5cdb304cd0730..a400b1327afd822636c95dd5a3609780be3b63d5 100644 (file)
@@ -1475,7 +1475,7 @@ Suggested\\|Trivial\\|Version\\|Originally\\|From:\\|Patch[ \t]+[Bb]y\\)")))
                   (when (string-match ":" line)
                     (setq line (substring line 0 (match-beginning 0)))
                     (setq line (replace-regexp-in-string "[[(<{].*$" "" line))
-                    (setq line (replace-regexp-in-string "," "" line))
+                    (setq line (string-replace "," "" line))
                     (dolist (file (split-string line))
                       (when (setq file (authors-canonical-file-name file log-file pos (car authors)))
                         (dolist (author authors)
index 0392903c33258dfab62270411eeb0795f72cfe38..995d9e2e0fe68f79845db2099ad99d987c141b4f 100644 (file)
@@ -93,8 +93,8 @@ If this contains a %s, that will be replaced by the matching rule."
   '((("\\.\\([Hh]\\|hh\\|hpp\\|hxx\\|h\\+\\+\\)\\'" . "C / C++ header")
      (replace-regexp-in-string
       "[^A-Z0-9]" "_"
-      (replace-regexp-in-string
-       "\\+" "P"
+      (string-replace
+       "+" "P"
        (upcase (file-name-nondirectory buffer-file-name))))
      "#ifndef " str \n
      "#define " str "\n\n"
index 4e27d7671e28a305ec3e0462443359f3aeb59142..6f1e5c782dfca041df836f7470595c471453950d 100644 (file)
     (when match
       (kill-line 1)
       (setq line (concat line (substring curline 0 match))))
-    (setq line (replace-regexp-in-string "SPC" " SPC "
-                  (replace-regexp-in-string " " "" line)))
+    (setq line (string-replace "SPC" " SPC "
+                               (string-replace " " "" line)))
     (insert line "\t\t\t")
     (if (> (current-column) 24)
         (delete-char -1))
     (when match
       (kill-line 1)
       (setq line (concat line (substring curline 0 match))))
-    (setq line (replace-regexp-in-string " " "" line))
+    (setq line (string-replace " " "" line))
     (insert cmdbeg " " line "\t\t\t")
     (if (> (current-column) 24)
         (delete-char -1))
       (when match
         (kill-line 1)
         (setq line (concat line (substring curline 0 match))))
-      (setq line (replace-regexp-in-string " " "" line))
+      (setq line (string-replace " " "" line))
       (insert line "\t\t\t")
       (if (> (current-column) 24)
           (delete-char -1))
index c3adc3db02a367e7adbf71c9bffb05fcac1e8ae9..8b6f0637035fc29cfa210d042d6704c13daf7b19 100644 (file)
@@ -406,7 +406,7 @@ Entries are (SYMBOL EXPR DOC-STRING TEMP-TYPE BASE-UNITS).")
 If EXPR is nil, return nil."
   (if expr
       (let ((cexpr (math-compose-expr expr 0)))
-        (replace-regexp-in-string
+        (string-replace
          " / " "/"
          (if (stringp cexpr)
              cexpr
index e5810c3f027634c6cadc6af295067c4c80017cb4..58a5a0f83a56b74f941bec9fd48e2cbc50871bd0 100644 (file)
 (defun cal-html-comment (string)
   "Return STRING as html comment."
   (format "<!--  ======  %s  ======  -->\n"
-          (replace-regexp-in-string "--" "++" string)))
+          (string-replace "--" "++" string)))
 
 (defun cal-html-href (link string)
   "Return a hyperlink to url LINK with text STRING."
index f5932014dd9888d8fbbab346fe9d4da212c72b4c..3830024ef3d138cf639379cc5d8fa64606898713 100644 (file)
@@ -1755,7 +1755,7 @@ current contents."
 COMMENT may contain newlines, which are prefixed by \"% \" in the output."
   (insert (format "%% %s\n"
                   (if comment
-                      (replace-regexp-in-string "\n" "\n% " comment)
+                      (string-replace "\n" "\n% " comment)
                     ""))))
 
 (defun cal-tex-banner (comment)
index d18ec5e798ff019cc87a54e2bb3b6ee3d6cc08b0..cf37331394c83fc284a68d14504db06298287ec9 100644 (file)
@@ -998,15 +998,15 @@ TIMESTRING and has the same result as \"9:00\"."
 
 (defun icalendar--convert-string-for-export (string)
   "Escape comma and other critical characters in STRING."
-  (replace-regexp-in-string "," "\\\\," string))
+  (string-replace "," "\\," string))
 
 (defun icalendar--convert-string-for-import (string)
   "Remove escape chars for comma, semicolon etc. from STRING."
-  (replace-regexp-in-string
-   "\\\\n" "\n " (replace-regexp-in-string
-                  "\\\\\"" "\"" (replace-regexp-in-string
-                                 "\\\\;" ";" (replace-regexp-in-string
-                                              "\\\\," "," string)))))
+  (string-replace
+   "\\n" "\n " (string-replace
+                "\\\"" "\"" (string-replace
+                             "\\;" ";" (string-replace
+                                        "\\," "," string)))))
 
 ;; ======================================================================
 ;; Export -- convert emacs-diary to iCalendar
index f22f060e2052983afb03be7892b5e6d20211a0d8..1de1796a05431246d303d6b034c27b2387d58a8d 100644 (file)
@@ -57,7 +57,7 @@
 (defun iso8601--concat-regexps (regexps)
   (mapconcat (lambda (regexp)
                (concat "\\(?:"
-                       (replace-regexp-in-string "(" "(?:" regexp)
+                       (string-replace "(" "(?:" regexp)
                        "\\)"))
              regexps "\\|"))
 
   "\\(Z\\|\\([+-]\\)\\([0-9][0-9]\\):?\\([0-9][0-9]\\)?\\)")
 
 (defconst iso8601--full-time-match
-  (concat "\\(" (replace-regexp-in-string "(" "(?:" iso8601--time-match) "\\)"
+  (concat "\\(" (string-replace "(" "(?:" iso8601--time-match) "\\)"
           "\\(" iso8601--zone-match "\\)?"))
 
 (defconst iso8601--combined-match
   (concat "\\(" iso8601--date-match "\\)"
           "\\(?:T\\("
-          (replace-regexp-in-string "(" "(?:" iso8601--time-match)
+          (string-replace "(" "(?:" iso8601--time-match)
           "\\)"
           "\\(" iso8601--zone-match "\\)?\\)?"))
 
index 1c169b78fd61dfea5fc5a630be6349e1e3d63e8d..0aa38166bc1343b58f04037745c195914a946f54 100644 (file)
@@ -357,7 +357,7 @@ is output until the first non-zero unit is encountered."
                            (format " %s%s" name
                                    (if (= num 1) "" "s"))))
                  t t string))))))
-  (replace-regexp-in-string "%%" "%" string))
+  (string-replace "%%" "%" string))
 
 (defvar seconds-to-string
   (list (list 1 "ms" 0.001)
index 680beb85affa6d1bb92ef1ab2159ee987cf53183..371d10631c59875cbb11856d517bc0ca865225bf 100644 (file)
@@ -4546,7 +4546,7 @@ its priority has changed, and `same' otherwise."
   (let ((bufname (buffer-name)))
     (string-match "\"\\([^\"]+\\)\"" bufname)
     (let* ((filename-str (substring bufname (match-beginning 1) (match-end 1)))
-          (filename-base (replace-regexp-in-string ", " "-" filename-str))
+          (filename-base (string-replace ", " "-" filename-str))
           (top-priorities (string-match "top priorities" bufname))
           (diary-items (string-match "diary items" bufname))
           (regexp-items (string-match "regexp items" bufname)))
index c9d557f5974c2c28ef74ed18e99e82d8e20f69f3..f540fb5540f5f91de168f764b450ee244e48c5b2 100644 (file)
@@ -59,7 +59,7 @@ to the file's truename, and dodging platform tricks."
     ;; doubling `!'s in the original name...
     (setq file (subst-char-in-string
                ?/ ?!
-               (replace-regexp-in-string "!" "!!" file)))
+               (string-replace "!" "!!" file)))
     file))
 
 (defun cedet-file-name-to-directory-name (referencefile &optional testmode)
@@ -71,7 +71,7 @@ specific conversions during tests."
     ;; Replace the ! with /
     (setq file (subst-char-in-string ?! ?/ file))
     ;; Occurrences of // meant there was once a single !.
-    (setq file (replace-regexp-in-string "//" "!" file))
+    (setq file (string-replace "//" "!" file))
 
     ;; Handle Windows special cases
     (when (or (memq system-type '(windows-nt ms-dos)) testmode)
index 40f58f2da7bbbc06977641661cdb2cd25e15ccff..7af8e8fd2a51a760458cfd5409be3bf9823bd08f 100644 (file)
@@ -2439,7 +2439,7 @@ carriage returns (\\r) in STRING.
 This function could be in the list `comint-output-filter-functions'."
   (when (let ((case-fold-search t))
          (string-match comint-password-prompt-regexp
-                        (replace-regexp-in-string "\r" "" string)))
+                        (string-replace "\r" "" string)))
     (let ((comint--prompt-recursion-depth (1+ comint--prompt-recursion-depth)))
       (if (> comint--prompt-recursion-depth 10)
           (message "Password prompt recursion too deep")
index 060f3a84111e542df64cefca6462bac80fffd12f..72969dd96e27c0cf0249c0518952705d334b1aea 100644 (file)
@@ -508,7 +508,7 @@ has no effect on MS-Windows."
         (default
           (and (stringp modestr)
                (string-match "^.\\(...\\)\\(...\\)\\(...\\)$" modestr)
-               (replace-regexp-in-string
+               (string-replace
                 "-" ""
                 (format "u=%s,g=%s,o=%s"
                         (match-string 1 modestr)
index a7bfae759edbab2ef882f18c38a2361f4a9de5e5..a990bd3fec3dca9c4a6a9e399f24a1bed3c663ed 100644 (file)
@@ -1193,7 +1193,7 @@ NOSELECT the files are merely found but not selected."
   (interactive)
   (require 'man)
   (let* ((file (dired-get-filename))
-         (manual-program (replace-regexp-in-string "\\*" "%s"
+         (manual-program (string-replace "*" "%s"
                           (dired-guess-shell-command
                            "Man command: " (list file)))))
     (Man-getpage-in-background file)))
index 28448be06ce0f512de33ed5f2fda544280ac699c..e577df510ad7d91eedb17a689e08c8c6933e2ca2 100644 (file)
@@ -1587,8 +1587,8 @@ see `dired-use-ls-dired' for more details.")
       ;; because newlines in dirnames are uncommon, and people may
       ;; have gotten used to seeing unescaped "\" in the headers.
       ;; Note: adjust dired-build-subdir-alist if you change this.
-      (setq dir (replace-regexp-in-string "\\\\" "\\\\" dir nil t)
-            dir (replace-regexp-in-string "\n" "\\n" dir nil t)))
+      (setq dir (string-replace "\\" "\\\\" dir)
+            dir (string-replace "\n" "\\n" dir)))
     ;; If we used --dired and it worked, the lines are already indented.
     ;; Otherwise, indent them.
     (unless (save-excursion
@@ -3167,15 +3167,15 @@ the quoted forms of those characters.
 FULL-NAME specifies the actual file name the listing must have,
 as returned by `dired-get-filename'.  LIMIT is the search limit."
   (let (str)
-    (setq str (replace-regexp-in-string "\^m" "\\^m"  file nil t))
-    (setq str (replace-regexp-in-string "\\\\" "\\\\" str nil t))
+    (setq str (string-replace "\^m" "\\^m"  file))
+    (setq str (string-replace "\\" "\\\\" str))
     (and (dired-switches-escape-p dired-actual-switches)
         (string-match-p "[ \t\n]" str)
         ;; FIXME: to fix this for embedded control characters etc, we
         ;; should escape everything that `ls -b' does.
-        (setq str (replace-regexp-in-string " " "\\ "  str nil t)
-              str (replace-regexp-in-string "\t" "\\t" str nil t)
-              str (replace-regexp-in-string "\n" "\\n" str nil t)))
+        (setq str (string-replace " " "\\ "  str)
+              str (string-replace "\t" "\\t" str)
+              str (string-replace "\n" "\\n" str)))
     (let ((found nil)
          ;; filenames are preceded by SPC, this makes the search faster
          ;; (e.g. for the filename "-").
index a04413b6f006f37a66c15a092ea578198befe868..ed75bf2bfa913e7bf86e3b9641c76e69aa0ae2ff 100644 (file)
@@ -1171,7 +1171,7 @@ clashes."
                           do (aset str j (aref byte 0))
                              (aset str (1+ j) (aref byte 1))
                           finally return str))
-         (human-readable (replace-regexp-in-string
+         (human-readable (string-replace
                           "-" "_" orig-name))
          (human-readable (replace-regexp-in-string
                           (rx (not (any "0-9a-z_"))) "" human-readable)))
index 396949d59a20208ab2c439e655ded0d31534b869..aec438ed9943ef31f0fa4e74f952e9d62a019411 100644 (file)
@@ -436,7 +436,7 @@ provided in the Commentary section of this library."
   (let ((re (with-output-to-string
              (print (reb-target-binding reb-regexp)))))
     (setq re (substring re 1 (1- (length re))))
-    (setq re (replace-regexp-in-string "\n" "\\n" re nil t))
+    (setq re (string-replace "\n" "\\n" re))
     (kill-new re)
     (message "Copied regexp `%s' to kill-ring" re)))
 
index 219af3741fa1d935d5a2f070f1a413b1df0e5596..fcdb8df20328f16640020558020385c911093ad0 100644 (file)
@@ -630,8 +630,8 @@ that subcommand."
 
 (define-inline erc-dcc-unquote-filename (filename)
   (inline-quote
-   (replace-regexp-in-string "\\\\\\\\" "\\"
-                             (replace-regexp-in-string "\\\\\"" "\"" ,filename t t) t t)))
+   (string-replace "\\\\" "\\"
+                   (string-replace "\\\"" "\"" ,filename))))
 
 (defun erc-dcc-handle-ctcp-send (proc query nick login host to)
   "This is called if a CTCP DCC SEND subcommand is sent to the client.
index 026c6f84164b45d8e99d9808e7df6bda3ab7127b..c66b03d2e4e83e10264ae9880f19e018737fdd69 100644 (file)
@@ -3597,7 +3597,7 @@ If S is non-nil, it will be used as the quit reason."
 If S is non-nil, it will be used as the quit reason."
   (or s
       (if (fboundp 'yow)
-          (replace-regexp-in-string "\n" "" (yow))
+          (string-replace "\n" "" (yow))
         (erc-quit/part-reason-default))))
 
 (make-obsolete 'erc-quit-reason-zippy "it will be removed." "24.4")
@@ -3624,7 +3624,7 @@ If S is non-nil, it will be used as the part reason."
 If S is non-nil, it will be used as the quit reason."
   (or s
       (if (fboundp 'yow)
-          (replace-regexp-in-string "\n" "" (yow))
+          (string-replace "\n" "" (yow))
         (erc-quit/part-reason-default))))
 
 (make-obsolete 'erc-part-reason-zippy "it will be removed." "24.4")
@@ -6528,7 +6528,7 @@ if `erc-away' is non-nil."
                                   (fill-region (point-min) (point-max))
                                   (buffer-string))))
                  (setq header-line-format
-                       (replace-regexp-in-string
+                       (string-replace
                         "%"
                         "%%"
                         (if face
@@ -6804,7 +6804,7 @@ functions."
               nick user host channel
               (if (not (string= reason ""))
                   (format ": %s"
-                          (replace-regexp-in-string "%" "%%" reason))
+                          (string-replace "%" "%%" reason))
                 "")))))
 
 
index 89ee13eb6863474e9c01cb81ab5b8dce233843d7..54d0b919e1dea5230f64849fcc6f5b037f8a05c4 100644 (file)
@@ -5201,7 +5201,7 @@ The function `find-backup-file-name' also uses this."
            (expand-file-name
             (subst-char-in-string
              ?/ ?!
-             (replace-regexp-in-string "!" "!!" file))
+             (string-replace "!" "!!" file))
             backup-directory))
        (expand-file-name (file-name-nondirectory file)
                          (file-name-as-directory abs-backup-directory))))))
@@ -6876,7 +6876,7 @@ the resulting file name, and SUFFIX is appended."
                 (file-name-directory result)
                 (subst-char-in-string
                  ?/ ?!
-                 (replace-regexp-in-string
+                 (string-replace
                    "!" "!!" filename))))
               (t result))))
       (setq result
@@ -7989,7 +7989,7 @@ based on existing mode bits, as in \"og+rX-w\"."
         (default
           (and (stringp modestr)
                (string-match "^.\\(...\\)\\(...\\)\\(...\\)$" modestr)
-               (replace-regexp-in-string
+               (string-replace
                 "-" ""
                 (format "u=%s,g=%s,o=%s"
                         (match-string 1 modestr)
index d73aae0459e344dff225ec4d0e69cbef72e9b817..82cfacc6b6f4367ac914de57857cf90b4fc4d738 100644 (file)
@@ -189,7 +189,7 @@ fringes."
   :type `(choice
           ,@ (mapcar (lambda (style)
                       (let ((name
-                             (replace-regexp-in-string "-" " " (car style))))
+                             (string-replace "-" " " (car style))))
                         `(const :tag
                                 ,(concat (capitalize (substring name 0 1))
                                          (substring name 1))
index fb0295d07030de3a19d65e20b64e6f1bc3cb30c6..d65e75e44c256bd5f9194f545844eedee00d3d47 100644 (file)
@@ -8288,7 +8288,7 @@ url is put as the `gnus-button-url' overlay property on the button."
             ")" (gnus-url-unhex-string (match-string 2 url)))))
    ((string-match "([^)\"]+)[^\"]+" url)
     (setq url
-         (replace-regexp-in-string
+         (string-replace
           "\"" "" (replace-regexp-in-string "[\n\t ]+" " " url)))
     (gnus-info-find-node url))
    (t (error "Can't parse %s" url))))
index 6202567344f177a6a8832cdca9a769bbf5e301c3..b1134397e5588731652a84010d56b7812a810db7 100644 (file)
@@ -2186,7 +2186,7 @@ handle COLLECTION as a list, hash table, or vector."
                                require-match initial-input
                                (or hist 'gnus-group-history)
                                def)))
-    (replace-regexp-in-string "\n" "" group)))
+    (string-replace "\n" "" group)))
 
 ;;;###autoload
 (defun gnus-fetch-group (group &optional articles)
index 1b2743c14843d1fd4b36af6f3b8346fff237e258..56f4fdf6d33dffcea8908b25818405908b674d2a 100644 (file)
              ;; ugly, but cannot get
              ;;replace-regexp-in-string work with "\\" as
              ;;REP, plus we should also handle "\\;"
-             (replace-regexp-in-string
-              "\\\\," ","
-              (replace-regexp-in-string
-               "\\\\n" "\n" (substring-no-properties value))))))
+             (string-replace
+              "\\," ","
+              (string-replace
+               "\\n" "\n" (substring-no-properties value))))))
         (accumulate-args
          (mapping)
          (cl-destructuring-bind (slot . ical-property) mapping
index d42f0971259e11b50518860f2d4578f1a1b097a3..664027f0164aa25fbd877a3aa912398bfdcbc436 100644 (file)
@@ -209,7 +209,7 @@ Calling (gnus-group-split-fancy nil nil \"mail.others\") returns:
                         "\\)"))
                  ;; Now create the new SPLIT
                  (let ((split-regexp-with-list-ids
-                        (replace-regexp-in-string "@" "[@.]" split-regexp t t))
+                        (string-replace "@" "[@.]" split-regexp))
                        (exclude
                         ;; Generate RESTRICTs for SPLIT-EXCLUDEs.
                         (if (listp split-exclude)
index 8182630dfed287322cc408ac227a3588117a84f0..59b8efaa3acccb6b9241b18607e713ed5ddc96a4 100644 (file)
@@ -572,7 +572,7 @@ nil.
 If VALUE is a relative time, interpret it as relative to
 REL-DATE, or (current-time) if REL-DATE is nil."
   ;; Time parsing doesn't seem to work with slashes.
-  (let ((value (replace-regexp-in-string "/" "-" value))
+  (let ((value (string-replace "/" "-" value))
        (now (append '(0 0 0)
                     (seq-subseq (decode-time (or rel-date
                                                  (current-time)))
@@ -1669,7 +1669,7 @@ cross our fingers for the rest of it."
 Mairix negation requires a \"~\" preceding string search terms,
 and \"-\" before marks."
   (let ((next (gnus-search-transform-expression engine (cadr expr))))
-    (replace-regexp-in-string
+    (string-replace
      ":"
      (if (eql (caadr expr) 'mark)
         ":-"
@@ -1863,9 +1863,9 @@ Assume \"size\" key is equal to \"larger\"."
                                  group
                                (if (file-directory-p
                                     (setq group
-                                          (replace-regexp-in-string
-                                           "\\." "/"
-                                           group nil t)))
+                                          (string-replace
+                                           "." "/"
+                                           group)))
                                    group))))))
                     (unless group
                       (signal 'gnus-search-config-error
index 44e97d54846215789421c933f0fb0402f0d3ac6a..02bbe19e7fe3183d51be93845016d989da7a880d 100644 (file)
@@ -854,7 +854,7 @@ If REGEXP is given, lines that match it will be deleted."
       (goto-char (point-max))
       ;; Make sure that each dribble entry is a single line, so that
       ;; the "remove" code above works.
-      (insert (replace-regexp-in-string "\n" "\\\\n" string) "\n")
+      (insert (string-replace "\n" "\\n" string) "\n")
       (bury-buffer gnus-dribble-buffer)
       (with-current-buffer gnus-group-buffer
        (gnus-group-set-mode-line)))))
index 4bdc2023eb404b9731ffdc756f319c4a0cba331f..dc004927b67fbb8365afd07ca3dbc3fa3a165938 100644 (file)
@@ -9191,7 +9191,7 @@ specified by the `gnus-refer-thread-limit' variable."
   (interactive "sMessage-ID: " gnus-summary-mode)
   (when (and (stringp message-id)
             (not (zerop (length message-id))))
-    (setq message-id (replace-regexp-in-string " " "" message-id))
+    (setq message-id (string-replace " " "" message-id))
     ;; Construct the correct Message-ID if necessary.
     ;; Suggested by tale@pawl.rpi.edu.
     (unless (string-match "^<" message-id)
index be0284515dc470b7831875e5d047217fd880b298..7a5e00c5ec926a76c5611698863f1a3cfb36849a 100644 (file)
@@ -408,7 +408,7 @@ Cache the result as a text property stored in DATE."
 
 (defun gnus-mode-string-quote (string)
   "Quote all \"%\"'s in STRING."
-  (replace-regexp-in-string "%" "%%" string))
+  (string-replace "%" "%%" string))
 
 (defsubst gnus-make-hashtable (&optional size)
   "Make a hash table of SIZE, testing on `equal'."
index bcbf7476715806beeaeb8d8258f0401d2126006d..a3ffaec3ff37c9b86b241bdd2c34aa127e33c27d 100644 (file)
@@ -8599,7 +8599,7 @@ From headers in the original article."
     (let ((value (message-field-value header)))
       (dolist (string (mail-header-parse-addresses value 'raw))
        (setq string
-             (replace-regexp-in-string
+             (string-replace
               "\n" ""
               (replace-regexp-in-string "^ +\\| +$" "" string)))
        (ecomplete-add-item 'mail (car (mail-header-parse-address string))
@@ -8889,7 +8889,7 @@ used to take the screenshot."
 
 (defun message-parse-mailto-url (url)
   "Parse a mailto: url."
-  (setq url (replace-regexp-in-string "\n" " " url))
+  (setq url (string-replace "\n" " " url))
   (when (string-match "mailto:/*\\(.*\\)" url)
     (setq url (substring url (match-beginning 1) nil)))
   (setq url (if (string-match "^\\?" url)
@@ -8931,9 +8931,9 @@ will then start up Emacs ready to compose mail.  For emacsclient use
     (dolist (arg args)
       (unless (equal (car arg) "body")
        (message-position-on-field (capitalize (car arg)))
-       (insert (replace-regexp-in-string
+       (insert (string-replace
                 "\r\n" "\n"
-                (mapconcat #'identity (reverse (cdr arg)) ", ") nil t))))
+                (mapconcat #'identity (reverse (cdr arg)) ", ")))))
     (when (assoc "body" args)
       (message-goto-body)
       (dolist (body (cdr (assoc "body" args)))
index 15157e6fbc89daa4861b55f82cfe9c7eb4a55d1b..b49793509fc9808e282b97dbbbdbfbb235ae0bae 100644 (file)
@@ -1022,7 +1022,7 @@ Returns non-nil if the user has chosen to use SENDER."
              (if (eq 'OpenPGP protocol)
                  (epg-sign-string context (buffer-string) mode)
                (epg-sign-string context
-                                (replace-regexp-in-string
+                                (string-replace
                                  "\n" "\r\n" (buffer-string))
                                 t))
              mml-secure-secret-key-id-list nil)
index 5c133e680af3e801e65677ebee3092a1326aea0a..959de0902e2302574381a7a24be8357642a5175a 100644 (file)
@@ -404,7 +404,7 @@ Content-Disposition: attachment; filename=smime.p7m
                                           nil t)))))
        (mm-sec-error 'gnus-info "Corrupted")
        (throw 'error handle))
-      (setq part (replace-regexp-in-string "\n" "\r\n" part)
+      (setq part (string-replace "\n" "\r\n" part)
            context (epg-make-context 'CMS))
       (condition-case error
          ;; (setq plain
index 1af7d10d05530a70879c66f01de6114a0b25521a..8c40fc79f002a2c24f4213a90e4749abd13dfb5b 100644 (file)
@@ -863,7 +863,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
                                       nil t))))
        (mm-sec-error 'gnus-info "Corrupted")
        (throw 'error handle))
-      (setq part (replace-regexp-in-string "\n" "\r\n" part)
+      (setq part (string-replace "\n" "\r\n" part)
            signature (mm-get-part signature)
            context (epg-make-context))
       (condition-case error
index 4867455393a594d10e5ac4f82e0b9fc3718a4ad0..372df64e2e5ea385458143b8d2c71e538f7796b4 100644 (file)
@@ -637,13 +637,11 @@ This variable is set by `nnmaildir-request-article'.")
          (funcall func (cdr entry)))))))
 
 (defun nnmaildir--system-name ()
-  (replace-regexp-in-string
+  (string-replace
    ":" "\\072"
-   (replace-regexp-in-string
+   (string-replace
     "/" "\\057"
-    (replace-regexp-in-string "\\\\" "\\134" (system-name) nil 'literal)
-    nil 'literal)
-   nil 'literal))
+    (string-replace "\\" "\\134" (system-name)))))
 
 (defun nnmaildir-request-type (_group &optional _article)
   'mail)
@@ -937,9 +935,9 @@ This variable is set by `nnmaildir-request-article'.")
                  (setq pgname (nnmaildir--pgname nnmaildir--cur-server gname)
 
                        ro (nnmaildir--param pgname 'read-only))
-                 (insert (replace-regexp-in-string
+                 (insert (string-replace
                           " " "\\ "
-                          (nnmaildir--grp-name group) nil t)
+                          (nnmaildir--grp-name group))
                          " ")
                   (princ (nnmaildir--group-maxnum nnmaildir--cur-server group)
                         nntp-server-buffer)
@@ -968,7 +966,7 @@ This variable is set by `nnmaildir-request-article'.")
          (princ (nnmaildir--group-maxnum nnmaildir--cur-server group)
                 nntp-server-buffer)
          (insert " "
-                 (replace-regexp-in-string " " "\\ " gname nil t)
+                 (string-replace " " "\\ " gname)
                  "\n")))))
   'group)
 
@@ -1098,7 +1096,7 @@ This variable is set by `nnmaildir-request-article'.")
        (insert " ")
        (princ (nnmaildir--group-maxnum nnmaildir--cur-server group)
               nntp-server-buffer)
-       (insert " " (replace-regexp-in-string " " "\\ " gname nil t) "\n")
+       (insert " " (string-replace " " "\\ " gname) "\n")
        t))))
 
 (defun nnmaildir-request-create-group (gname &optional server _args)
@@ -1262,7 +1260,7 @@ This variable is set by `nnmaildir-request-article'.")
              (insert "\t" (nnmaildir--nov-get-beg nov) "\t"
                      (nnmaildir--art-msgid article) "\t"
                      (nnmaildir--nov-get-mid nov) "\tXref: nnmaildir "
-                     (replace-regexp-in-string " " "\\ " gname nil t) ":")
+                     (string-replace " " "\\ " gname) ":")
              (princ num nntp-server-buffer)
              (insert "\t" (nnmaildir--nov-get-end nov) "\n"))))
     (catch 'return
index a40fa88631f086fc630e81b277f4db37ddca82b4..8cd8cbe84f15cec506143422bf62bffa103dc3a8 100644 (file)
@@ -785,7 +785,7 @@ It is useful when `(setq nnrss-use-local t)'."
                   (nnrss-node-just-text node)
                 node))
         (cleaned-text (if text
-                          (replace-regexp-in-string
+                          (string-replace
                            "\r\n" "\n"
                            (replace-regexp-in-string
                             "^[\000-\037\177]+\\|^ +\\| +$" ""
index a4234f840013e1351cfe14511faf58f935b48329..5fa280ea058f458c84510efdc2f4fba2d43a0369 100644 (file)
@@ -159,7 +159,7 @@ submitted at once.  Internal variable.")
         rpt-host
         (concat
          "/"
-         (replace-regexp-in-string
+         (string-replace
           "/" ":"
           (replace-regexp-in-string
            "^.*article.gmane.org/" ""
@@ -224,7 +224,7 @@ the function specified by `spam-report-url-ping-function'."
 
 (defcustom spam-report-user-mail-address
   (and (stringp user-mail-address)
-       (replace-regexp-in-string "@" "<at>" user-mail-address))
+       (string-replace "@" "<at>" user-mail-address))
   "Mail address of this user used for spam reports to Gmane.
 This is initialized based on `user-mail-address'."
   :type '(choice string
index 9088f31053bf47b21ed7552e4b27b61837402a8d..6c0180590b925c30b0ad389e03d420129881c7a1 100644 (file)
@@ -1719,7 +1719,7 @@ If point is on a group name, this function operates on that group."
                             (ibuffer-buffer-name-face buffer mark))))
     (if (not (seq-position string ?\n))
         string
-      (replace-regexp-in-string
+      (string-replace
        "\n" (propertize "^J" 'font-lock-face 'escape-glyph) string))))
 
 (define-ibuffer-column size
index 2509ecf8f828481e7e50371f606d1740f1b2d671..74985b9e56d817c410400a6968c6886423fa380b 100644 (file)
@@ -704,7 +704,7 @@ Increase at own risk.")
                         (thumb (cdr (assq ?t spec))))
                     (rename-file nq8 thumb t)))
               (message "command %S %s" (process-command process)
-                       (replace-regexp-in-string "\n" "" status)))))
+                       (string-replace "\n" "" status)))))
     process))
 
 (defun image-dired-pngcrush-thumb (spec)
@@ -726,7 +726,7 @@ Increase at own risk.")
             (unless (and (eq (process-status process) 'exit)
                          (zerop (process-exit-status process)))
               (message "command %S %s" (process-command process)
-                       (replace-regexp-in-string "\n" "" status)))
+                       (string-replace "\n" "" status)))
             (when (memq (process-status process) '(exit signal))
               (let ((temp (cdr (assq ?q spec))))
                 (delete-file temp)))))
@@ -744,7 +744,7 @@ Increase at own risk.")
             (unless (and (eq (process-status process) 'exit)
                          (zerop (process-exit-status process)))
               (message "command %S %s" (process-command process)
-                       (replace-regexp-in-string "\n" "" status)))))
+                       (string-replace "\n" "" status)))))
     process))
 
 (defun image-dired-create-thumb-1 (original-file thumbnail-file)
@@ -794,7 +794,7 @@ Increase at own risk.")
                           (zerop (process-exit-status process))))
                 (message "Thumb could not be created for %s: %s"
                          (abbreviate-file-name original-file)
-                         (replace-regexp-in-string "\n" "" status))
+                         (string-replace "\n" "" status))
               (set-file-modes thumbnail-file #o600)
               (clear-image-cache thumbnail-file)
               ;; PNG thumbnail has been created since we are
index b65728ba41b5680e1b0cc635f48c0c0ccf2168dc..1c477a7082f7f7c01fc8b4e905d3760c5259f5a7 100644 (file)
@@ -1732,14 +1732,14 @@ escaped (\\\",\\\\)."
                (concat
                 " ("
                 (if (stringp Info-current-file)
-                    (replace-regexp-in-string
+                    (string-replace
                      "%" "%%"
                      (file-name-sans-extension
                       (file-name-nondirectory Info-current-file)))
                   (format "*%S*" Info-current-file))
                 ") "
                 (if Info-current-node
-                    (propertize (replace-regexp-in-string
+                    (propertize (string-replace
                                  "%" "%%" Info-current-node)
                                 'face 'mode-line-buffer-id
                                 'help-echo
index 55accf5beee86aba5a945756f81e9597121fbd2e..71e2653ffe971ed8ec314daf295d5164fb2e4246 100644 (file)
@@ -2166,7 +2166,7 @@ See `set-language-info-alist' for use in programs."
            (let ((str (eval (get-language-info language-name 'sample-text))))
              (if (stringp str)
                  (insert "Sample text:\n  "
-                         (replace-regexp-in-string "\n" "\n  " str)
+                         (string-replace "\n" "\n  " str)
                          "\n\n")))
          (error nil))
        (let ((input-method (get-language-info language-name 'input-method))
index 6fb4502b23b64d588c85f50594a1aa9e32846e08..db34fd2cb9e783ad2280f0978651c352d21954f9 100644 (file)
@@ -63,7 +63,7 @@ must never cause a Lisp error."
          (let (mod)
            (when (and (string-match "\\\\\"" string)
                       (not (string-match "\\`\"\\|[^\\]\"" string)))
-             (setq string (replace-regexp-in-string "\\\\\"" "\"" string)
+             (setq string (string-replace "\\\"" "\"" string)
                    mod t))
            (when (and (string-match "\\\\(" string)
                       (string-match "\\\\)" string)
index 553f3cc3a54ec89746f0c1c73edde758c753d82b..b96f15d3e6838f80dd4cf5b5c91fdd1d334581aa 100644 (file)
@@ -91,7 +91,7 @@ Note: make sure MAILTO-URL has been \"unhtmlized\" (e.g., &amp; -> &), before
 calling this function."
   (let ((case-fold-search t)
        prequery query headers-alist)
-    (setq mailto-url (replace-regexp-in-string "\n" " " mailto-url))
+    (setq mailto-url (string-replace "\n" " " mailto-url))
     (if (string-match rfc2368-mailto-regexp mailto-url)
        (progn
          (setq prequery
index e479a8e9b4a5ba57a57e51f9644b464e1ae008f6..8a38337773eae9ba0b83e06fe910f16a8d7f5fe2 100644 (file)
@@ -1960,7 +1960,7 @@ Value is the size of the newly read mail after conversion."
                            (file-name-nondirectory
                             (if (memq system-type '(windows-nt cygwin ms-dos))
                                 ;; cannot have colons in file name
-                                (replace-regexp-in-string ":" "-" file)
+                                (string-replace ":" "-" file)
                               file)))
                    ;; Use the directory of this rmail file
                    ;; because it's a nuisance to use the homedir
@@ -3374,7 +3374,7 @@ The idea is to match it against simplified subjects of other messages."
     ;; Hide commas so it will work ok if parsed as a comma-separated list
     ;; of regexps.
     (setq subject
-         (replace-regexp-in-string "," "\054" subject t t))
+         (string-replace "," "\054" subject))
     (concat "\\`" subject "\\'")))
 
 (defun rmail-next-same-subject (n)
index eb8590f1f7322ca398eacdd9cd4fe512c0ac241e..4c23686909cba11ed893dce8c3ad7bdf7902c7b5 100644 (file)
@@ -678,9 +678,9 @@ than appending to it.  Deletes the message after writing if
           (or (mail-fetch-field "Subject")
               rmail-default-body-file)))
      (setq default-file
-          (replace-regexp-in-string ":" "-" default-file))
+          (string-replace ":" "-" default-file))
      (setq default-file
-          (replace-regexp-in-string " " "-" default-file))
+          (string-replace " " "-" default-file))
      (list (setq rmail-default-body-file
                 (read-file-name
                  "Output message body to file: "
index bf57ed6fa6fe0daacab51b5d04cfd88b8739a989..0760a477296e416868540bb409c9a65049620381 100644 (file)
@@ -125,7 +125,7 @@ See rmail-digest-methods."
          ;; Undo masking of separators inside digestified messages
          (goto-char (point-min))
          (while (search-forward
-                 (replace-regexp-in-string "\n-" "\n " separator) nil t)
+                 (string-replace "\n-" "\n " separator) nil t)
            (replace-match separator))
          ;; Return the list of marker pairs
          (nreverse result))))))
index 9b941a2b3d2d89690ef675afade879165fe41223..54b6ffe983610b14978e6a56333ecc4b4b6d3251 100644 (file)
@@ -802,7 +802,7 @@ POS defaults to `point'."
           ;; added by troff, and remove it.
           (or (not (eq (string-to-char (substring 1st-part -1)) ?-))
               (string-match-p "-" (substring 1st-part 0 -1))
-              (setq word (replace-regexp-in-string "-" "" word))))
+              (setq word (string-replace "-" "" word))))
        ;; Make sure the section number gets included by the code below.
        (goto-char (match-end 1)))
       (when (string-match "[-._‐]+$" word)
index 89e5d7c48a325e5625f6a3716cd11ae92b24d072..cf7c17be28fe3c62594f823916b3dc661fd22e4a 100644 (file)
@@ -180,7 +180,7 @@ items `Turn Off' and `Help'."
                   `(keymap
                     ,(format "%s - %s" indicator
                             (capitalize
-                             (replace-regexp-in-string
+                             (string-replace
                               "-" " " (format "%S" minor-mode))))
                     (turn-off menu-item "Turn off minor mode" ,mm-fun)
                     (help menu-item "Help for minor mode"
index ab572aa539a58feee8c33c4ca69f12b6ef37c9ba..e04ffa497470b61d1b69c94090e347a257ea5e2e 100644 (file)
@@ -214,8 +214,8 @@ defaults to 6600 and HOST defaults to localhost."
       (with-current-buffer "*MPC-debug*"
         (goto-char (point-max))
         (insert-before-markers          ;So it scrolls.
-         (replace-regexp-in-string "\n" "\n    "
-                                   (apply #'format-message format args))
+         (string-replace "\n" "\n      "
+                         (apply #'format-message format args))
          "\n"))))
 
 (defun mpc--proc-filter (proc string)
index 6d64100be178d7a4f43a2a3f23c750fac06c334d..f739cd72cc3ab91e6936ffacee6935b837fdccc1 100644 (file)
@@ -1644,7 +1644,7 @@ used instead of `browse-url-new-window-flag'."
          (insert "\n"))
        (goto-char (prog1
                       (point)
-                    (insert (replace-regexp-in-string "\r\n" "\n" body))
+                    (insert (string-replace "\r\n" "\n" body))
                     (unless (bolp)
                       (insert "\n"))))))))
 
index eec3ec7ba8b0081601aa180d5ef4c35888084039..2a81d2e0c8cd163e29e722111c80cc72ac1f4f61 100644 (file)
@@ -779,7 +779,7 @@ Currently this means either text/html or application/xhtml+xml."
                                        (propertize "...: " 'face
                                                    'variable-pitch))))
                             (propertize "..." 'face 'variable-pitch)))))))
-              (replace-regexp-in-string
+              (string-replace
                "%" "%%"
                (format-spec
                 eww-header-line-format
index e623dab26dfe926c8b7ee460e242d24d13f7a7b4..dc541943587fabdfaab159d5022547b1b5899434 100644 (file)
@@ -610,7 +610,7 @@ This does NOT start the retrieval timers."
   (interactive)
   (let ((filename (read-string "Filename: "
                                (concat feed ":_"
-                                       (replace-regexp-in-string
+                                       (string-replace
                                         " " "_" (newsticker--title item))
                                        ".html"))))
     (with-temp-buffer
index f11f36e8096b364129a84e22470b557804a84b30..e7aec505b0b46ac7b8aaf59abc4aab4bc2cbac03 100644 (file)
@@ -800,7 +800,7 @@ When 0, do not auto-reconnect."
 
 (defun rcirc-sentinel (process sentinel)
   "Called when PROCESS receives SENTINEL."
-  (let ((sentinel (replace-regexp-in-string "\n" "" sentinel)))
+  (let ((sentinel (string-replace "\n" "" sentinel)))
     (rcirc-debug process (format "SENTINEL: %S %S\n" process sentinel))
     (with-rcirc-process-buffer process
       (dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist)))
index 821ef4af8e0a1a94fa7ea5e02951cf3cf288d2e9..f5480afb69874b0e5ff1cd46cdb14e2308a10148 100644 (file)
@@ -659,7 +659,7 @@ representing leap seconds."
             (if second
                 (if second-fraction
                     (let* ((second-fraction-significand
-                            (replace-regexp-in-string "\\." "" second-fraction))
+                            (string-replace "." "" second-fraction))
                            (hertz
                             (expt 10 (length second-fraction-significand)))
                            (ticks (+ (* hertz (string-to-number second))
index 1314ade9e31efd6579cd8ef29aaf2f09488c1bdf..d820d1b99b5e0ffd1937784573cb05ffc834d8cf 100644 (file)
@@ -100,7 +100,7 @@ Return a pattern."
   "Regular expression to match a single-quoted literal.")
 
 (defconst rng-c-literal-2-re
-  (replace-regexp-in-string "'" "\"" rng-c-literal-1-re)
+  (string-replace "'" "\"" rng-c-literal-1-re)
   "Regular expression to match a double-quoted literal.")
 
 (defconst rng-c-ncname-re "\\w+")
index 9824eebbd8b362c76837152965d3560c426f058d..38bc2e141e603816013c821735b5889a7aa4cd05 100644 (file)
@@ -479,7 +479,7 @@ and VALUE-END, otherwise a STRING giving the value."
                      "[^<'&\r\n\t]*"
                      (xmltok-g complex1 "[&\r\n\t][^<']*") opt
                      "'"))
-           (lit2 (cons (replace-regexp-in-string "'" "\"" (car lit1))
+           (lit2 (cons (string-replace "'" "\"" (car lit1))
                        '(complex2)))
            (literal (xmltok-g literal lit1 or lit2))
            (name (xmltok+ open (xmltok-g xmlns "xmlns") or ncname close
index 40a8ec57b98ba872c40e7b0bc4126ae7e3abbd21..caeca98881045424dd16e1b96605f6562541ea7e 100644 (file)
@@ -920,10 +920,10 @@ Tested with swish-e-2.0.1 on Windows NT 4.0."
            ;; eliminate all ".", "/", "\" from beginning. Always matches.
             (string-match "^[./\\]*\\(.*\\)$" dirnam)
             ;; "/" -> "."
-            (setq group (replace-regexp-in-string
+            (setq group (string-replace
                         "/" "." (match-string 1 dirnam)))
             ;; Windows "\\" -> "."
-            (setq group (replace-regexp-in-string "\\\\" "." group))
+            (setq group (string-replace "\\" "." group))
 
             (push (vector (gnus-group-full-name group server)
                           (string-to-number artno)
@@ -996,7 +996,7 @@ Tested with swish-e-2.0.1 on Windows NT 4.0."
        (when (string-match prefix dirnam)
          (setq dirnam (replace-match "" t t dirnam)))
        (push (vector (gnus-group-full-name
-                       (replace-regexp-in-string "/" "." dirnam) server)
+                       (string-replace "/" "." dirnam) server)
                      (string-to-number artno)
                      (string-to-number score))
              artlist))
@@ -1205,9 +1205,9 @@ construct path: search terms (see the variable
                                  group
                                (if (file-directory-p
                                     (setq group
-                                          (replace-regexp-in-string
-                                           "\\." "/"
-                                           group nil t)))
+                                          (string-replace
+                                           "." "/"
+                                           group)))
                                    group))))))
                     (unless group
                       (error "Cannot locate directory for group"))
index c3be029a6584c3eb5ff6df5672008ad1aff28973..3bb8bf0c82bb5b2819315be43d65e8e0c92c13ba 100644 (file)
@@ -2373,7 +2373,7 @@ Also prints current score to let user know he has scored."
          (dun-mprincl "Incorrect.")))
 
     (let (varname epoint afterq i value)
-      (setq varname (replace-regexp-in-string " " "" (substring line 0 esign)))
+      (setq varname (string-replace " " "" (substring line 0 esign)))
 
       (if (or (= (length varname) 0) (< (- (length line) esign) 2))
          (progn
index cc058230751f665aa47a25447d70bd8ba36a52d9..2aec408e11bba7d0bf94e87d3d3e0a67748be08b 100644 (file)
@@ -200,7 +200,7 @@ Variables: `handwrite-linespace'     (default 12)
                                               (concat "\\\\" (cdr trans))
                                               line)))
        (switch-to-buffer ps-buf-name)
-       (insert (replace-regexp-in-string "\n" "" line))
+       (insert (string-replace "\n" "" line))
        (message "write write write...")
        (setq ps-ypos (+ ps-ypos handwrite-linespace))
        (end-of-line)
index d1a243df8e0cf989e94faf21e3eba3bb8e33f2ec..2fafdcc58e5cf490cad87f07ac046964a0587cc4 100644 (file)
@@ -1389,7 +1389,7 @@ The return string is always 6 characters wide."
 (defun proced-format-args (args)
   "Format attribute ARGS.
 Replace newline characters by \"^J\" (two characters)."
-  (replace-regexp-in-string "\n" "^J" args))
+  (string-replace "\n" "^J" args))
 
 (defun proced-format (process-alist format)
   "Display PROCESS-ALIST using FORMAT."
index 8145e51d75d0c4d08f44a225fb6ac982018c0bfc..4c427692cb8d058576a66e245ec366c3a88ece08 100644 (file)
@@ -499,7 +499,7 @@ RET: expand or collapse"))
 
 (defun profiler-report-header-line-format (fmt &rest args)
   (let* ((header (apply #'profiler-format fmt args))
-        (escaped (replace-regexp-in-string "%" "%%" header)))
+        (escaped (string-replace "%" "%%" header)))
     (concat
      (propertize " "
                  'display '(space :align-to 0)
index b9c8305bed06fce9a3baf7bc38169435c2346932..97596d0d27885eec10ceff3325f0fcfa71286355 100644 (file)
@@ -1963,7 +1963,7 @@ commands to be prefixed by \"-interpreter-exec console\".")
 The string is enclosed in double quotes.
 All embedded quotes, newlines, and backslashes are preceded with a backslash."
   (setq string (replace-regexp-in-string "\\([\"\\]\\)" "\\\\\\&" string))
-  (setq string (replace-regexp-in-string "\n" "\\n" string t t))
+  (setq string (string-replace "\n" "\\n" string))
   (concat "\"" string "\""))
 
 (defun gdb-input (command handler-function &optional trigger-name)
index 4d277755aeb03b453a0d3c105780f3da7060f1f1..df17b87c0137a45ec18453b99d46b023f0e159b8 100644 (file)
@@ -257,7 +257,7 @@ not be enclosed in { } or ( )."
   "Regex used to highlight makepp rule action lines in font lock mode.")
 
 (defconst makefile-bsdmake-rule-action-regex
-  (replace-regexp-in-string "-@" "-+@" makefile-rule-action-regex)
+  (string-replace "-@" "-+@" makefile-rule-action-regex)
   "Regex used to highlight BSD rule action lines in font lock mode.")
 
 ;; Note that the first and second subexpression is used by font lock.  Note
@@ -358,11 +358,10 @@ not be enclosed in { } or ( )."
     ,@(if keywords
           ;; Fontify conditionals and includes.
           `((,(concat "^\\(?: [ \t]*\\)?"
-             (replace-regexp-in-string
+             (string-replace
               " " "[ \t]+"
               (if (eq (car keywords) t)
-                  (replace-regexp-in-string "-" "[_-]"
-                                             (regexp-opt (cdr keywords) t))
+                  (string-replace "-" "[_-]" (regexp-opt (cdr keywords) t))
                 (regexp-opt keywords t)))
              "\\>[ \t]*\\([^: \t\n#]*\\)")
              (1 font-lock-keyword-face) (2 font-lock-variable-name-face))))
index 0b520e39074c6e640266b3fbf1b0bd733ad93b89..2e23c2e2cabd81a6a12b8ab1c45c052ca9aba865 100644 (file)
@@ -2277,7 +2277,7 @@ between them)."
           ;(goto-char beg)
           (if (search-forward-regexp "^[ \t]*\\(%+\\|\\*+\\|/\\*+\\)[ \t]*"
                                      end t)
-              (replace-regexp-in-string "/" " " (buffer-substring beg (point)))
+              (string-replace "/" " " (buffer-substring beg (point)))
             (beginning-of-line)
             (when (search-forward-regexp "^[ \t]+" end t)
               (buffer-substring beg (point)))))))))
index 01fb044161b314992918f65f4b52d24efd50b10c..74b48ca4bde5ed5aad8a89b56b06eabaa52dcf37 100644 (file)
@@ -1788,8 +1788,8 @@ If the result is do-end block, it will always be multiline."
             (buffer-substring-no-properties (1+ min) (1- max))))
       (setq content
             (if (equal string-quote "'")
-                (replace-regexp-in-string "\\\\\"" "\"" (replace-regexp-in-string "\\(\\`\\|[^\\]\\)'" "\\1\\\\'" content))
-              (replace-regexp-in-string "\\\\'" "'" (replace-regexp-in-string "\\(\\`\\|[^\\]\\)\"" "\\1\\\\\"" content))))
+                (string-replace "\\\"" "\"" (replace-regexp-in-string "\\(\\`\\|[^\\]\\)'" "\\1\\\\'" content))
+              (string-replace "\\'" "'" (replace-regexp-in-string "\\(\\`\\|[^\\]\\)\"" "\\1\\\\\"" content))))
       (let ((orig-point (point)))
         (delete-region min max)
         (insert
index f144549cf6d0e7b256c52eb4e9cc6deffbe857ff..b9012166a528ff430430a8df39aecbab732251bc 100644 (file)
@@ -3843,7 +3843,7 @@ to avoid deleting non-prompt output."
 
 (defun sql-remove-tabs-filter (str)
   "Replace tab characters with spaces."
-  (replace-regexp-in-string "\t" " " str nil t))
+  (string-replace "\t" " " str))
 
 (defun sql-toggle-pop-to-buffer-after-send-region (&optional value)
   "Toggle `sql-pop-to-buffer-after-send-region'.
@@ -3864,7 +3864,7 @@ If given the optional parameter VALUE, sets
   "If non-nil, display messages related to the use of redirection.")
 
 (defun sql-str-literal (s)
-  (concat "'" (replace-regexp-in-string "[']" "''" s) "'"))
+  (concat "'" (string-replace "[']" "''" s) "'"))
 
 (defun sql-redirect (sqlbuf command &optional outbuf save-prior)
   "Execute the SQL command and send output to OUTBUF.
index 02a8d72758c29d2d1c37257284d0b52c942e26c6..eb170baa5d89300f0f60fbcd8c932ed9af9f05c3 100644 (file)
@@ -175,7 +175,7 @@ and you want to simplify them for the mode line
 (defvar which-func-table (make-hash-table :test 'eq :weakness 'key))
 
 (defconst which-func-current
-  '(:eval (replace-regexp-in-string
+  '(:eval (string-replace
           "%" "%%"
           (or (gethash (selected-window) which-func-table)
                which-func-unknown))))
index ee46286a75fb9484fc331d181dee994058fdc58f..c67877efd5dc01d454af9283faaf8b445fdbbdb0 100644 (file)
@@ -213,7 +213,7 @@ wants to replace FROM with TO."
            (when query-replace-from-to-separator
              ;; Check if the first non-whitespace char is displayable
              (if (char-displayable-p
-                  (string-to-char (replace-regexp-in-string
+                  (string-to-char (string-replace
                                    " " "" query-replace-from-to-separator)))
                  query-replace-from-to-separator
                " -> ")))
@@ -2101,7 +2101,7 @@ See also `multi-occur'."
                              ;; Add non-numeric prefix to all non-first lines
                              ;; of multi-line matches.
                               (concat
-                              (replace-regexp-in-string
+                              (string-replace
                                "\n"
                                (if prefix-face
                                    (propertize
@@ -2506,12 +2506,10 @@ a string, it is first passed through `prin1-to-string'
 with the `noescape' argument set.
 
 `match-data' is preserved across the call."
-  (save-match-data
-    (replace-regexp-in-string "\\\\" "\\\\"
-                             (if (stringp replacement)
-                                 replacement
-                               (prin1-to-string replacement t))
-                             t t)))
+  (string-replace "\\" "\\\\"
+                 (if (stringp replacement)
+                     replacement
+                   (prin1-to-string replacement t))))
 
 (defun replace-loop-through-replacements (data count)
   ;; DATA is a vector containing the following values:
index eaa74cebd8015a65b36d49744e8ccb054f6bdfb2..15e171c13f9848444292752b941ec368cb489393 100644 (file)
@@ -496,7 +496,7 @@ two markers or an overlay.  Otherwise, it is nil."
            (error "Unknown selection type: %S" type)))))
 
       ;; Most programs are unable to handle NUL bytes in strings.
-      (setq str (replace-regexp-in-string "\0" "\\0" str t t))
+      (setq str (string-replace "\0" "\\0" str))
 
       (setq next-selection-coding-system nil)
       (cons type str))))
index ca515f829dc5c29bd0ce7404c899ca6568adad3f..81c27144a54d1a7df551e937ebd19331ea2a733c 100644 (file)
@@ -3357,7 +3357,7 @@ is non-nil.  Newlines and tabs in the export text are escaped."
        (push "'" result)
        (setq item (cadr item)))
       (setq item (ses-prin1 item))
-      (setq item (replace-regexp-in-string "\t" "\\\\t" item))
+      (setq item (string-replace "\t" "\\t" item))
       (push item result)
       (cond
        ((< col maxcol)
index b828660066467680c04826fd9bd81fcdaba3788d..87298b5cfde625e26c639b8734fa1e07e548a09e 100644 (file)
@@ -3681,7 +3681,7 @@ See Info node `(elisp)Security Considerations'."
         "''"
       ;; Quote everything except POSIX filename characters.
       ;; This should be safe enough even for really weird shells.
-      (replace-regexp-in-string
+      (string-replace
        "\n" "'\n'"
        (replace-regexp-in-string "[^-0-9a-zA-Z_./\n]" "\\\\\\&" argument))))
    ))
index 8cff2ceaeecd89f67f06737e004ab299e0ae7ef5..9e7b360b9c6f64de17b11462e4fa488e441a7e4d 100644 (file)
@@ -290,7 +290,7 @@ This is used by `msdos-show-help'.")
              (not cursor-in-echo-area)) ;Don't overwrite a prompt.
     (cond
      ((stringp help)
-      (setq help (replace-regexp-in-string "\n" ", " help))
+      (setq help (string-replace "\n" ", " help))
       (unless (or msdos-previous-message
                  (string-equal help (current-message))
                  (and (stringp msdos-last-help-message)
index 6b849164aecb7e52950783d5a9c8ccfb4d3bab6c..80afcb360408c818b69c0280d0f2807724cc0def 100644 (file)
@@ -410,7 +410,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
 ;;; Fix interface to (X-specific) mouse.el
 (defun w32--set-selection (type value)
   (if (eq type 'CLIPBOARD)
-      (w32-set-clipboard-data (replace-regexp-in-string "\0" "\\0" value t t))
+      (w32-set-clipboard-data (string-replace "\0" "\\0" value))
     (put 'x-selections (or type 'PRIMARY) value)))
 
 (defun w32--get-selection  (&optional type data-type)
index 8bcae37afe4503ed5ac5397e0906187438da9350..868b33ea9c54009461beb6c4280d0e7dc8f6cc44 100644 (file)
@@ -1015,10 +1015,9 @@ hitting screen's max DCS length."
                      'terminal-init-screen))
          (bytes (encode-coding-string data 'utf-8-unix))
          (base-64 (if screen
-                      (replace-regexp-in-string
+                      (string-replace
                        "\n" "\e\\\eP"
-                       (base64-encode-string bytes)
-                       :fixedcase :literal)
+                       (base64-encode-string bytes))
                     (base64-encode-string bytes :no-line-break)))
          (length (length base-64)))
     (if (> length xterm-max-cut-length)
index 1368af01bacf49f59853daeea5d6ec0dcb61a42c..1d5d1caeabc45a89b2de3b689472a72cce9ddffb 100644 (file)
@@ -449,8 +449,8 @@ If no such character is found, move to beginning of line."
               (progn
                 (beginning-of-line)
                 (skip-chars-backward
-                 (concat "^" (replace-regexp-in-string
-                              "\\\\" "\\\\" picture-tab-chars nil t))
+                 (concat "^" (string-replace
+                              "\\" "\\\\" picture-tab-chars))
                  (point-min))
                 (not (bobp))))
          (move-to-column target))
index 5710b8c353ba020ff242abcce07339d3c07a5140..4c863883ba4d1ae59d514db17872dab0a6a64e45 100644 (file)
@@ -434,10 +434,10 @@ Open another window."
 (defun thumbs-call-setroot-command (img)
   "Call the setroot program for IMG."
   (run-hooks 'thumbs-before-setroot-hook)
-  (shell-command (replace-regexp-in-string
-                 "\\*"
+  (shell-command (string-replace
+                 "*"
                  (shell-quote-argument (expand-file-name img))
-                 thumbs-setroot-command nil t))
+                 thumbs-setroot-command))
   (run-hooks 'thumbs-after-setroot-hook))
 
 (defun thumbs-set-image-at-point-to-root-window ()
index 03d9f54ea6c6d994191cac26dd3f83d1628dc3ef..23b67ee2cabde32a33517e87167f0a014cd223d1 100644 (file)
@@ -346,7 +346,7 @@ It is also called if Tooltip mode is on, for text-only displays."
              (not cursor-in-echo-area))  ;Don't overwrite a prompt.
     (cond
      ((stringp help)
-      (setq help (replace-regexp-in-string "\n" ", " help))
+      (setq help (string-replace "\n" ", " help))
       (unless (or tooltip-previous-message
                  (equal-including-properties help (current-message))
                  (and (stringp tooltip-help-message)
index 5f66a13094bd37bcbf42bf3be4941fb323bd948a..4087a0c68a6ab3661c7d99d915b90b235b11b917 100644 (file)
@@ -3064,18 +3064,18 @@ Optional support for popup buttons is also implemented here."
            ((equal (seq-take seq len) transient--redisplay-key)
             (let ((pre (key-description (vconcat (seq-take seq len))))
                   (suf (key-description (vconcat (seq-drop seq len)))))
-              (setq pre (replace-regexp-in-string "RET" "C-m" pre t))
-              (setq pre (replace-regexp-in-string "TAB" "C-i" pre t))
-              (setq suf (replace-regexp-in-string "RET" "C-m" suf t))
-              (setq suf (replace-regexp-in-string "TAB" "C-i" suf t))
+              (setq pre (string-replace "RET" "C-m" pre))
+              (setq pre (string-replace "TAB" "C-i" pre))
+              (setq suf (string-replace "RET" "C-m" suf))
+              (setq suf (string-replace "TAB" "C-i" suf))
               ;; We use e.g. "-k" instead of the more correct "- k",
               ;; because the former is prettier.  If we did that in
               ;; the definition, then we want to drop the space that
               ;; is reinserted above.  False-positives are possible
               ;; for silly bindings like "-C-c C-c".
               (unless (string-match-p " " key)
-                (setq pre (replace-regexp-in-string " " "" pre))
-                (setq suf (replace-regexp-in-string " " "" suf)))
+                (setq pre (string-replace " " "" pre))
+                (setq suf (string-replace " " "" suf)))
               (concat (propertize pre 'face 'default)
                       (and (string-prefix-p (concat pre " ") key) " ")
                       (transient--colorize-key suf cmd)
index 29c2780121ad7ff4c464387df95e9c61984d034e..4fd631d2955a0a457fe1865b45545ed3c7364af8 100644 (file)
                (goto-char (point-max)))
            (insert (mapconcat
                      (lambda (string)
-                       (replace-regexp-in-string "\r\n" "\n" string))
+                       (string-replace "\r\n" "\n" string))
                     (cdar args) "\n")))
        (url-mail-goto-field (caar args))
        ;; (setq func (intern-soft (concat "mail-" (caar args))))
index 4a44787bb031475ad427c63faccbdefe98238efb..46e9c97eb0a92a612b55ec3097f9d98a4ad1ce72 100644 (file)
@@ -974,8 +974,8 @@ Return non-nil if it is."
                    (not (looking-at (format ".+  .+  <%s>"
                                             (regexp-quote mail))))
                    (looking-at ".+  \\(.+  <.+>\\) *\\((tiny change)\\)?"))
-          (let ((author (replace-regexp-in-string "  " " "
-                                                  (match-string 1))))
+          (let ((author (string-replace "  " " "
+                                        (match-string 1))))
             (unless (and log-edit-author
                          (string-match (regexp-quote author)
                                        (car log-edit-author)))
index de5a90dc6024317fe0b4be288bf41699e3dec63f..5144b5d0bbb940c2574c6a60b2b5cd977b451d76 100644 (file)
@@ -467,7 +467,7 @@ in the branch repository (or whose status not be determined)."
           ;; Erase the status text that matched.
           (delete-region (match-beginning 0) (match-end 0))
           (setq status
-                (intern (replace-regexp-in-string " " "" statusword)))))
+                (intern (string-replace " " "" statusword)))))
       (when status
         (goto-char (point-min))
         (skip-chars-forward " \n\t") ;Throw away spaces.
index c9c1e91d483247a375d44ee2adf8c0c6d13b2b84..4a64caa36b8205ade483d644d157d11b0596111c 100644 (file)
@@ -851,8 +851,8 @@ if we don't understand a construct, we signal
                         (push "\\[" parts))
                        (t
                         (let ((x (substring glob i j)))
-                          (setf x (replace-regexp-in-string
-                                   "\\\\" "\\\\" x t t))
+                          (setf x (string-replace
+                                   "\\" "\\\\" x))
                           (setf i (1+ j))
                           (cond ((eq (aref x 0) ?!)
                                  (setf (aref x 0) ?^))
index c30920dd157a3856d266922de16c313447072863..544a6c769fcaf8125a70278e28cd52f414d7c268 100644 (file)
@@ -192,7 +192,7 @@ switches."
       (let ((state (cdr (assq (aref (match-string 1) 0) state-map)))
             (propstat (cdr (assq (aref (match-string 2) 0) state-map)))
             (filename (if (memq system-type '(windows-nt ms-dos))
-                          (replace-regexp-in-string "\\\\" "/" (match-string 4))
+                          (string-replace "\\" "/" (match-string 4))
                         (match-string 4))))
         (and (memq propstat '(conflict edited))
              (not (eq state 'conflict)) ; conflict always wins
index 0bdfd114c48f459e180265c7afa6dc58b5fdd79f..e5165bbd86aef9435277d49ed52038da30532d02 100644 (file)
@@ -208,8 +208,8 @@ Optional argument GROUP defaults to the string \"Desktop Entry\"."
   "Partition VALUE into elements delimited by unescaped semicolons."
   (let (res)
     (setq value (string-trim-left value))
-    (dolist (x (split-string (replace-regexp-in-string "\\\\;" "\0" value) ";"))
-      (push (replace-regexp-in-string "\0" ";" x) res))
+    (dolist (x (split-string (string-replace "\\;" "\0" value) ";"))
+      (push (string-replace "\0" ";" x) res))
     (when (null (string-match-p "[^[:blank:]]" (car res))) (pop res))
     (nreverse res)))
 
index 235c02f8e8b3a9ed9b76d3ed4747fb99aeac1850..ea856ab311c13da42796ced0de57dd461aac9960 100644 (file)
@@ -146,7 +146,7 @@ The buffer's contents should %s:
                     "")
                   char
                   (if (string= fixture expected-string) "stay" "become")
-                  (replace-regexp-in-string "\n" "\\\\n" expected-string)
+                  (string-replace "\n" "\\n" expected-string)
                   expected-point)))
       `(ert-deftest ,(intern (format "electric-pair-%s-at-point-%s-in-%s%s"
                                      name
index 503cb5d7aab8e2f6f53cb7b3175ca36c7ceb9851..50ac370b5b56491247774add4f95c69cade262e1 100644 (file)
@@ -56,7 +56,7 @@
 first line\r
 next line\r\n"))
     (should (equal (term-test-screen-from-input 40 12 str)
-                   (replace-regexp-in-string "\r" "" str)))))
+                   (string-replace "\r" "" str)))))
 
 (ert-deftest term-carriage-return ()
   (skip-unless (not (memq system-type '(windows-nt ms-dos))))
index 0d64320496dc26fddf7a46822fb503150fc20538..4e6fbbba923fcfbdbd9ee6e812fd3139b576e124 100644 (file)
@@ -849,7 +849,7 @@ The functions in `pattern-mod' are composed left to right."
 
 (defun formatz-mod-del-colons (string)
   "Returns STRING with any colons removed."
-  (replace-regexp-in-string ":" "" string))
+  (string-replace ":" "" string))
 
 (defun formatz-mod-add-00 (string)
   "Returns STRING with \"00\" appended."
index ba276e24d962fbf7f47611b104e2325547ac99a1..96a01fc2c7b8442a0c78b69ba22fa2f8fdbde6f5 100644 (file)
@@ -31,7 +31,7 @@ Partially modifying a file name should succeed."
   (let* ((test-dir (make-temp-file "test-dir-" t))
         (test-file (concat (file-name-as-directory test-dir) "foo.c"))
         (replace "bar")
-        (new-file (replace-regexp-in-string "foo" replace test-file))
+        (new-file (string-replace "foo" replace test-file))
         (wdired-use-interactive-rename t))
     (write-region "" nil test-file nil 'silent)
     (advice-add 'dired-query ; Don't ask confirmation to overwrite a file.
@@ -109,7 +109,7 @@ wdired-mode."
   (let* ((test-dir (make-temp-file "test-dir-" t))
         (test-file (concat (file-name-as-directory test-dir) "foo.c"))
         (replace "bar")
-        (new-file (replace-regexp-in-string "foo" replace test-file)))
+        (new-file (string-replace "foo" replace test-file)))
     (write-region "" nil test-file nil 'silent)
     (let ((buf (find-file-noselect test-dir)))
       (unwind-protect
index 908945fcb08682de83558044e1b6e014555355dc..8dc0a744aa0d8e14f97b63361de6cb181bf792d9 100644 (file)
@@ -252,7 +252,7 @@ Test with both unibyte and multibyte strings."
   (let* ((input
           "{ \"abc\" : [9, false] , \"def\" : null }")
          (output
-          (replace-regexp-in-string " " "" input)))
+          (string-replace " " "" input)))
     (should (equal (json-parse-string input
                                       :object-type 'plist
                                       :null-object :json-null