diff options
| author | Lars Ingebrigtsen | 2020-09-27 00:24:50 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2020-09-27 00:24:50 +0200 |
| commit | baf331e40c08155082e255372d7cc3c9d63aa3c8 (patch) | |
| tree | f8d081898fd1ae9715e5db5b102a83d667d9bd0e | |
| parent | 13e75e620b84fda6c951005bf6c80aea854ee58a (diff) | |
| download | emacs-baf331e40c08155082e255372d7cc3c9d63aa3c8.tar.gz emacs-baf331e40c08155082e255372d7cc3c9d63aa3c8.zip | |
Rename replace-in-string to string-replace
* doc/lispref/searching.texi (Search and Replace): Update.
* lisp/bindings.el (mode-line-position): Update callers.
* lisp/subr.el (string-replace): Rename from replace-in-string
since that clashes with XEmacs' replace-in-string which is
equivalent to the Emacs replace-regexp-in-string (bug#43598).
| -rw-r--r-- | doc/lispref/searching.texi | 2 | ||||
| -rw-r--r-- | etc/NEWS | 2 | ||||
| -rw-r--r-- | lisp/bindings.el | 4 | ||||
| -rw-r--r-- | lisp/subr.el | 2 | ||||
| -rw-r--r-- | test/lisp/subr-tests.el | 26 |
5 files changed, 18 insertions, 18 deletions
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index a217c6e9358..451283b4aa5 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi | |||
| @@ -2566,7 +2566,7 @@ replacement string. The match data at this point are the result | |||
| 2566 | of matching @var{regexp} against a substring of @var{string}. | 2566 | of matching @var{regexp} against a substring of @var{string}. |
| 2567 | @end defun | 2567 | @end defun |
| 2568 | 2568 | ||
| 2569 | @defun replace-in-string fromstring tostring instring | 2569 | @defun string-replace fromstring tostring instring |
| 2570 | This function copies @var{instring} and replaces any occurrences of | 2570 | This function copies @var{instring} and replaces any occurrences of |
| 2571 | @var{fromstring} with @var{tostring}. | 2571 | @var{fromstring} with @var{tostring}. |
| 2572 | @end defun | 2572 | @end defun |
| @@ -1455,7 +1455,7 @@ return status is non-zero. 'process-lines-handling-status' has also | |||
| 1455 | been added, and takes a callback to handle the return status. | 1455 | been added, and takes a callback to handle the return status. |
| 1456 | 1456 | ||
| 1457 | +++ | 1457 | +++ |
| 1458 | *** New function 'replace-in-string'. | 1458 | *** New function 'string-replace'. |
| 1459 | This function works along the line of 'replace-regexp-in-string', but | 1459 | This function works along the line of 'replace-regexp-in-string', but |
| 1460 | matching on strings instead of regexps, and does not change the global | 1460 | matching on strings instead of regexps, and does not change the global |
| 1461 | match state. | 1461 | match state. |
diff --git a/lisp/bindings.el b/lisp/bindings.el index f31c6cc3365..3930f5b52c6 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el | |||
| @@ -493,7 +493,7 @@ mouse-1: Display Line and Column Mode Menu"))) | |||
| 493 | ,@mode-line-position--column-line-properties)) | 493 | ,@mode-line-position--column-line-properties)) |
| 494 | (10 | 494 | (10 |
| 495 | (:propertize | 495 | (:propertize |
| 496 | (:eval (replace-in-string | 496 | (:eval (string-replace |
| 497 | "%c" "%C" (car mode-line-position-column-line-format))) | 497 | "%c" "%C" (car mode-line-position-column-line-format))) |
| 498 | ,@mode-line-position--column-line-properties))) | 498 | ,@mode-line-position--column-line-properties))) |
| 499 | (6 | 499 | (6 |
| @@ -508,7 +508,7 @@ mouse-1: Display Line and Column Mode Menu"))) | |||
| 508 | (,@mode-line-position--column-line-properties))) | 508 | (,@mode-line-position--column-line-properties))) |
| 509 | (6 | 509 | (6 |
| 510 | (:propertize | 510 | (:propertize |
| 511 | (:eval (replace-in-string | 511 | (:eval (string-replace |
| 512 | "%c" "%C" (car mode-line-position-column-format))) | 512 | "%c" "%C" (car mode-line-position-column-format))) |
| 513 | ,@mode-line-position--column-line-properties)))))) | 513 | ,@mode-line-position--column-line-properties)))))) |
| 514 | "Mode line construct for displaying the position in the buffer. | 514 | "Mode line construct for displaying the position in the buffer. |
diff --git a/lisp/subr.el b/lisp/subr.el index 357eae0f505..6f164ae694e 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -4429,7 +4429,7 @@ Unless optional argument INPLACE is non-nil, return a new string." | |||
| 4429 | (aset newstr i tochar))) | 4429 | (aset newstr i tochar))) |
| 4430 | newstr)) | 4430 | newstr)) |
| 4431 | 4431 | ||
| 4432 | (defun replace-in-string (fromstring tostring instring) | 4432 | (defun string-replace (fromstring tostring instring) |
| 4433 | "Replace FROMSTRING with TOSTRING in INSTRING each time it occurs." | 4433 | "Replace FROMSTRING with TOSTRING in INSTRING each time it occurs." |
| 4434 | (declare (pure t)) | 4434 | (declare (pure t)) |
| 4435 | (when (equal fromstring "") | 4435 | (when (equal fromstring "") |
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 505408fa110..a3e9c426db5 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el | |||
| @@ -440,33 +440,33 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350." | |||
| 440 | (should-error (ignore-error foo | 440 | (should-error (ignore-error foo |
| 441 | (read "")))) | 441 | (read "")))) |
| 442 | 442 | ||
| 443 | (ert-deftest replace-in-string () | 443 | (ert-deftest string-replace () |
| 444 | (should (equal (replace-in-string "foo" "bar" "zot") | 444 | (should (equal (string-replace "foo" "bar" "zot") |
| 445 | "zot")) | 445 | "zot")) |
| 446 | (should (equal (replace-in-string "foo" "bar" "foozot") | 446 | (should (equal (string-replace "foo" "bar" "foozot") |
| 447 | "barzot")) | 447 | "barzot")) |
| 448 | (should (equal (replace-in-string "foo" "bar" "barfoozot") | 448 | (should (equal (string-replace "foo" "bar" "barfoozot") |
| 449 | "barbarzot")) | 449 | "barbarzot")) |
| 450 | (should (equal (replace-in-string "zot" "bar" "barfoozot") | 450 | (should (equal (string-replace "zot" "bar" "barfoozot") |
| 451 | "barfoobar")) | 451 | "barfoobar")) |
| 452 | (should (equal (replace-in-string "z" "bar" "barfoozot") | 452 | (should (equal (string-replace "z" "bar" "barfoozot") |
| 453 | "barfoobarot")) | 453 | "barfoobarot")) |
| 454 | (should (equal (replace-in-string "zot" "bar" "zat") | 454 | (should (equal (string-replace "zot" "bar" "zat") |
| 455 | "zat")) | 455 | "zat")) |
| 456 | (should (equal (replace-in-string "azot" "bar" "zat") | 456 | (should (equal (string-replace "azot" "bar" "zat") |
| 457 | "zat")) | 457 | "zat")) |
| 458 | (should (equal (replace-in-string "azot" "bar" "azot") | 458 | (should (equal (string-replace "azot" "bar" "azot") |
| 459 | "bar")) | 459 | "bar")) |
| 460 | 460 | ||
| 461 | (should (equal (replace-in-string "azot" "bar" "foozotbar") | 461 | (should (equal (string-replace "azot" "bar" "foozotbar") |
| 462 | "foozotbar")) | 462 | "foozotbar")) |
| 463 | 463 | ||
| 464 | (should (equal (replace-in-string "\377" "x" "a\377b") | 464 | (should (equal (string-replace "\377" "x" "a\377b") |
| 465 | "axb")) | 465 | "axb")) |
| 466 | (should (equal (replace-in-string "\377" "x" "a\377ø") | 466 | (should (equal (string-replace "\377" "x" "a\377ø") |
| 467 | "axø")) | 467 | "axø")) |
| 468 | 468 | ||
| 469 | (should-error (replace-in-string "" "x" "abc"))) | 469 | (should-error (string-replace "" "x" "abc"))) |
| 470 | 470 | ||
| 471 | (provide 'subr-tests) | 471 | (provide 'subr-tests) |
| 472 | ;;; subr-tests.el ends here | 472 | ;;; subr-tests.el ends here |