From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: Improve `replace-regexp-in-string' ergonomics? Date: Tue, 12 Oct 2021 15:32:27 +0200 Message-ID: <949D1725-26B0-4CDB-B647-C6BC2FEDAC3E@acm.org> References: <878rzpw7jo.fsf@gnus.org> <875yuban9b.fsf@mail.linkov.net> <871r4qalit.fsf@mail.linkov.net> <87h7dme953.fsf@gnus.org> <87r1cqct4f.fsf@gnus.org> <87sfx6bcup.fsf@gnus.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15265"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, Stefan Monnier , Juri Linkov To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 12 15:36:09 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1maHwu-0003jO-Ta for ged-emacs-devel@m.gmane-mx.org; Tue, 12 Oct 2021 15:36:08 +0200 Original-Received: from localhost ([::1]:43924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1maHwt-0006By-Ad for ged-emacs-devel@m.gmane-mx.org; Tue, 12 Oct 2021 09:36:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maHtY-00041n-E4 for emacs-devel@gnu.org; Tue, 12 Oct 2021 09:32:40 -0400 Original-Received: from mail1471c50.megamailservers.eu ([91.136.14.71]:52766 helo=mail102c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maHtT-0002oh-G4 for emacs-devel@gnu.org; Tue, 12 Oct 2021 09:32:39 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1634045551; bh=uNUKvCMveHhWa+FMDzp0PMwg66a8r9fpFJO473nj8V4=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=aTp4KqVQ8UZ9g67fyzY+g17KwBi0Z3VSgVDBbpY9ek04mHZFZmOUMgmG13FxHwlOO Ugx0RTyLUVeYtsm3LHN8MzKr2YitSejOor123P6hq9F6zGY6rUCtJmgy89OQ1J0dap 5r9IopnEtm737K83h9Vs7J2frG1j7pCGfPmdD+5I= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail102c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 19CDWSix032515; Tue, 12 Oct 2021 13:32:29 +0000 In-Reply-To: <87sfx6bcup.fsf@gnus.org> X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F16.61658E6F.002D, 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.4 cv=acUCITkt c=1 sm=1 tr=0 ts=61658e6f a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=Pblm_MkVmrSY991Wu18A:9 a=CjuIK1q_8ugA:10 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.14.71; envelope-from=mattiase@acm.org; helo=mail102c50.megamailservers.eu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:276800 Archived-At: > you just > have to transpose the groups down to where they were again before = doing > the replacement. We don't even need transposing the match state at run time; we can just = as well do the transposing in the replacement string templates at = macro-expansion time. If those exceed the syntactic limits of group 9, = then generate Lisp code as mentioned before. Don't do more at runtime = than actually required. Transposing the match state is only necessary when the user uses actual = Lisp code for the replacement. Even that can be avoided by passing the = group number offset as an argument to the user code -- I did that in one = instance (although I recall Stefan didn't quite fancy it).