aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias EngdegÄrd2019-06-26 11:23:32 +0200
committerMattias EngdegÄrd2019-06-26 19:39:32 +0200
commitcda2f52b94a5a94566c668835f1c4964f4d93b2b (patch)
treeb14ec0bc321d84c13a7a0c7fc32f6bdc312e9a5a
parent85871ae9ceb7a87c49f735b2b3c5b4e017e25139 (diff)
downloademacs-cda2f52b94a5a94566c668835f1c4964f4d93b2b.tar.gz
emacs-cda2f52b94a5a94566c668835f1c4964f4d93b2b.zip
Document bug in `replace-regexp-in-string'
`replace-regexp-in-string' omits the first START characters of the input string in its return value. This is a clear bug, but fixing it probably causes more trouble; document the behaviour instead (bug#36372). * doc/lispref/searching.texi (Search and Replace) * lisp/subr.el (replace-regexp-in-string): Document current behaviour.
-rw-r--r--doc/lispref/searching.texi6
-rw-r--r--lisp/subr.el3
2 files changed, 6 insertions, 3 deletions
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 33455114dac..ef1cffc446f 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -1790,8 +1790,10 @@ this.
1790This function copies @var{string} and searches it for matches for 1790This function copies @var{string} and searches it for matches for
1791@var{regexp}, and replaces them with @var{rep}. It returns the 1791@var{regexp}, and replaces them with @var{rep}. It returns the
1792modified copy. If @var{start} is non-@code{nil}, the search for 1792modified copy. If @var{start} is non-@code{nil}, the search for
1793matches starts at that index in @var{string}, so matches starting 1793matches starts at that index in @var{string}, and the returned value
1794before that index are not changed. 1794does not include the first @var{start} characters of @var{string}.
1795To get the whole transformed string, concatenate the first
1796@var{start} characters of @var{string} with the return value.
1795 1797
1796This function uses @code{replace-match} to do the replacement, and it 1798This function uses @code{replace-match} to do the replacement, and it
1797passes the optional arguments @var{fixedcase}, @var{literal} and 1799passes the optional arguments @var{fixedcase}, @var{literal} and
diff --git a/lisp/subr.el b/lisp/subr.el
index baff1e909a1..b981af6afe6 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4208,7 +4208,8 @@ Return a new string containing the replacements.
4208 4208
4209Optional arguments FIXEDCASE, LITERAL and SUBEXP are like the 4209Optional arguments FIXEDCASE, LITERAL and SUBEXP are like the
4210arguments with the same names of function `replace-match'. If START 4210arguments with the same names of function `replace-match'. If START
4211is non-nil, start replacements at that index in STRING. 4211is non-nil, start replacements at that index in STRING, and omit
4212the first START characters of STRING from the return value.
4212 4213
4213REP is either a string used as the NEWTEXT arg of `replace-match' or a 4214REP is either a string used as the NEWTEXT arg of `replace-match' or a
4214function. If it is a function, it is called with the actual text of each 4215function. If it is a function, it is called with the actual text of each