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 Date: Tue, 25 Jun 2019 14:01:49 +0200 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="82865"; mail-complaints-to="usenet@blaine.gmane.org" To: 36372@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 25 14:50:03 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 1hfkte-000LOI-22 for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Jun 2019 14:50:02 +0200 Original-Received: from localhost ([::1]:59896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfktc-0007Af-Ud for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Jun 2019 08:50:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44308) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfkkx-0008Sd-OH for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 08:41:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hfkkw-0003aY-OE for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 08:41:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45332) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hfkkw-0003aQ-KJ for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 08:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hfkkw-0007fP-CE for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 08:41: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: Tue, 25 Jun 2019 12:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36372 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.156146642029414 (code B ref -1); Tue, 25 Jun 2019 12:41:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Jun 2019 12:40:20 +0000 Original-Received: from localhost ([127.0.0.1]:58876 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfkkG-0007eM-CP for submit@debbugs.gnu.org; Tue, 25 Jun 2019 08:40:20 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:48624) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfkkD-0007eE-PB for submit@debbugs.gnu.org; Tue, 25 Jun 2019 08:40:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44062) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfkkB-0007mx-N5 for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 08:40:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hfkkA-0002o4-IH for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 08:40:15 -0400 Original-Received: from mail1430c50.megamailservers.eu ([91.136.14.30]:48288 helo=mail118c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hfkk9-0002lR-Vo for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 08:40:14 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1561464111; bh=1mgz+NPMyEylJgMIPFIvhUxCM0EzDgPa7ocsXOsDsPM=; h=From:Subject:Date:To:From; b=p8qMtXg44sOiS+Paobd/LSTu8PFKkCb4AoKcFu6xsTDL0npHLj6cQlQ0N0LUP70/u DjVRkisncKntFRaJ2KPF7rQc/ME+CGUxJKx2tQ055I4geZfA6tBr83NQcWPfkRyozl 83VJdRtQ3u8N744BlT59/H2SzmRw6vdEUgM4VBFc= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] ([188.150.171.71]) (authenticated bits=0) by mail118c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x5PC1oiI009710 for ; Tue, 25 Jun 2019 12:01:51 +0000 X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B0201.5D120D2F.0060, 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=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=IkcTkHD0fZMA:10 a=M6lMmiwvbBaVFJyVF6wA:9 a=QEXdDO2ut3YA:10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] 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:161347 Archived-At: =46rom the doc string and the manual, the call (replace-regexp-in-string "a" "X" "abcab" t t nil 2) would be expected to return "abcXb" but the actual return value is "cXb" This was probably not intended. The manual text is This function copies STRING and searches it for matches for REGEXP, and replaces them with REP. It returns the modified copy. If START is non-=E2=80=98nil=E2=80=99, the search for matches starts at = that index in STRING, so matches starting before that index are not changed. The question is whether it is too late to fix the bug, or if it needs to = be documented. `string-match' + `replace-match' work as expected: (let ((s "abcab")) (string-match "a" s 2) (replace-match "X" t t s)) =3D> "abcXb" Bug#15107 is somewhat related.