From unknown Fri Jun 20 07:09:17 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#12622 <12622@debbugs.gnu.org> To: bug#12622 <12622@debbugs.gnu.org> Subject: Status: replace-regexp-in-string Reply-To: bug#12622 <12622@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:09:17 +0000 retitle 12622 replace-regexp-in-string reassign 12622 emacs submitter 12622 Andreas R=C3=B6hler severity 12622 normal tag 12622 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 11 10:18:47 2012 Received: (at submit) by debbugs.gnu.org; 11 Oct 2012 14:18:47 +0000 Received: from localhost ([127.0.0.1]:39572 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMJb2-0003wm-67 for submit@debbugs.gnu.org; Thu, 11 Oct 2012 10:18:46 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52070) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMJay-0003wW-Sw for submit@debbugs.gnu.org; Thu, 11 Oct 2012 10:18:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TMJa5-0001BZ-1X for submit@debbugs.gnu.org; Thu, 11 Oct 2012 10:17:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, TRACKER_ID autolearn=ham version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:46840) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMJa4-0001BV-UZ for submit@debbugs.gnu.org; Thu, 11 Oct 2012 10:17:44 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMJZz-0005dN-6c for bug-gnu-emacs@gnu.org; Thu, 11 Oct 2012 10:17:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TMJZv-0001A6-4L for bug-gnu-emacs@gnu.org; Thu, 11 Oct 2012 10:17:39 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:63765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMJZu-00019E-R5 for bug-gnu-emacs@gnu.org; Thu, 11 Oct 2012 10:17:35 -0400 Received: from [192.168.178.27] (brln-4d0c3908.pool.mediaWays.net [77.12.57.8]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0LrsY2-1TVUvK3s90-0135yN; Thu, 11 Oct 2012 16:17:33 +0200 Message-ID: <5076D4F4.2020404@easy-emacs.de> Date: Thu, 11 Oct 2012 16:17:24 +0200 From: =?ISO-8859-15?Q?Andreas_R=F6hler?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120825 Thunderbird/15.0 MIME-Version: 1.0 To: bug-gnu-emacs@gnu.org Subject: replace-regexp-in-string Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:tDS4qQxDnAZlj4+iUPulvaCgWx2Msx/4zCtD3L/qE6G OKYjoKLxBGI0Zt6sMSp+Cl9tmMTSiA0/x5+k8e0TRKVBo0DCcl eWFYBoMLFzBXLU+Hk7t2bR05j2kz2asUL7bsl24PRc45cUWTET Fk9ciS8Wlyfo9Eo4WQpgoNmI+YV7QmrqZlHBjJYb6ggceoYwXj u+Dpuf5gubgJ7lJN7yTAl+UMpxFQ4h3Aw1JOf4UWQBOG9Wfxe9 RR+nbwYoE08gzGpQMy6XUJOKTRIrzCjfkDcW193aLbbLvH1tSg S0BRnc9yi03sAfEv9O7L/kFq39/gsugWuAD7KI49bfXbmvFnxy SvOsA4y+CmiUs5oWytfzQf/5V66kHJrXZ7hoWm/ec X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) Hi, the following question was raised at: http://stackoverflow.com/questions/12809610/replace-regexp-in-string-with-lookahead-behind I'd like to replace all occurrences of \w \w with \w\\\w in a string, where the \w parts stay the same before and after the replacement, e.g. [.A foobar] [.B baz] should result in [.A\\foobar] [.B\\baz] ;;;;;;;;;; this might be solved in buffer by (while (re-search-forward "\\_<\\w+\\_>" nil t 1) (replace-match (concat "\\\\\\\\" (match-string-no-properties 0) ))) Also would expect a respective form working with replace-regexp-in-string (setq mystring "[.A foobar] [.B baz]") (replace-regexp-in-string "\\_<\\w+\\_>" (concat "\\\\" (match-string-no-properties 0) ) mystring) but it fails. When commenting "(match-string 0 str)" as follows it subr.el it works (setq matches (cons (replace-match (if (stringp rep) rep (funcall rep ;; (match-string 0 str) )) fixedcase literal str subexp) Which has some plausibility: when receiving a user-specified function, there must not be that argument. Maybe have a look, Best, Andreas From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 11 10:44:54 2012 Received: (at 12622) by debbugs.gnu.org; 11 Oct 2012 14:44:55 +0000 Received: from localhost ([127.0.0.1]:39601 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMK0M-0004Yn-Al for submit@debbugs.gnu.org; Thu, 11 Oct 2012 10:44:54 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:38569) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMK0J-0004Ye-Ak for 12622@debbugs.gnu.org; Thu, 11 Oct 2012 10:44:53 -0400 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3Xcw113XZYz3hhff; Thu, 11 Oct 2012 16:44:04 +0200 (CEST) X-Auth-Info: qpkf4y8L0VS4YnOzHh2X19wjBuoKpQGnEABNN9L2okQ= Received: from igel.home (ppp-88-217-111-196.dynamic.mnet-online.de [88.217.111.196]) by mail.mnet-online.de (Postfix) with ESMTPA id 3Xcw103n05zbbgj; Thu, 11 Oct 2012 16:44:04 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id F3348CA2A4; Thu, 11 Oct 2012 16:44:03 +0200 (CEST) From: Andreas Schwab To: Andreas =?utf-8?Q?R=C3=B6hler?= Subject: Re: bug#12622: replace-regexp-in-string References: <5076D4F4.2020404@easy-emacs.de> X-Yow: I'm not available for comment.. Date: Thu, 11 Oct 2012 16:44:03 +0200 In-Reply-To: <5076D4F4.2020404@easy-emacs.de> ("Andreas =?utf-8?Q?R=C3=B6h?= =?utf-8?Q?ler=22's?= message of "Thu, 11 Oct 2012 16:17:24 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 12622 Cc: 12622@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) Andreas R=C3=B6hler writes: > Also would expect a respective form working with replace-regexp-in-stri= ng > > (setq mystring "[.A foobar] [.B baz]") > (replace-regexp-in-string "\\_<\\w+\\_>" (concat "\\\\" (match-string-= no-properties 0) ) mystring) > > but it fails. Fails in which way? What do you expect, and what do you get? > When commenting "(match-string 0 str)" as follows it subr.el it works > > (setq matches > (cons (replace-match (if (stringp rep) > rep > (funcall rep > ;; (match-string 0 str) > )) > fixedcase literal str subexp) > > Which has some plausibility: when receiving a user-specified function, = there must not be that argument. Why? That's what the doc string documents. Andreas. --=20 Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED= 5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 11 12:39:05 2012 Received: (at 12622) by debbugs.gnu.org; 11 Oct 2012 16:39:05 +0000 Received: from localhost ([127.0.0.1]:39710 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMLmr-0007AB-9o for submit@debbugs.gnu.org; Thu, 11 Oct 2012 12:39:05 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:65221) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMLmn-00079g-B3 for 12622@debbugs.gnu.org; Thu, 11 Oct 2012 12:39:02 -0400 Received: from [192.168.178.27] (brln-4d0c3908.pool.mediaWays.net [77.12.57.8]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MdWxQ-1T1Myh47QK-00Q01H; Thu, 11 Oct 2012 18:38:09 +0200 Message-ID: <5076F5E8.8090205@easy-emacs.de> Date: Thu, 11 Oct 2012 18:38:00 +0200 From: =?UTF-8?B?QW5kcmVhcyBSw7ZobGVy?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120825 Thunderbird/15.0 MIME-Version: 1.0 To: Andreas Schwab Subject: Re: bug#12622: replace-regexp-in-string References: <5076D4F4.2020404@easy-emacs.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:CxG9CAvQ0ozhDetex1vg8oSWpdeL3+/2s/dSYvlIzon YNiTNk4FTbBqcJfQHV9/E/ZcK3ovukB9+gnSBiQJqe4Pg+n2yq wmIvFDS4gkwslVsEis3vYUJUUG2sD2CnlFqxIYDX9VHsAiRmUu Iu1bMuAAfiLiSLqU9osNgZOOvf/UMJ+GkX9UMESqkgCYlWGvH4 dLZ7cy8Tc3+hk/A6ASsqdSqhcBdsUm8lVPzKjWW4gcuLdJuS3V Cu5aFmelwXJDP+c1Fq9wWlpMTAnrTzLbqZgzFvpqeJ8O0JVSMp ZBwauY66ZNn1TFfEHLgYVsAVNu8tKZ2f6sjmWuzPxyD3q1zUCT Hcdz9roOixa3dgPaFKwj10LGD7RyVjBHbhm3Sz/0Z X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 12622 Cc: 12622@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) Am 11.10.2012 16:44, schrieb Andreas Schwab: > Andreas Röhler writes: > >> Also would expect a respective form working with replace-regexp-in-string >> >> (setq mystring "[.A foobar] [.B baz]") >> (replace-regexp-in-string "\\_<\\w+\\_>" (concat "\\\\" (match-string-no-properties 0) ) mystring) >> >> but it fails. > > Fails in which way? What do you expect, and what do you get? > >> When commenting "(match-string 0 str)" as follows it subr.el it works >> >> (setq matches >> (cons (replace-match (if (stringp rep) >> rep >> (funcall rep >> ;; (match-string 0 str) >> )) >> fixedcase literal str subexp) >> >> Which has some plausibility: when receiving a user-specified function, there must not be that argument. > > Why? That's what the doc string documents. > > Andreas. > (setq mystring "[.A foobar] [.B baz]") ;; works nice in buffer (while (re-search-forward "\\_<\\w+\\_>" nil t 1) (replace-match (concat "\\\\\\\\" (match-string-no-properties 0) ))) ==> [.A \\foobar] [.B \\baz] has unpredictable results (setq mystring "[.A foobar] [.B baz]") (replace-regexp-in-string "\\_<\\w+\\_>" (concat "\\\\" (match-string-no-properties 0)) mystring) ==> "[.A \\ext in that fi] [.B \\ext in that fi]" for example, Docstring says: "If it is a function, it is called with the actual text of each match, and its value is used as the replacement text." Which is not the case AFAIS. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 11 12:53:37 2012 Received: (at 12622) by debbugs.gnu.org; 11 Oct 2012 16:53:37 +0000 Received: from localhost ([127.0.0.1]:39738 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMM0u-0007UU-G4 for submit@debbugs.gnu.org; Thu, 11 Oct 2012 12:53:36 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:37646) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMM0s-0007UM-QK for 12622@debbugs.gnu.org; Thu, 11 Oct 2012 12:53:35 -0400 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3XcysX3rNYz3hhff; Thu, 11 Oct 2012 18:52:46 +0200 (CEST) X-Auth-Info: oLdRSyU1n4G/gsLW2bRaGdRPJ5Z7jsvOoZNzrcauu7Y= Received: from igel.home (ppp-88-217-111-196.dynamic.mnet-online.de [88.217.111.196]) by mail.mnet-online.de (Postfix) with ESMTPA id 3XcysV6YS7zbbcl; Thu, 11 Oct 2012 18:52:46 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id 9E4D5CA2A4; Thu, 11 Oct 2012 18:52:46 +0200 (CEST) From: Andreas Schwab To: Andreas =?utf-8?Q?R=C3=B6hler?= Subject: Re: bug#12622: replace-regexp-in-string References: <5076D4F4.2020404@easy-emacs.de> <5076F5E8.8090205@easy-emacs.de> X-Yow: Is it FUN to be a MIDGET? Date: Thu, 11 Oct 2012 18:52:46 +0200 In-Reply-To: <5076F5E8.8090205@easy-emacs.de> ("Andreas =?utf-8?Q?R=C3=B6h?= =?utf-8?Q?ler=22's?= message of "Thu, 11 Oct 2012 18:38:00 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 12622 Cc: 12622@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) Andreas R=C3=B6hler writes: > (setq mystring "[.A foobar] [.B baz]") > (replace-regexp-in-string "\\_<\\w+\\_>" (concat "\\\\" (match-string-n= o-properties 0)) mystring) =3D=3D> > > "[.A \\ext in that fi] [.B \\ext in that fi]" > > for example, > > Docstring says: > > "If it is a function, it is called with the actual text of each > match, and its value is used as the replacement text." > > Which is not the case AFAIS. You are not passing a function. Andreas. --=20 Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED= 5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 12 02:33:47 2012 Received: (at 12622) by debbugs.gnu.org; 12 Oct 2012 06:33:48 +0000 Received: from localhost ([127.0.0.1]:40223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMYod-0002Sq-2K for submit@debbugs.gnu.org; Fri, 12 Oct 2012 02:33:47 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:58867) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMYoZ-0002Sc-CT for 12622@debbugs.gnu.org; Fri, 12 Oct 2012 02:33:45 -0400 Received: from [192.168.178.27] (brln-4dbc72e7.pool.mediaWays.net [77.188.114.231]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0LaeOS-1Toyfe486q-00kO2r; Fri, 12 Oct 2012 08:32:47 +0200 Message-ID: <5077B987.2060100@easy-emacs.de> Date: Fri, 12 Oct 2012 08:32:39 +0200 From: =?UTF-8?B?QW5kcmVhcyBSw7ZobGVy?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120825 Thunderbird/15.0 MIME-Version: 1.0 To: Andreas Schwab Subject: Re: bug#12622: replace-regexp-in-string References: <5076D4F4.2020404@easy-emacs.de> <5076F5E8.8090205@easy-emacs.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:/AwhokIbEsKvQLe9TEyld9sZFoLV4xNbBeImysdP+be cWdEthG4OsIObiZ7m34+uVycOeh5Bm41jodE0QkQUIgB9nh6FK RxRSQH8ZsmV3xkzn1kaZeedFgkSIdVT2rpbYRcGpPqokIiXqbL KnkVFYquxt5AB/SBAUt6VCm+q+gWiiN03Db1n1O867A9juZuUa ksfJNzMNF1cnSnxfWK4GrUWyPKS0+juI0DTNtxoY2249Mjv2l7 JmTUTFid2NyxG8HKoSwEkxsrkfgda3KSZnLYlNh41hCF6FP0F1 U5fIYTNpr8CRopYfTn4kOd/gl23RjmswHS1Sjh7m9HjdSCjwEO G6rslnANFuwUSor0pDlzauuhZqEIRNJfRhoT712on X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 12622 Cc: 12622@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) Am 11.10.2012 18:52, schrieb Andreas Schwab: > Andreas Röhler writes: > >> (setq mystring "[.A foobar] [.B baz]") >> (replace-regexp-in-string "\\_<\\w+\\_>" (concat "\\\\" (match-string-no-properties 0)) mystring) ==> >> >> "[.A \\ext in that fi] [.B \\ext in that fi]" >> >> for example, >> >> Docstring says: >> >> "If it is a function, it is called with the actual text of each >> match, and its value is used as the replacement text." >> >> Which is not the case AFAIS. > > You are not passing a function. > > Andreas. > okay. that works: (replace-regexp-in-string "\\_<\\w+\\_>" (lambda (x) (concat "\\\\" x)) mystring) Nonetheless consider it a design flaw, us it requires a argument taking function, where a expression just to evaluate would suffice. Andreas From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 12 02:35:21 2012 Received: (at control) by debbugs.gnu.org; 12 Oct 2012 06:35:21 +0000 Received: from localhost ([127.0.0.1]:40227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMYq7-0002VM-1T for submit@debbugs.gnu.org; Fri, 12 Oct 2012 02:35:19 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:35805 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMYq4-0002VE-IO for control@debbugs.gnu.org; Fri, 12 Oct 2012 02:35:17 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1TMYpH-0005vY-LB for control@debbugs.gnu.org; Fri, 12 Oct 2012 02:34:27 -0400 Date: Fri, 12 Oct 2012 02:34:27 -0400 Message-Id: Subject: control message for bug 12622 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.3 (------) tag 12622 notabug close 12622 From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 12 04:15:39 2012 Received: (at 12622-done) by debbugs.gnu.org; 12 Oct 2012 08:15:39 +0000 Received: from localhost ([127.0.0.1]:40308 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMaPD-0006Su-0o for submit@debbugs.gnu.org; Fri, 12 Oct 2012 04:15:39 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:47631) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMaPB-0006Sm-CC for 12622-done@debbugs.gnu.org; Fri, 12 Oct 2012 04:15:38 -0400 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3XdMKM4TSXz3hhhy for <12622-done@debbugs.gnu.org>; Fri, 12 Oct 2012 10:14:47 +0200 (CEST) X-Auth-Info: dS0wFCRbN4jwMV73MGIKTW64/md0KtOLxulScG/vn7Y= Received: from igel.home (ppp-93-104-154-49.dynamic.mnet-online.de [93.104.154.49]) by mail.mnet-online.de (Postfix) with ESMTPA id 3XdMKM24LbzbbjK for <12622-done@debbugs.gnu.org>; Fri, 12 Oct 2012 10:14:47 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id C7B29CA2A4; Fri, 12 Oct 2012 10:14:46 +0200 (CEST) From: Andreas Schwab To: 12622-done@debbugs.gnu.org Subject: Re: bug#12622: replace-regexp-in-string References: <5076D4F4.2020404@easy-emacs.de> <5076F5E8.8090205@easy-emacs.de> <5077B987.2060100@easy-emacs.de> X-Yow: A shapely CATHOLIC SCHOOLGIRL is FIDGETING inside my costume.. Date: Fri, 12 Oct 2012 10:14:45 +0200 In-Reply-To: <5077B987.2060100@easy-emacs.de> ("Andreas =?utf-8?Q?R=C3=B6h?= =?utf-8?Q?ler=22's?= message of "Fri, 12 Oct 2012 08:32:39 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 12622-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.0 (/) Not a bug. From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 12 10:23:05 2012 Received: (at 12622) by debbugs.gnu.org; 12 Oct 2012 14:23:05 +0000 Received: from localhost ([127.0.0.1]:41133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMg8n-0007XS-Gz for submit@debbugs.gnu.org; Fri, 12 Oct 2012 10:23:05 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:13137) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMg8m-0007Wz-37 for 12622@debbugs.gnu.org; Fri, 12 Oct 2012 10:23:04 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09FxLQG/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA0kiBwFugmQRAOjM4FYgwU X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="201265665" Received: from 69-196-180-6.dsl.teksavvy.com (HELO pastel.home) ([69.196.180.6]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 12 Oct 2012 10:22:07 -0400 Received: by pastel.home (Postfix, from userid 20848) id 8B85759519; Fri, 12 Oct 2012 10:22:07 -0400 (EDT) From: Stefan Monnier To: Andreas =?iso-8859-1?Q?R=F6hler?= Subject: Re: bug#12622: replace-regexp-in-string Message-ID: References: <5076D4F4.2020404@easy-emacs.de> <5076F5E8.8090205@easy-emacs.de> <5077B987.2060100@easy-emacs.de> Date: Fri, 12 Oct 2012 10:22:06 -0400 In-Reply-To: <5077B987.2060100@easy-emacs.de> ("Andreas =?iso-8859-1?Q?R?= =?iso-8859-1?Q?=F6hler=22's?= message of "Fri, 12 Oct 2012 08:32:39 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 12622 Cc: 12622@debbugs.gnu.org, Andreas Schwab X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) > Nonetheless consider it a design flaw, us it requires a argument taking > function, where a expression just to evaluate would suffice. You need some way to distinguish "here's an expression that will return the string that needs to be passed as argument" from "here's the expression that needs to be passed as argument, to be evaluated later in each iteration of the loop". The distinction is made by wrapping the expression in a `lambda'. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 12 12:08:47 2012 Received: (at 12622) by debbugs.gnu.org; 12 Oct 2012 16:08:47 +0000 Received: from localhost ([127.0.0.1]:41246 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMhn4-0001ZE-Pj for submit@debbugs.gnu.org; Fri, 12 Oct 2012 12:08:46 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:59591) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMhn2-0001Z2-Re for 12622@debbugs.gnu.org; Fri, 12 Oct 2012 12:08:46 -0400 Received: from [192.168.178.27] (brln-4dbc72e7.pool.mediaWays.net [77.188.114.231]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0Mczwc-1T5aay2YNu-00IcV1; Fri, 12 Oct 2012 18:07:44 +0200 Message-ID: <50784042.7000104@easy-emacs.de> Date: Fri, 12 Oct 2012 18:07:30 +0200 From: =?ISO-8859-15?Q?Andreas_R=F6hler?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120825 Thunderbird/15.0 MIME-Version: 1.0 To: Stefan Monnier Subject: Re: bug#12622: replace-regexp-in-string References: <5076D4F4.2020404@easy-emacs.de> <5076F5E8.8090205@easy-emacs.de> <5077B987.2060100@easy-emacs.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:R5Hom5NXD6aKYxibjg3ZCNEsyw2mNRzUDtTOzKcjQTw rvVRZTt9ccFwKZET5xBOtOFoGk2KnlLZjVDYFW3Z3zwQiuKrHJ 5orjlua6zgqPHg+7hRnetxrucin+dqZO9GNazDLJrSofs6jDpf HtHL1wORCGDOLCCpR66joXiNJgY/tZ2J2k5/w91/I+7vAmPBLc xKa8dP85+4gRtN6tYFsL9NLxvMz35znb5Jtpr1oOVzHq/p7NEC O1KsM9JNHYziT0UYYCNs31yOt5OoY9DGjZBjD/PRokSbDAtndQ zNBMVUh5kilQRcxIp0weKBb6B52zPF79rXkIHljyyiCrMFAtC9 yqi3UrKSLL/02QWeJ2UERB2/Zyw3JffoS6cOTCXBI X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 12622 Cc: 12622@debbugs.gnu.org, Andreas Schwab X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) Am 12.10.2012 16:22, schrieb Stefan Monnier: >> Nonetheless consider it a design flaw, us it requires a argument taking >> function, where a expression just to evaluate would suffice. > > You need some way to distinguish "here's an expression that will return > the string that needs to be passed as argument" from "here's the > expression that needs to be passed as argument, to be evaluated later in > each iteration of the loop". The distinction is made by wrapping the > expression in a `lambda'. > > > Stefan > will keep that under my pillow :) back to the question: what about writing here instead (funcall rep (match-string 0 str))) just (eval rep) i.e. let the user decide how to construct, if not delivered a regexp as string Best, Andreas From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 12 14:13:30 2012 Received: (at 12622) by debbugs.gnu.org; 12 Oct 2012 18:13:30 +0000 Received: from localhost ([127.0.0.1]:41339 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMjjm-0004QU-7c for submit@debbugs.gnu.org; Fri, 12 Oct 2012 14:13:30 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:34082) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMjjj-0004QM-Lv for 12622@debbugs.gnu.org; Fri, 12 Oct 2012 14:13:28 -0400 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q9CICYpT023539; Fri, 12 Oct 2012 14:12:34 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 84C78B40A1; Fri, 12 Oct 2012 14:12:34 -0400 (EDT) From: Stefan Monnier To: Andreas =?iso-8859-1?Q?R=F6hler?= Subject: Re: bug#12622: replace-regexp-in-string Message-ID: References: <5076D4F4.2020404@easy-emacs.de> <5076F5E8.8090205@easy-emacs.de> <5077B987.2060100@easy-emacs.de> <50784042.7000104@easy-emacs.de> Date: Fri, 12 Oct 2012 14:12:34 -0400 In-Reply-To: <50784042.7000104@easy-emacs.de> ("Andreas =?iso-8859-1?Q?R?= =?iso-8859-1?Q?=F6hler=22's?= message of "Fri, 12 Oct 2012 18:07:30 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4369=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4369> : streams <836871> : uri <1241789> X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 12622 Cc: 12622@debbugs.gnu.org, Andreas Schwab X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.8 (---) > (eval rep) `eval' is evil and should be avoided when possible (typically replaced by `funcall'). Of course, in this case, `rep' is always a value anyway, because all the arguments of a call are always evaluated before entering the body of the function (at least in Elisp, which uses "eager" or "strict" or "applicative order" evaluation) so there's nothing left to evaluate. Stefan From unknown Fri Jun 20 07:09:17 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 10 Nov 2012 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator