From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#36372: 27.0.50; replace-regexp-in-string skips START first chars in return value [PATCH] Date: Wed, 26 Jun 2019 11:31:01 +0200 Message-ID: References: <83tvcdlm8x.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_E6AE78B3-1DCB-460D-9822-BD852A7478A0" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="207237"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 36372@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 26 11:32:11 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hg4Hi-000rmv-Bx for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Jun 2019 11:32:10 +0200 Original-Received: from localhost ([::1]:38048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hg4Hh-0001zd-Ch for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Jun 2019 05:32:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35092) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hg4Hb-0001zL-NS for bug-gnu-emacs@gnu.org; Wed, 26 Jun 2019 05:32:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hg4Ha-0000AY-Qc for bug-gnu-emacs@gnu.org; Wed, 26 Jun 2019 05:32:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48940) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hg4Ha-00009x-96 for bug-gnu-emacs@gnu.org; Wed, 26 Jun 2019 05:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hg4Ha-0000qQ-3V for bug-gnu-emacs@gnu.org; Wed, 26 Jun 2019 05:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Jun 2019 09:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36372 X-GNU-PR-Package: emacs Original-Received: via spool by 36372-submit@debbugs.gnu.org id=B36372.15615414743194 (code B ref 36372); Wed, 26 Jun 2019 09:32:02 +0000 Original-Received: (at 36372) by debbugs.gnu.org; 26 Jun 2019 09:31:14 +0000 Original-Received: from localhost ([127.0.0.1]:34251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hg4Go-0000pS-GQ for submit@debbugs.gnu.org; Wed, 26 Jun 2019 05:31:14 -0400 Original-Received: from mail1428c50.megamailservers.eu ([91.136.14.28]:47906 helo=mail118c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hg4Gl-0000p8-VL for 36372@debbugs.gnu.org; Wed, 26 Jun 2019 05:31:13 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1561541464; bh=ACoYBgA1U+rZxjRSR40SSXF54PvavyzHYRINYY1Vf5w=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=SxBD9550XyV3BFEBhro2/HJU3NqQKoR1TUPIXjFr39jEBgLwxlgiUqaGmUaJnbcZv xcA53XNttClLM+73rFVQ4P9kJULPjvwZSsWNA0fvFk9WO7Lh4IhcJ+J+hOzLUoP5+N fqUter8H6o7fSfKMkUm4q+50PimAhpvHhj2TbAgM= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.1.65] (c-e636e253.032-75-73746f71.bbcust.telenor.se [83.226.54.230]) (authenticated bits=0) by mail118c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x5Q9V2b4025396; Wed, 26 Jun 2019 09:31:03 +0000 In-Reply-To: <83tvcdlm8x.fsf@gnu.org> X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B0210.5D133B58.0057, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=JLcVTfCb c=1 sm=1 tr=0 a=M+GU/qJco4WXjv8D6jB2IA==:117 a=M+GU/qJco4WXjv8D6jB2IA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=mDV3o1hIAAAA:8 a=eEMQBBp6JfhL4kqq34cA:9 a=CjuIK1q_8ugA:10 a=msdtjPRGih3RbnlAbvYA:9 a=B2y7HmGcmWMA:10 a=_FVE-zBwftR9WsbkzFJk:22 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:161467 Archived-At: --Apple-Mail=_E6AE78B3-1DCB-460D-9822-BD852A7478A0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 25 juni 2019 kl. 17.26 skrev Eli Zaretskii : >=20 >> The question is whether it is too late to fix the bug, or if it needs = to be documented. >=20 > Both, I think ;-) Documenting a bug rather than fixing it never feels very satisfactory, = but it may be the lesser evil. What about this patch? --Apple-Mail=_E6AE78B3-1DCB-460D-9822-BD852A7478A0 Content-Disposition: attachment; filename=0001-Document-bug-in-replace-regexp-in-string.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Document-bug-in-replace-regexp-in-string.patch" Content-Transfer-Encoding: quoted-printable =46rom=20d5419cbf491cccb91843b8e3d6270df1c40a9004=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Wed,=2026=20Jun=202019=2011:23:32=20+0200=0A= Subject:=20[PATCH]=20Document=20bug=20in=20`replace-regexp-in-string'=0A=0A= `replace-regexp-in-string'=20omits=20the=20first=20START=20characters=20= of=20the=0Ainput=20string=20in=20its=20return=20value.=20=20This=20is=20= a=20clear=20bug,=20but=20fixing=20it=0Aprobably=20causes=20more=20= trouble;=20document=20the=20behaviour=20instead=20(bug#36372).=0A=0A*=20= doc/lispref/searching.texi=20(Search=20and=20Replace)=0A*=20lisp/subr.el=20= (replace-regexp-in-string):=0ADocument=20current=20behaviour.=0A---=0A=20= doc/lispref/searching.texi=20|=204=20++--=0A=20lisp/subr.el=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20|=203=20++-=0A=202=20files=20changed,=204=20= insertions(+),=203=20deletions(-)=0A=0Adiff=20--git=20= a/doc/lispref/searching.texi=20b/doc/lispref/searching.texi=0Aindex=20= 33455114da..86a907021c=20100644=0A---=20a/doc/lispref/searching.texi=0A= +++=20b/doc/lispref/searching.texi=0A@@=20-1790,8=20+1790,8=20@@=20= Search=20and=20Replace=0A=20This=20function=20copies=20@var{string}=20= and=20searches=20it=20for=20matches=20for=0A=20@var{regexp},=20and=20= replaces=20them=20with=20@var{rep}.=20=20It=20returns=20the=0A=20= modified=20copy.=20=20If=20@var{start}=20is=20non-@code{nil},=20the=20= search=20for=0A-matches=20starts=20at=20that=20index=20in=20= @var{string},=20so=20matches=20starting=0A-before=20that=20index=20are=20= not=20changed.=0A+matches=20starts=20at=20that=20index=20in=20= @var{string},=20and=20the=20returned=20value=0A+does=20not=20include=20= first=20@var{start}=20characters=20of=20@var{string}.=0A=20=0A=20This=20= function=20uses=20@code{replace-match}=20to=20do=20the=20replacement,=20= and=20it=0A=20passes=20the=20optional=20arguments=20@var{fixedcase},=20= @var{literal}=20and=0Adiff=20--git=20a/lisp/subr.el=20b/lisp/subr.el=0A= index=20baff1e909a..ba388b3721=20100644=0A---=20a/lisp/subr.el=0A+++=20= b/lisp/subr.el=0A@@=20-4208,7=20+4208,8=20@@=20replace-regexp-in-string=0A= =20=0A=20Optional=20arguments=20FIXEDCASE,=20LITERAL=20and=20SUBEXP=20= are=20like=20the=0A=20arguments=20with=20the=20same=20names=20of=20= function=20`replace-match'.=20=20If=20START=0A-is=20non-nil,=20start=20= replacements=20at=20that=20index=20in=20STRING.=0A+is=20non-nil,=20start=20= replacements=20at=20that=20index=20in=20STRING.=20=20The=20return=0A= +value=20then=20omits=20the=20first=20START=20characters=20of=20STRING.=0A= =20=0A=20REP=20is=20either=20a=20string=20used=20as=20the=20NEWTEXT=20= arg=20of=20`replace-match'=20or=20a=0A=20function.=20=20If=20it=20is=20a=20= function,=20it=20is=20called=20with=20the=20actual=20text=20of=20each=0A= --=20=0A2.20.1=20(Apple=20Git-117)=0A=0A= --Apple-Mail=_E6AE78B3-1DCB-460D-9822-BD852A7478A0--