From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: Returning argument string (regexp-quote) Date: Wed, 25 Sep 2019 15:41:28 +0200 Message-ID: <4FAEE347-0F67-426F-AA0D-3DB15E3907DC@acm.org> References: <83sgoloedi.fsf@gnu.org> <658AF539-1AE7-459D-94C7-44970AA94EEF@acm.org> <83impho4s8.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_72EB9638-B426-4250-8373-3AD1AB7A883A" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="247410"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Paul Eggert , emacs-devel To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 25 15:42:44 2019 Return-path: Envelope-to: ged-emacs-devel@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 1iD7Z5-0012DD-C4 for ged-emacs-devel@m.gmane.org; Wed, 25 Sep 2019 15:42:43 +0200 Original-Received: from localhost ([::1]:51714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD7Z4-0008Qk-0b for ged-emacs-devel@m.gmane.org; Wed, 25 Sep 2019 09:42:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42030) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iD7YC-0007q2-Hu for emacs-devel@gnu.org; Wed, 25 Sep 2019 09:41:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iD7Y9-0007xE-Je for emacs-devel@gnu.org; Wed, 25 Sep 2019 09:41:48 -0400 Original-Received: from mail204c50.megamailservers.eu ([91.136.10.214]:57666 helo=mail193c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iD7Y7-0007vl-9p; Wed, 25 Sep 2019 09:41:43 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1569418891; bh=Q4Z2e9bUhUhNtG6ej0l83JcCaJ8zT4feIdVGHXa/gL8=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=LjUVpk5XF+H82WWlB+5a6SoLsj57sTQ9tP+j58Zi0CvJmfxt/QaGko8inCRMGYCA2 GtS0hFFF7RbRmrX83qxmD+9J7d/mtJFGj+IDKHEPhYVxyujkylrKQJI7/F2KCQfQEp YacyGtkU4NU8+P+v0OsLFqUpniKkYoUGy+lleKX4= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] ([188.150.171.71]) (authenticated bits=0) by mail193c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x8PDfSuT020743; Wed, 25 Sep 2019 13:41:30 +0000 In-Reply-To: <83impho4s8.fsf@gnu.org> X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B0203.5D8B6E8B.0002, 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=b7vMHeOx c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=M51BFTxLslgA:10 a=mDV3o1hIAAAA:8 a=vKojWfRZmydpyrX_g7YA:9 a=CjuIK1q_8ugA:10 a=DxDq_KAd1cbsMc_kjvgA:9 a=B2y7HmGcmWMA:10 a=_FVE-zBwftR9WsbkzFJk:22 a=pHzHmUro8NiASowvMSCR:22 a=Ew2E2A-JSTLzCXPT_086:22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.136.10.214 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:240287 Archived-At: --Apple-Mail=_72EB9638-B426-4250-8373-3AD1AB7A883A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 24 sep. 2019 kl. 21.47 skrev Eli Zaretskii : >=20 >> It was responsible for a sizeable portion of local consing in some = (non-public) code I was profiling. >=20 > "Sizable portion" meaning what, in quantitative terms? I no longer have the data, maybe 25-40% in the part of the code that I = was looking at. It's not uncommon to use 'regexp-quote' just in case. > I think it should be in NEWS and in the ELisp manual. Doc string > doesn't necessarily have to say that (although it isn't a catastrophe > if it does), given its current language. Thanks -- the updated patch includes NEWS and manual amendments, as well = as a slightly simplified condition. The manual didn't actually say = anything about a new string being returned (in contrast to 'format' = before 3db388b0bf), but a note about it won't hurt. --Apple-Mail=_72EB9638-B426-4250-8373-3AD1AB7A883A Content-Disposition: attachment; filename=0001-Allow-regexp-quote-to-return-its-argument.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Allow-regexp-quote-to-return-its-argument.patch" Content-Transfer-Encoding: quoted-printable =46rom=2095dd4e043ea4635c44b656d0145c6bb67408e47f=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Mon,=2023=20Sep=202019=2018:56:30=20+0200=0A= Subject:=20[PATCH]=20Allow=20regexp-quote=20to=20return=20its=20argument=0A= =0A*=20src/search.c=20(Fregexp_quote):=20Only=20allocate=20a=20new=20= string=20if=20needed.=0A---=0A=20doc/lispref/searching.texi=20|=20=203=20= +++=0A=20etc/NEWS=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= |=20=204=20++++=0A=20src/search.c=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20|=2010=20++++++----=0A=203=20files=20changed,=2013=20insertions(+),=20= 4=20deletions(-)=0A=0Adiff=20--git=20a/doc/lispref/searching.texi=20= b/doc/lispref/searching.texi=0Aindex=20015871fab0..a4b6533412=20100644=0A= ---=20a/doc/lispref/searching.texi=0A+++=20b/doc/lispref/searching.texi=0A= @@=20-1717,6=20+1717,9=20@@=20Regexp=20Functions=0A=20=20(concat=20= "\\s-"=20(regexp-quote=20string)=20"\\s-"))=0A=20@end=20group=0A=20@end=20= example=0A+=0A+The=20returned=20string=20may=20be=20@var{string}=20= itself=20if=20it=20does=20not=20contain=0A+any=20special=20characters.=0A= =20@end=20defun=0A=20=0A=20@cindex=20optimize=20regexp=0Adiff=20--git=20= a/etc/NEWS=20b/etc/NEWS=0Aindex=203f7d4894df..49d733b8ac=20100644=0A---=20= a/etc/NEWS=0A+++=20b/etc/NEWS=0A@@=20-2156,6=20+2156,10=20@@=20valid=20= event=20type.=0A=20---=0A=20**=20The=20obsolete=20package=20xesam.el=20= (since=20Emacs=2024)=20has=20been=20removed.=0A=20=0A++++=0A+**=20= 'regexp-quote'=20may=20return=20its=20argument=20string.=0A+If=20the=20= argument=20needs=20no=20quoting,=20it=20can=20be=20returned=20instead=20= of=20a=20copy.=0A+=0A=20=0C=0A=20*=20Lisp=20Changes=20in=20Emacs=2027.1=0A= =20=0Adiff=20--git=20a/src/search.c=20b/src/search.c=0Aindex=20= 1e57d2ecbe..9d95dcbca5=20100644=0A---=20a/src/search.c=0A+++=20= b/src/search.c=0A@@=20-3138,10=20+3138,12=20@@=20DEFUN=20= ("regexp-quote",=20Fregexp_quote,=20Sregexp_quote,=201,=201,=200,=0A=20=20= =20=20=20}=0A=20=0A=20=20=20Lisp_Object=20result=0A-=20=20=20=20=3D=20= make_specified_string=20(temp,=0A-=09=09=09=20=20=20=20=20SCHARS=20= (string)=20+=20backslashes_added,=0A-=09=09=09=20=20=20=20=20out=20-=20= temp,=0A-=09=09=09=20=20=20=20=20STRING_MULTIBYTE=20(string));=0A+=20=20=20= =20=3D=20(backslashes_added=20>=200=0A+=20=20=20=20=20=20=20?=20= make_specified_string=20(temp,=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20SCHARS=20= (string)=20+=20backslashes_added,=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20out=20-=20= temp,=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20STRING_MULTIBYTE=20(string))=0A+=20=20=20=20= =20=20=20:=20string);=0A=20=20=20SAFE_FREE=20();=0A=20=20=20return=20= result;=0A=20}=0A--=20=0A2.21.0=20(Apple=20Git-122)=0A=0A= --Apple-Mail=_72EB9638-B426-4250-8373-3AD1AB7A883A--