From unknown Sat Jun 21 03:22:06 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#50136 <50136@debbugs.gnu.org> To: bug#50136 <50136@debbugs.gnu.org> Subject: Status: 28.0.50; A problem with rx-let expansion Reply-To: bug#50136 <50136@debbugs.gnu.org> Date: Sat, 21 Jun 2025 10:22:06 +0000 retitle 50136 28.0.50; A problem with rx-let expansion reassign 50136 emacs submitter 50136 Michael Heerdegen severity 50136 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 20 10:00:12 2021 Received: (at submit) by debbugs.gnu.org; 20 Aug 2021 14:00:12 +0000 Received: from localhost ([127.0.0.1]:35183 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mH548-00053W-3f for submit@debbugs.gnu.org; Fri, 20 Aug 2021 10:00:12 -0400 Received: from lists.gnu.org ([209.51.188.17]:34968) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mH547-00052J-4V for submit@debbugs.gnu.org; Fri, 20 Aug 2021 10:00:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59118) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mH545-0001FC-OQ for bug-gnu-emacs@gnu.org; Fri, 20 Aug 2021 10:00:10 -0400 Received: from mout.web.de ([212.227.17.12]:54939) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mH541-0003WJ-Cv for bug-gnu-emacs@gnu.org; Fri, 20 Aug 2021 10:00:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1629467986; bh=IkX0e0CunhPzHG2FHfOHCKwqBCA5VOLLhItbn1MZBrA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=Z4cbqOL+gerbq289acTXv9Q2RvBLaRvhCf7fdJjqgyvmQcZTf9KPe5KvUbaO22oKL sjmqeVZmn3Nl5+VhcUF356VgV9QznVhgz0WatwqiIRydR/rUSS9rS6dHpY8KmRBxVI emYd3GJHBCneTtwE9Kvn98T4/YLeLSHN1vfaFZ84= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from drachen.dragon ([88.66.201.45]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LvBV8-1nG1gG04mo-010IFX; Fri, 20 Aug 2021 15:59:46 +0200 From: Michael Heerdegen To: bug-gnu-emacs@gnu.org Subject: 28.0.50; A problem with rx-let expansion Date: Fri, 20 Aug 2021 15:59:44 +0200 Message-ID: <878s0wcj3j.fsf@web.de> MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:O3Brt43SWLQ4WWta0JhVCiBCWr69IVrneVMeXPv/7e0WsoyniAx ilBJhGBOCYl4rq18km8M0ZxxC9dLhKlZIf5lOmKaC0TEsM2Mc+vCLPKksHnl4004y86ICwO o0qa+R82H1Y1mfJrefzI4Qjc0gAQ6Aovs8YZNcLd/FQfhxTXpgD7UUBERZQtvuWYmDOq++S +4EuAclzZNLfwrb1V517Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:2dFCqK3e2Ik=:jFrfeb6v8mk+ySA4EFlr/u djNmRGTAhCqf7BBrfECZk5PK30kAV2W9FVMoCiXILwvuzw5Ez5CLtBg9ElsyRl5d1GKtJ4Tiu 0vPRH0fnStolI8yCxwarPPpX9j/ZzCv6ldd+1SxWDm6qyEpPn/ZUvMlGTIw0F/yKHk+pZ/y2m 3hHA/+Qf5hrxaN9FGGi+8SirB3JeuJCo8c1JkjnNIpf1LYdvwuZKWI7GQb9UTWBUSBPY01ZHu Eo1Ura6gs2Q4RiVyDkHNGCB6Y9QAiYafe/bWLXC5VOVOucvHoWoSv1eJOYoagwINlkHWhK//u E1uAkK6HPnWE775z8DXRGlxtNZBugRwx6XndVhJu/rlXPiUIzi0ChIO/iVfU8/Xcol/k/Ux7w 06P0Q5tNk0kc/DvtFfTMnWt7pSkyRMG5er7nsum3gjp++IjRg0NfGUvjiyWt5xPu46L+7hucu k1pTRomkZr7rSqnaQ3XL+DEqdOqL5oN3SUK8yZNX6dnR/CuypB4hxcd4B7p8nd7FFeZLo8ru+ PgWK20MAGMb0nIZywX0CzgJQRt8km89eKjAPq8Q+OjjMkvS3191k8TDv9dgivG52fNyJnMglu 8Rm5GEmhn++N41f7J5AVrYxzqb+pHYgHCO0egABqo0DNzCiUNy8VxYoy9cP70OnV0tsAeFO7K Rs0uqMQTFUG5zo/8V48edg2kEjJH7PKT+YagOIxovnQCX60yyBaX9X1fQLcZMI2Z8mzLUUTWh xO0suRwzmKprWHDGLu7pnxPnY0MxT607atnLeWYqDFpmtmhf7ibvpEkQ6WESj/ueQyrKZgP+H GB5c0GqUuR2hLaP6EtCzR8bR4lPNeB9zH6mzW7O6UZMp6cfj+53FTQBrq+2eLii1LmDjUEe0e BWd6m6mTnbjwZ35cIpZfWSax45SlmB2FqDWO0I3NnPloiKC8BYer+G7y76rione8RFMGyz7Ee 9vaVHYmgJ35mIFrGCC2+3rPMma4MEOtniWflRPoeN8D6mNbQu4HHtciHwLURxaxvgV56BsbAQ NMA8NtOw8julYXbdwi/4dqkYkmnxeNySelZlj2eeCY3f2S+bPPsv/f1Lh1juI+UbiF4NyYzDK MEONCtV4lI705lxX5fgPnkYszRJWAoN1hhzVE+HcD9U8gVdJj2GxTLj3A== Received-SPF: pass client-ip=212.227.17.12; envelope-from=michael_heerdegen@web.de; helo=mout.web.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: submit Cc: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Hello, I'm referring to this paragraph in rx.el: ;; FIXME: Consider adding extensions in Lisp macro style, where ;; arguments are passed unevaluated to code that returns the rx form ;; to use. ;; [...] ;; While this would permit more powerful extensions, it's unclear just ;; how often they would be used in practice. Let's wait until there is ;; demand for it. Ok - here is! I would find that approach much more natural than the current one. Look: Already the first `rx-let' pseudo macro I tried hit a problem (bug) with the current approach: #+begin_src emacs-lisp (rx-let ((scatter (string) (regex (mapconcat #'string (string-to-list string) ".*")))) (rx (scatter "abc"))) => useless error message #+end_src while the following version (the only difference is the argument name) works as expected: #+begin_src emacs-lisp (rx-let ((scatter (s) (regex (mapconcat #'string (string-to-list s) ".*")))) (rx (scatter "abc"))) ==> "a.*b.*c" #+end_src Seems the function form #'string gets replaced and ends as #'"abc" in the first version because the function name accidentally collides with the argument name. Personally I would be more happy with a thing called `rx-macrolet' than with an extended `rx-let' to support this additional macro-like kind of syntax. TIA, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 20 10:50:17 2021 Received: (at 50136) by debbugs.gnu.org; 20 Aug 2021 14:50:17 +0000 Received: from localhost ([127.0.0.1]:35295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mH5qa-0006HZ-Sl for submit@debbugs.gnu.org; Fri, 20 Aug 2021 10:50:17 -0400 Received: from mout.web.de ([217.72.192.78]:53455) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mH5qY-0006HF-Q3 for 50136@debbugs.gnu.org; Fri, 20 Aug 2021 10:50:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1629471002; bh=EGN7zJ6geFc5MHH/zpW95Jq8kUd8SEGz6+DtrE37EzU=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=Gmduy6OLiJvQFy6NB31kwNwSmCkrJHtDDyr9d4XGNmxmmMmaA7XCxkA0OHUL+3pYU Jf1iu7y8t9Qt/onsRn5XWpfC19vkrpeRNXgTa8s8ePKAK9yWAwGVL79dh8pRQlNUB/ K4TIIEm87NMQcS7tTsCvwEgqU6utnw76ld9+4NO8= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from drachen.dragon ([88.66.201.45]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MpU1u-1mrJo62ERA-00pqop; Fri, 20 Aug 2021 16:50:02 +0200 From: Michael Heerdegen To: 50136@debbugs.gnu.org Subject: Re: bug#50136: 28.0.50; A problem with rx-let expansion References: <878s0wcj3j.fsf@web.de> Date: Fri, 20 Aug 2021 16:50:01 +0200 In-Reply-To: <878s0wcj3j.fsf@web.de> (Michael Heerdegen's message of "Fri, 20 Aug 2021 15:59:44 +0200") Message-ID: <8735r4jhly.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:1NULzQdii5CZUA07OMTQu9+q06DOAauZuSE5NUBKwEqbmEFAcVT EvRgU5IMrusZUG+DXDEgMD7dAkJw0Epy3R6T/+pLf3pnp399nS9kdA3pJ8Z3fJkE4sfkBox fxcP6ugEgXSpKi1F014Ov9AdtW+F4HjZfahFVwpwMK0G295w1vDEolT568dRplQbeoFNiU2 11OKl+DW3di+r1Jsn67SQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:pnWTLsKKs7w=:9xxmxLK1K9EYhyQ4x1m2eL 6SeDvx7mgKrI55D+LYkTauuGkpTOoWpmdO3MDskVjnXyT2C+rjLKRYMC3IiR3LuwfHxBeQFZN m8/hzwtr5dXjKGKj0jVy4F2utk3f3Lq0UTxaehIRNHwDOEXYp9LjjhkSPkwlDg5VyHy7D3crT 6YaxiO5EU+5rbkYVwIme1DxOZXGLmxHrLG+/j0dcIVf1zjnMcfXm4spvbeYN2rD3qFAd82eLa kn0mkvuqpgeh35pjfsBUPhutAsQlmh3Rg2mpyN2jzOAUsQ/y2D+WOFcVy4imwZE/6pvD0oTl3 W1hY+vp2a7QymvpNtR78B26SFxY9KNFPG9AzLePQGcmgz+ZxtswoKNUhX0nOkUMDO3R8cWriS ekRrnGrwP+kjt16mOvZM3rtV/WhEb2hxm2OyNT6QeUGNHr1LeQ5EZNecV/E9wffZl/8ueoERk 3OLwDLwGzfRDZdseO71VlSJ9+C2awC/908wd+2NZIEuh2x4yOVTW3cJdBQNa0h1pQxv7NfqRV Rxl+xiTX00djezKwOLwojpouKKsoCBtRVyNEpAQxkuowak3qZlaRfIblmoNfKuJ1Z8TagxUSH obQ8skrcGji59826yj8sCLsjtLC8Q6bVzAv/FdHpzJuATcojQjn/kNxoSzKJRIc0kGlSCymL5 CkyXs+iOlrKuhe2rJxmoLBhLOZd5OgbMQbXdBWcd+YxqyHV+UTt2FOHXmAlUCHVKvE8n17y7Y E4Gu5pUoXDE7ZK5vAdl6ZD3L3FDFgjZasM/S4vQ1GKDssCfRven/1TbnLNFpf8VxFvrs1dX7Q V6UCNLAsU+kpE4vP65VZl/tE8KGe1AD30TvhifMy/DRxyzTbRoUZtI5EGJTCo9hWcA7sszpSd luE+fyy5W2ASDRE5/p5GxR61RfhMAJsfkyuPQrJZWNCS27kAE1briZ+9Nk+BgxnIFOjagNcJK kfbzMQhK/tcn144MKlkwfCsLkSzHReq8lnLWPrTpOwWHJ7RgzjQt3WxNX1XV+EWXIltU5O2ZW MlG80vgSB9ddQnfYQ8BnyWYJPplp8ymBjkmXjA+SB/HWUhtSQHAJUgxCVyfrVTix0qvOMfgJ7 Sc4qO/ZmxFcnJaxZSuhpT+hI6msDRc61gJVSUKNI7nb0O/j0jIR8SsXPw== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 50136 Cc: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Michael Heerdegen writes: > #+begin_src emacs-lisp > (rx-let ((scatter (s) (regex (mapconcat #'string (string-to-list s) ".*")))) > (rx (scatter "abc"))) ==> "a.*b.*c" > #+end_src AFAIU, the current approach doesn't allow to extend this with an optional CHARS argument to specify with chars are allowed "in between" (instead of "any"). The "&optional" keyword makes it barf. And I can't actually "look" at the arguments to provide a conditional replacement. All I can do is to use `regex' to eval a constant expression I specify (at run-time). This seems a quite limiting approach. Something more macro-like would be appropriate IMO. Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 20 11:24:14 2021 Received: (at submit) by debbugs.gnu.org; 20 Aug 2021 15:24:14 +0000 Received: from localhost ([127.0.0.1]:35351 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mH6NR-00031F-U4 for submit@debbugs.gnu.org; Fri, 20 Aug 2021 11:24:14 -0400 Received: from lists.gnu.org ([209.51.188.17]:46778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mH6NQ-000318-Pb for submit@debbugs.gnu.org; Fri, 20 Aug 2021 11:24:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mH6NQ-0002Ff-K4 for bug-gnu-emacs@gnu.org; Fri, 20 Aug 2021 11:24:12 -0400 Received: from mail70c50.megamailservers.eu ([91.136.10.80]:59052) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mH6NM-0008Ff-Ce for bug-gnu-emacs@gnu.org; Fri, 20 Aug 2021 11:24:12 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1629473041; bh=Myf1g81cbusP5onAaph1ayHxaKLPEEbW+TWEei9Gmoc=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=qRvOXg7URQVPI0Pn4F0ktZjTRuIJojYbwxLz6lG+QSEPTsN6JZyRt7muPSEOqRwSh 2hKL5x6S0qWV5GYx9RIqjZ3rqEWde18Iy0iVGyTLtqmywiTtI9c9fLjnplOoZvjPsO aIi53QKHcScS8F00BAInXeGSquIQFDFedIlCCtQ4= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail70c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 17KFNwHw009649; Fri, 20 Aug 2021 15:24:00 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: 28.0.50; A problem with rx-let expansion From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: <878s0wcj3j.fsf@web.de> Date: Fri, 20 Aug 2021 17:23:58 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <878s0wcj3j.fsf@web.de> To: Michael Heerdegen X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F1F.611FC911.0015, 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-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=G/ti7Os5 c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=JRQ3sjT_X96C7jf2eZMA:9 a=CjuIK1q_8ugA:10 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.10.80; envelope-from=mattiase@acm.org; helo=mail70c50.megamailservers.eu X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 20 aug. 2021 kl. 15.59 skrev Michael Heerdegen = : > (rx-let ((scatter (string) > (regex (mapconcat #'string (string-to-list string) = ".*")))) > (rx (scatter "abc"))) =3D> useless error message Yes, that's an unfortunate consequence of the current substitution = mechanism (validating Stefan's premonitions to some extent). However the syndrome is entirely avoidable and does not make the = facility less powerful. > Personally I would be more happy with a thing called `rx-macrolet' = than > with an extended `rx-let' to support this additional macro-like kind = of > syntax. Noted (in the honest sense)! > AFAIU, the current approach doesn't allow to extend this with an > optional CHARS argument to specify with chars are allowed "in between" > (instead of "any"). The "&optional" keyword makes it barf. That's right. What would be the preferred semantics? For example, what = value would you expect an absent optional parameter to take? `nil` isn't = very useful inside rx forms, so it would only make sense inside embedded = Lisp expressions. > And I can't actually "look" at the arguments to provide a conditional > replacement. All I can do is to use `regex' to eval a constant > expression I specify (at run-time). This seems a quite limiting > approach. Something more macro-like would be appropriate IMO. Actually it's the rx `eval` form that you are looking for if you want = arbitrary compile-time computation. `regexp` and `literal` are = explicitly made for run-time expressions. From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 20 13:21:43 2021 Received: (at submit) by debbugs.gnu.org; 20 Aug 2021 17:21:43 +0000 Received: from localhost ([127.0.0.1]:35484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mH8D6-0001ub-1L for submit@debbugs.gnu.org; Fri, 20 Aug 2021 13:21:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:49818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mH8D0-0001uP-93 for submit@debbugs.gnu.org; Fri, 20 Aug 2021 13:21:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mH8D0-0000v1-23 for bug-gnu-emacs@gnu.org; Fri, 20 Aug 2021 13:21:34 -0400 Received: from mout.web.de ([212.227.15.3]:56605) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mH8Cx-00067o-82 for bug-gnu-emacs@gnu.org; Fri, 20 Aug 2021 13:21:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1629480082; bh=UBttGcqs912MGGzFV2zlsBgEFxBAkwGXafPPO1H15Ws=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=A8X9IPp7ZF5h19vSeh2qmYrWk2XY1FqMNErjg6CTa2M2oREmdnA1+5K5Ej9BG3VCl Arqf8ACjYDG0vP34XjDLifS/HhEjegl8r7+sIpxEb1V2NwxS0KI0A8Pig21SZ+E7iK V8qKlLRbjPIqH5T9mlaw2TOkTpRuhToAXMlbKhog= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from drachen.dragon ([88.66.201.45]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LpQjF-1mkQkB0uZx-00fDau; Fri, 20 Aug 2021 19:21:22 +0200 From: Michael Heerdegen To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Subject: Re: 28.0.50; A problem with rx-let expansion References: <878s0wcj3j.fsf@web.de> Date: Fri, 20 Aug 2021 19:21:20 +0200 In-Reply-To: ("Mattias =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Fri, 20 Aug 2021 17:23:58 +0200") Message-ID: <87y28whw1b.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Rjo2S7n2+cV/0FLTekug5tV6PJT+zm+r47WicTNNHOGaLNzvARx K+Bj6OJdHCPRJJVYloJRXerkj41xyziHD4tlLABGldnTr/7cZdIhihlAE5k/xKsMGFyvrz6 LcqCHJGtQ0PeXlFsZqOYmmw40u+Mk+TnA5+viwila8Fb+xaTYXB1dnniCxkbedvJn1628IZ UrbEU3egkJo+ZBhhYz1DQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:vQ3NFHxFMMc=:ftGCIrwTojbs9bxh4rppPg 1Ng2U+efFoEkooTklSU40gShrdyeF3ZbLVKtNh98CmMbQWPNRWvBDHWccJXcflcR15OobSYuu UMOfYN96OuKN+sZc8OkjaewQhhwTNLqCxSuH4NYJ0gexA8d/VUfocVE5eUgVMl/rYjNeekgVA YfVcV7anS1J29pI+VMLy9NNwxZgi8LvkwQAuP+4Kg9sVO3Y8jcKHHm9QIiFVvA0j6jXvgZIZz CyWNDSPMGz+BN9qx31ICsJKtxkxoKTqQCJLGx2G8TwSd2JPskMHCOcjI0XNJnz4zY8RxTw9Jn BU9pbsksYGXf5vjIy2RZjNGO25VjsPSAqo26CqQr0cYRkdR0QJmbTG4+4Tz+K5znfXa1evAHI 2XN+otb02IDr3qeh9YuC4a/JHL+YpNtG9lEJ5tMHYBPkiGRd3/EEYT4nKFTnYzP2y6FCkm2D0 I4IQJ3CllvHg1zR2mYtvUyy20zdpNe1CkqmXTTXjZ6cmBYe5CiquXPzlXrBTq+mEBNox5arPg UfB+eATJEnZ7Slhc7kZ/2pHdefvxp2yTbovRhXN07+vEklU2a4BjgK6QefVSiyfZ3hqiA/Au2 MQUGkafpPTtGrhxO5F1SH3t93ESd2+Wvw+SQnd90eXDvy1X8yWOvRLWRp9YIb7b5w2HnmmSdA 7+ujjUkfFqTSEE/L2RDDcdISsTfhYE4maIzJACTHtMMaY7J5CGB4xTA+0Sp3oeSeyjMd3n7UL PtriZnlnOJAXzrpG1xlVK/XhBJ90b1dbqkYRoTrnllumQducIc7rZYherGf2c4lUFzIieaNWh 1invVQURxAVUzwiRFZqX95h+VyUVFdK9PQZD0r9BYMuBczhbUC5Bkk5B/CNDkvkcUIHN8B3jg v1IFN5C5UynMPsjhLjz4CKd5pFlZ0oKIOx7k9tcSru5GH8e9N3/TIpq8Ac8uReWHjKDD3AT7u tk5VB33o6gN2VRD5AER+j64k5Fjkd3bhNFl0ozjijHHCn3sb/8D86rC9upD09mybwZek+i1zj EJoT+y3SnMoG1LnUNvxV9n6tDZFv66RlzBStU6mh+8xiWuaqoJPEPqAFhIRuFgTGZv7hX/hIw bNMMnLE0yiBmFMVs8LjaQP7oeHSEGms7nFcdEpkYJvWW389TwU6LmApzA== Received-SPF: pass client-ip=212.227.15.3; envelope-from=michael_heerdegen@web.de; helo=mout.web.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Mattias Engdeg=C3=A5rd writes: > > AFAIU, the current approach doesn't allow to extend this with an > > optional CHARS argument to specify with chars are allowed "in between" > > (instead of "any"). The "&optional" keyword makes it barf. > > That's right. What would be the preferred semantics? For example, what > value would you expect an absent optional parameter to take? I guess it's not very useful for the current mechanism. With a macro-like thing, the expansion would just not use the value if it's nil. = The expander would check whether the argument was provided. > Actually it's the rx `eval` form that you are looking for if you want > arbitrary compile-time computation. `regexp` and `literal` are > explicitly made for run-time expressions. Yes, I think you are right. Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 20 14:45:52 2021 Received: (at submit) by debbugs.gnu.org; 20 Aug 2021 18:45:52 +0000 Received: from localhost ([127.0.0.1]:35545 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mH9WZ-00064y-SY for submit@debbugs.gnu.org; Fri, 20 Aug 2021 14:45:52 -0400 Received: from lists.gnu.org ([209.51.188.17]:36680) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mH9WY-00064q-IX for submit@debbugs.gnu.org; Fri, 20 Aug 2021 14:45:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mH9WY-0001Ok-BF for bug-gnu-emacs@gnu.org; Fri, 20 Aug 2021 14:45:50 -0400 Received: from mail33c50.megamailservers.eu ([91.136.10.43]:58164) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mH9WW-0004RQ-1N for bug-gnu-emacs@gnu.org; Fri, 20 Aug 2021 14:45:49 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1629485144; bh=Kk+jwvxu95OKjUF311Edixj6t6mFXt4ZG5IjWGT2Vq0=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=mnrzkxPceG7pkaig7pFQKACPS/sx/saqPnecw/ZsHHCqdigiyjFQWVKMINulPwtJq j9OIZ5aConFUYnZUbXN2SD4brkIYCsSTw2xjtNcsy+aKe4qwNjVtBLZmBQAk1ifYxI l9C+d3FsRyvcNk7trEJqeAipLqGmHxBuYCN2hiF0= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail33c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 17KIjfgj020275; Fri, 20 Aug 2021 18:45:43 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: 28.0.50; A problem with rx-let expansion From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: <87y28whw1b.fsf@web.de> Date: Fri, 20 Aug 2021 20:45:41 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <878s0wcj3j.fsf@web.de> <87y28whw1b.fsf@web.de> To: Michael Heerdegen X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F20.611FF858.001E, 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-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=Rbbu9Glv c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=0Vli5ByDdj572woyAl4A:9 a=CjuIK1q_8ugA:10 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.10.43; envelope-from=mattiase@acm.org; helo=mail33c50.megamailservers.eu X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 20 aug. 2021 kl. 19.21 skrev Michael Heerdegen = : > I guess it's not very useful for the current mechanism. With a > macro-like thing, the expansion would just not use the value if it's = nil. The > expander would check whether the argument was provided. Yes. It was (and is) a trade-off between the simpler "template-like" = semantics currently used and the programmatic "execute code" semantics = of Lisp macros. The idea was that the simpler semantics would be simpler = and sufficient for most uses, and `eval` forms could always be employed = in other cases. I'm still fretting over having made the wrong call, and that at least I = should have omitted parametrised rx definitions until better understood. If you just have one optional argument, try &rest -- at least its = default-case semantics are crystal clear (no arguments inserted). = Obviously, you could also use separate rx macros for different parameter = lists: (rx-let ((delimited (grp delim) (seq delim (group-n grp (* (not delim)) = delim))) (double-quoted (grp) (delimited grp ?\"))) etc. From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 20 23:21:25 2021 Received: (at 50136) by debbugs.gnu.org; 21 Aug 2021 03:21:25 +0000 Received: from localhost ([127.0.0.1]:35720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHHZV-00018a-AQ for submit@debbugs.gnu.org; Fri, 20 Aug 2021 23:21:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50482) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHHZS-00018N-VT for 50136@debbugs.gnu.org; Fri, 20 Aug 2021 23:21:23 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:59688) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHHZL-0003Sf-Pi; Fri, 20 Aug 2021 23:21:15 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1mHHZ6-0005U2-LF; Fri, 20 Aug 2021 23:21:00 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: Michael Heerdegen In-Reply-To: <87y28whw1b.fsf@web.de> (message from Michael Heerdegen on Fri, 20 Aug 2021 19:21:20 +0200) Subject: Re: bug#50136: 28.0.50; A problem with rx-let expansion References: <878s0wcj3j.fsf@web.de> <87y28whw1b.fsf@web.de> Message-Id: Date: Fri, 20 Aug 2021 23:21:00 -0400 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50136 Cc: mattiase@acm.org, 50136@debbugs.gnu.org, monnier@iro.umontreal.ca, rms@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > Actually it's the rx `eval` form that you are looking for if you want > > arbitrary compile-time computation. `regexp` and `literal` are > > explicitly made for run-time expressions. If there are variables which can hold an rx expression, we need to make them as unsafe file variable bindings. Or else have special code to study them and see if evaluation constructs are used. Has this been done? Are these constructs an insecurity? -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 21 07:46:11 2021 Received: (at submit) by debbugs.gnu.org; 21 Aug 2021 11:46:11 +0000 Received: from localhost ([127.0.0.1]:35938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHPRz-0007LH-Au for submit@debbugs.gnu.org; Sat, 21 Aug 2021 07:46:11 -0400 Received: from lists.gnu.org ([209.51.188.17]:39638) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHPRx-0007L6-U0 for submit@debbugs.gnu.org; Sat, 21 Aug 2021 07:46:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHPRx-0004CM-6b for bug-gnu-emacs@gnu.org; Sat, 21 Aug 2021 07:46:09 -0400 Received: from mout.web.de ([212.227.15.4]:42769) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHPRs-00056z-KS for bug-gnu-emacs@gnu.org; Sat, 21 Aug 2021 07:46:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1629546347; bh=QltdNmNBmvzx9HZ4HrL2AIsxJI9XeXXVc7jWfUmZliA=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=OcVMo1t7STKRd8CKCXQO5G3ilL8v7Qw+ZvDiKa3K6NE9FmWm2vxCl24eEumKaJQwU 6hztTHXZd+sGLpU0RsAD9XpPAkcBG544iFv5XvLuMuT7Q8J3hI+JBNSOzBkMXRRRXv EAvGZ+cjWhvo7Q3sgrp+LwhshQOTX+on6DXmeLf0= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from drachen.dragon ([88.66.201.45]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1M2Phi-1mLGGC3Oz0-004DOJ; Sat, 21 Aug 2021 13:45:46 +0200 From: Michael Heerdegen To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Subject: Re: 28.0.50; A problem with rx-let expansion References: <878s0wcj3j.fsf@web.de> <87y28whw1b.fsf@web.de> Date: Sat, 21 Aug 2021 13:45:45 +0200 In-Reply-To: ("Mattias =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Fri, 20 Aug 2021 20:45:41 +0200") Message-ID: <878s0vc97a.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:abXoD/alWSJvF3cl0vIomrSSH2YQsEkr4M4lo/ZucPj5wky+m7C tTVNnWuQpo+5JHYY1kvnXnAiVlx4dxNuXBwEjfs2GxaG5TDTjvpSi7ENH5e8Qc2RocpLHsb 3fFqpwD1LLS223pB6+otu2H+XqG4ngsiIkifx/mTeE/dCKqwiMO59byDyGZ5emwgKCFfHqv hJkbTfeCHdQuk6IQouSWQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:PUy/hddhwlw=:VsBcFFzfkLXDm/P02lp2Py FyCcPXVrlWkqB0qlxZT6SsWDttgjaQZ4VudtKoGldaRNQnc8ptKaM7oGjSycN5UK4fNm8Ka0r LIcOk6bnO638ICi96jF0FAQ+wSyqIVL3rV3m7xhodTJfGcD6vzkEdVjkaQI1n39eog20hp7Kg bQqBQ7mLVk03VYXQodsgXbb6G/DyJf+dj9KNEFzadGoeO88YSoYqJc3hcMpEjeGI2hdzr4WpA HlTLqo5G1vqh8ZnDsTBM+CSKtped6t1vt5E9I4tGpzBkp2gb56G3pXkb4t3eiklyLuGs67BHd XyJt7nFFAsKNzU0iUnrJby12xOZVbKkaBwPeWNLuPYojrzxxN+BkBRvmpBFb6WMxvSDNA7EX3 2bUHlav1OzU9jcHSFxfoqz3svHACccF2I3T2HLwouEfJ4L2OenQdRpH9TR6/5/36ZV+pQ0LAe wNu18nzXLw479Bm1Q02q0MKeGEWT3HpYrB1zSgOsI07g3rduK3u7NwiBrF9rZttg2PHJ7Awyt YVs8sF/TxgaZUdaLj+5+WE40V2xQ6WaxZSEnf0DYPsylJe2WJ28OQqHpMY/bhXQDquApHt63I vYdBsrJKymk3arWQ8WjU/Sz+sZ8Hh5QdeoEE4KfdWCyRqXNNK1pZtiphP2UHBXImbuUUYDD0U qbKeY+p4ImWhmeTVVy9xYmslnab9efZCmi2/dGJs/0HczEDeuY8THjLd0JtdWTedxmi1v/psX wIVjdNmkXBWBwrKTEzIrZXYcBc/fV7FJk6SReSxRsPqR8EDeJhCUvG0xDO1X0NosA0JBpYsEg ilJKvxc1d3MOOwvmGkniKB86K112LO4doWrFyqMgTPv0CWJsKhKvjw7Zcxl6pXy/IfM7TTWo5 bXT1/VMaNgeIMt1thTQOC1M3vblCfX45r/SRTyOOiLY7FyKXlsGAqk5cMTTZpoAzVDP2odKx+ bvVwONDuKaX3dTRBhVGY7meZakb9lFYoM73tMZYhXiEr/NjJLppZy1T/BS8fIfQV93Mej4xO9 Fv19UDfjX2rNnKWOtY6cwGHg7K8JMQHW5w89NyqM8bfGTpL/h617bPafM3fLOSHUSf4s6a4JD CNawfEVqjkqnrizbBrTrFA0Q0TgLedPtTBCp9HYkPTveJnGVjKYQqjSBg== Received-SPF: pass client-ip=212.227.15.4; envelope-from=michael_heerdegen@web.de; helo=mout.web.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Mattias Engdeg=C3=A5rd writes: > Yes. It was (and is) a trade-off between the simpler "template-like" > semantics currently used and the programmatic "execute code" semantics > of Lisp macros. The idea was that the simpler semantics would be > simpler and sufficient for most uses, and `eval` forms could always be > employed in other cases. Ah ok, now my picture gets somewhat clearer. The semantics I wish for are already possible. I need to use `eval' on the one side, and &rest on the other. Since REST from &rest rest is spliced in, I can't use REST like a variable (and e.g. test whether any args have been provided, that is impossible, since in that case it expands to nothing); instead I can use something like (let ((args (list rest))) ...) inside rx `eval' and use that as argument list variable. I think I can live with that. Maybe it would be good to improve the docstring to say the things that I missed clearer? - Say explicitly that this mechanism is different from macros, instead it's just a simple substitution mechanism, and add a simple example to the docstring as a reference, even if we already have examples in the manual. Maybe also tell that using `eval' you can still have a macro-like behavior in the end. Michael. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 21 09:03:00 2021 Received: (at submit) by debbugs.gnu.org; 21 Aug 2021 13:03:00 +0000 Received: from localhost ([127.0.0.1]:36019 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHQeK-00033B-13 for submit@debbugs.gnu.org; Sat, 21 Aug 2021 09:03:00 -0400 Received: from lists.gnu.org ([209.51.188.17]:35298) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHQeI-000332-4l for submit@debbugs.gnu.org; Sat, 21 Aug 2021 09:02:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHQeH-0007PC-Um for bug-gnu-emacs@gnu.org; Sat, 21 Aug 2021 09:02:57 -0400 Received: from mail1438c50.megamailservers.eu ([91.136.14.38]:41432 helo=mail263c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHQeF-0006UU-JJ for bug-gnu-emacs@gnu.org; Sat, 21 Aug 2021 09:02:57 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1629550970; bh=V2iNDmoj0nbFcFoMyoAyS1bQNGUzYC1ErKOUMfHH+P8=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=RTsUMznVqzR76w74Vobve/RkJlZTSquWQu3UOH23JDRnjDzsjR8m/JouN8h6sLnVi +pOpYe2M9vaVUNMA5m6bsjJ/ICQ+FdMEY6/ldP+lhZaZ1lqIWoGaD9eTk96H/04+0x Mj/7K11yJQ2rPSduOM8H+RiV0gwIvVZtsg4/xI0U= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail263c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 17LD2mQJ010875; Sat, 21 Aug 2021 13:02:49 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: 28.0.50; A problem with rx-let expansion From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: <878s0vc97a.fsf@web.de> Date: Sat, 21 Aug 2021 15:02:47 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <3541B092-BD63-4610-BDA8-A43ABD4FAF6D@acm.org> References: <878s0wcj3j.fsf@web.de> <87y28whw1b.fsf@web.de> <878s0vc97a.fsf@web.de> To: Michael Heerdegen X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F17.6120F97A.0058, 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-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=St3uF8G0 c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=S9lYUY0PayAX-g-VJosA:9 a=CjuIK1q_8ugA:10 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.14.38; envelope-from=mattiase@acm.org; helo=mail263c50.megamailservers.eu X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, 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-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 21 aug. 2021 kl. 13.45 skrev Michael Heerdegen = : > (let ((args (list rest))) ...) >=20 > inside rx `eval' and use that as argument list variable. Or just put all the actual code in a plain function: (eval-when-compile (defun expand-my-rx-thing (x y &optional z &rest r) ...)) (rx-define my-rx-thing (x y &rest more) (eval (expand-my-rx-thing x y = more))) and use &optional and &rest arguments as you are used to, without any = risks of substitution accidents like "string" in the example you showed = earlier. The function would effectively work exactly like a macro of the = sort you requested. > Maybe it would be good to improve the docstring to say the things that = I > missed clearer? - Say explicitly that this mechanism is different from > macros, instead it's just a simple substitution mechanism, and add a > simple example to the docstring as a reference, even if we already = have > examples in the manual. I'll see what can be done. It's not really Emacs tradition to have = examples in doc strings but maybe they can be improved a bit as you say. > Maybe also tell that using `eval' you can still have a macro-like > behavior in the end. Not a bad idea! From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 23 06:46:04 2021 Received: (at submit) by debbugs.gnu.org; 23 Aug 2021 10:46:04 +0000 Received: from localhost ([127.0.0.1]:40588 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mI7Sq-00088G-Mo for submit@debbugs.gnu.org; Mon, 23 Aug 2021 06:46:04 -0400 Received: from lists.gnu.org ([209.51.188.17]:51986) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mI7Sl-000881-Kz for submit@debbugs.gnu.org; Mon, 23 Aug 2021 06:45:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mI7Sl-0006Qp-AH for bug-gnu-emacs@gnu.org; Mon, 23 Aug 2021 06:45:55 -0400 Received: from mout.web.de ([212.227.17.11]:33857) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mI7Sj-0006IV-Ld for bug-gnu-emacs@gnu.org; Mon, 23 Aug 2021 06:45:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1629715543; bh=alW8rqn26n49M6mr+n6xXtx+0y5f8NFxnBZzgClwFjQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=YVm1N8rNv7y0JcJ9HLPc7wGP6ALUJlRwKwFZEi89fJCXY6g46fW/SLv38KKSZsvaQ Vgnm8y2+Dm7H94HBdAmEp1ozDT/oTjHEMXCg+XuabOpxkm4c4SxoF5lphTGlhlSBC+ goCjdRIuh5ot14lcn6rPrJFPtVTjiDrmK6b7fDlk= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from drachen.dragon ([88.66.201.45]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MZDKy-1mcw6E3hFM-00Kw9X; Mon, 23 Aug 2021 12:45:42 +0200 From: Michael Heerdegen To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Subject: Re: 28.0.50; A problem with rx-let expansion References: <878s0wcj3j.fsf@web.de> <87y28whw1b.fsf@web.de> <878s0vc97a.fsf@web.de> <3541B092-BD63-4610-BDA8-A43ABD4FAF6D@acm.org> Date: Mon, 23 Aug 2021 12:45:41 +0200 In-Reply-To: <3541B092-BD63-4610-BDA8-A43ABD4FAF6D@acm.org> ("Mattias =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Sat, 21 Aug 2021 15:02:47 +0200") Message-ID: <87a6l84ey2.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:blfOxky/+qoe3DyqanOuxaRHFITqhtjdumMmIa+lzx28I0Y/y2j 3ZLMB+EVIggztENss/EImxDYY9k5S0wpBM92/nNHq9s08dMPE7iAN+VtYbYdx+HFTS9Ebsx bRgjtYX5RnWk7iMCiP3plG9kFn1SYJRPdJC+KlPGr+vCF9HuC9btdwz+WBj3N2IqO9io2R6 lERg7FvTffs1BuVK0xWTQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:hHcWXm6K7qg=:gB4AXBmUaC6sDR5fBPMhcu LIifXbS/diGSs6QTyyvLCaQOuz+HnTm57ou5Ugf3oWki7eYtC5zR+6B7SCWT/CttkO38qy5zl k3gOn7MFtCJ/giIGn26kHi4fX6ixi16etdxHDifEUWZEuduPN77eBgS92uFOKbovNyzx1keph qmgEHFePFcPyZuxsWRvAB0Rr+b4LPcjxJY26FOxhpfqxxOaqExerRWvrzbOxu3QD0nB7IgUwP fxMVqhl7dy3Hu4Tlq70QmVcMFkBXkbvK2Ls+2hwKWrdDvg7gXrAjV0OWt0j2Ju33uoOOl0lBb 5cJzSU9WWvUgqCc0hSy2YQOo+9XIJ08hM7F2TK7RjyBLEjehNm2j1PH0tX8bhfJfF0QEaoPPl /qBpC3Zgp7sNAvS/0D0Pv4DJXTGGpieBo02naZsYJtOAUmNYiErCh8VhwDi+gBhhXqczoc4k8 oBk4T8UMd/HMNrZaKQT6q+X1snSNX0QQsMF9s+AXADwEJxZQx/iEMdmVy8lNpb3a+d8uWO7nN tXs/HhZaLjpdvCC37XquWs4SGD/GdtQC0X9kxuORoNkvJHChYWrhxOa6vhUFNvP358kBpGQJq 9QrHyE0nR3UoSDSWXQPjbjT1BUw4MzegI9v9hO/tFzywetnOLH975GgcVjM+pF/MlvXVCe/W5 MGaPQpksYdaniYXAG3gVj0/RamfPqLFw78z+o9VskzDDu/mvom6OuQzzYajVF75GsVc651Rmi b0pG1nx3ZQdjduBRemlQvKzOuY0fhtjVUjwdw4l5cHoHiEHNJoEsjD6bO3yjRqCN3WqW7WE7D TTd1iSjXFxUJkteIR4Gneljrd1oNTL+OPH26OGkjBvWGYI0tjOGPncDFWtwQ9ux7icOW9DEMQ G/C8dvtsfK4o3OhaEsw0GA00aVr24N4yuAcGk0RV5Fb1wW353jBxW3/K18OqAs/+7vLSq9uTT X6LxYUq6EBjHQA2JJwUuAGEycMgRTJThjEAsjgK5BsF7MSTIkH5ngHoZ3Y7Lzz4FBQr7Jf+un l5J7AR+1ntDBkh3xJf6+wdyhyvbtz/iXthhkWgV3SeQKGRli6alDcNC4vX9vMSHlHAW6+wyLA we0G/y2pt0SMcdFewHRPsbYNcSCQYJt7VUlTMTdYo4VX38QdxX3IGSmLQ== Received-SPF: pass client-ip=212.227.17.11; envelope-from=michael_heerdegen@web.de; helo=mout.web.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Mattias Engdeg=C3=A5rd writes: > Or just put all the actual code in a plain function: > > (eval-when-compile > (defun expand-my-rx-thing (x y &optional z &rest r) ...)) > > (rx-define my-rx-thing (x y &rest more) (eval (expand-my-rx-thing x y > more))) > > and use &optional and &rest arguments as you are used to, without any > risks of substitution accidents like "string" in the example you > showed earlier. The function would effectively work exactly like a > macro of the sort you requested. A good idea, I like it! > > [... talking about docstring tweaks ...] > > I'll see what can be done. It's not really Emacs tradition to have > examples in doc strings but maybe they can be improved a bit as you > say. I you find a way to get along without examples, all the better. I suggested to use an example because it might be the simplest way to explain how things work, and because the way things work may come unexpected for some (like me). But providing some more details more explicitly might be as good as well. Regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 23 08:38:57 2021 Received: (at submit) by debbugs.gnu.org; 23 Aug 2021 12:38:57 +0000 Received: from localhost ([127.0.0.1]:40693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mI9E9-0006kV-80 for submit@debbugs.gnu.org; Mon, 23 Aug 2021 08:38:57 -0400 Received: from lists.gnu.org ([209.51.188.17]:58340) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mI9E6-0006kM-Pa for submit@debbugs.gnu.org; Mon, 23 Aug 2021 08:38:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mI9E4-0005Lk-7d for bug-gnu-emacs@gnu.org; Mon, 23 Aug 2021 08:38:52 -0400 Received: from mail210c50.megamailservers.eu ([91.136.10.220]:36938 helo=mail194c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mI9E1-0003KB-Hz for bug-gnu-emacs@gnu.org; Mon, 23 Aug 2021 08:38:51 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1629722324; bh=v058Lf8DC04Ulp9IysUR/8F/Th5qjaIEYOstz42EWPw=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=gPQOMb4w43wgXJmCppPANHU+M689vhat8bFoyhDYecjCOdfKlF1ADVzNjCu2padxL PmT3P/aTGvfwQHJKPI+MbRsCqUlHJWQaMpviWilc76eN+s1zOOLh+VxZKM/cS4t0Vx PasH8FxdSngwfTOxO6QR2D4MMt4ItEmtzIYuD7OU= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail194c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 17NCcfI2025688; Mon, 23 Aug 2021 12:38:42 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: 28.0.50; A problem with rx-let expansion From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: <87a6l84ey2.fsf@web.de> Date: Mon, 23 Aug 2021 14:38:40 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <4F014940-1E4D-4F55-968C-D481D2977247@acm.org> References: <878s0wcj3j.fsf@web.de> <87y28whw1b.fsf@web.de> <878s0vc97a.fsf@web.de> <3541B092-BD63-4610-BDA8-A43ABD4FAF6D@acm.org> <87a6l84ey2.fsf@web.de> To: Michael Heerdegen X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F20.612396D4.0009, 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-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=QJQWuTDL c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=yNeF8XvQDolaz5Opog8A:9 a=CjuIK1q_8ugA:10 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.10.220; envelope-from=mattiase@acm.org; helo=mail194c50.megamailservers.eu X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 23 aug. 2021 kl. 12.45 skrev Michael Heerdegen = : >> (rx-define my-rx-thing (x y &rest more) (eval (expand-my-rx-thing x y = more))) > A good idea, I like it! The variant (rx-define my-rx-thing (&rest more) (eval (expand-my-rx-thing more))) would also work, at the cost of slightly worse error messages if you = pass too few arguments to my-rx-thing. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 23 11:21:01 2021 Received: (at submit) by debbugs.gnu.org; 23 Aug 2021 15:21:01 +0000 Received: from localhost ([127.0.0.1]:42401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIBky-0002ua-QT for submit@debbugs.gnu.org; Mon, 23 Aug 2021 11:21:01 -0400 Received: from lists.gnu.org ([209.51.188.17]:53096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIBkx-0002uT-6d for submit@debbugs.gnu.org; Mon, 23 Aug 2021 11:21:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIBkt-0003ko-PZ for bug-gnu-emacs@gnu.org; Mon, 23 Aug 2021 11:20:57 -0400 Received: from mail1475c50.megamailservers.eu ([91.136.14.75]:48142 helo=mail118c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIBkn-0002IG-Qx for bug-gnu-emacs@gnu.org; Mon, 23 Aug 2021 11:20:55 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1629732045; bh=K9ZfeUVzhUAPu9IvZjZAoiu3F7RvuW820rDMjX2Is0E=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=Y7scl0oXzmkONaxPRpAAWhZcgNMysp1mydy5y5xeiuqdN8NtvPpnZGLYw7tvxufW3 nowAuTrvMqKhLHzc9uU1Yf6Q8FDGsmObO54++LwkP/hVS9syNj1fc8FKor4cwHp25a J5BvcIKYUKehFrqqGytDxiiSh85Cae/Eh0/ItKng= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail118c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 17NFKhdB000798; Mon, 23 Aug 2021 15:20:44 +0000 From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Message-Id: <9CAC5CC8-CFC7-4B9A-952D-6E5BD43D0D80@acm.org> Content-Type: multipart/mixed; boundary="Apple-Mail=_E0076354-B2FE-48A7-B03C-9A9F5439C98F" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: 28.0.50; A problem with rx-let expansion Date: Mon, 23 Aug 2021 17:20:42 +0200 In-Reply-To: <87a6l84ey2.fsf@web.de> To: Michael Heerdegen References: <878s0wcj3j.fsf@web.de> <87y28whw1b.fsf@web.de> <878s0vc97a.fsf@web.de> <3541B092-BD63-4610-BDA8-A43ABD4FAF6D@acm.org> <87a6l84ey2.fsf@web.de> X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F15.6123BCCD.0094, 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-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=Ro+70xuK c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=M51BFTxLslgA:10 a=DG9AbkNqdOfO4dmz2loA:9 a=CjuIK1q_8ugA:10 a=JMAdihMaANsKMJ-yYn8A:9 a=B2y7HmGcmWMA:10 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.14.75; envelope-from=mattiase@acm.org; helo=mail118c50.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, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --Apple-Mail=_E0076354-B2FE-48A7-B03C-9A9F5439C98F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 23 aug. 2021 kl. 12.45 skrev Michael Heerdegen = : > I you find a way to get along without examples, all the better. I > suggested to use an example because it might be the simplest way to > explain how things work, and because the way things work may come > unexpected for some (like me). But providing some more details more > explicitly might be as good as well. Here is my proposed change to the manual. I didn't change the doc = strings since they already refer to that Info node. Good enough? --Apple-Mail=_E0076354-B2FE-48A7-B03C-9A9F5439C98F Content-Disposition: attachment; filename=0001-Add-example-of-advanced-user-defined-Rx-form-to-manu.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Add-example-of-advanced-user-defined-Rx-form-to-manu.patch" Content-Transfer-Encoding: quoted-printable =46rom=20cb1daffa5f226278723b4a96a698883d7010947a=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Mon,=2023=20Aug=202021=2017:02:51=20+0200=0A= Subject:=20[PATCH]=20Add=20example=20of=20advanced=20user-defined=20Rx=20= form=20to=20manual=0A=0A*=20doc/lispref/searching.texi=20(Extending=20= Rx):=20Add=20example=20illustrating=0Ahow=20to=20define=20a=20= user-defined=20Rx=20form=20that=20performs=20computation,=0Afrom=20a=20= discussion=20with=20Michael=20Herdeegen=20(bug#50136).=0A---=0A=20= doc/lispref/searching.texi=20|=2019=20+++++++++++++++++++=0A=201=20file=20= changed,=2019=20insertions(+)=0A=0Adiff=20--git=20= a/doc/lispref/searching.texi=20b/doc/lispref/searching.texi=0Aindex=20= 4d5ae3cb43..a0935eee2b=20100644=0A---=20a/doc/lispref/searching.texi=0A= +++=20b/doc/lispref/searching.texi=0A@@=20-1649,6=20+1649,25=20@@=20= Extending=20Rx=0A=20Since=20the=20definition=20is=20global,=20it=20is=20= recommended=20to=20give=20@var{name}=20a=0A=20package=20prefix=20to=20= avoid=20name=20clashes=20with=20definitions=20elsewhere,=20as=20is=0A=20= usual=20when=20naming=20non-local=20variables=20and=20functions.=0A+=0A= +User-defined=20forms=20themselves=20only=20perform=20simple=20template=0A= +substitution.=20=20For=20arbitrary=20computations,=20use=20them=20= together=20with=20with=0A+the=20@code{rx}=20forms=20@code{eval},=20= @code{regexp}=20or=20@code{literal}.=0A+Example:=0A+=0A+@example=0A= +@group=0A+(defun=20n-tuple-rx=20(n=20element)=0A+=20=20`(seq=20"<"=0A+=20= =20=20=20=20=20=20=20(group-n=201=20,element)=0A+=20=20=20=20=20=20=20=20= ,@@(mapcar=20(lambda=20(i)=20`(seq=20?,=20(group-n=20,i=20,element)))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(number-sequence=20= 2=20n))=0A+=20=20=20=20=20=20=20=20">"))=0A+(rx-define=20n-tuple=20(n=20= element)=20(eval=20(n-tuple-rx=20n=20'element)))=0A+(rx=20(n-tuple=203=20= (+=20(in=20"0-9"))))=0A+=20=20@result{}=20= "<\\(?1:[0-9]+\\),\\(?2:[0-9]+\\),\\(?3:[0-9]+\\)>"=0A+@end=20group=0A= +@end=20example=0A=20@end=20defmac=0A=20=0A=20@defmac=20rx-let=20= (bindings@dots{})=20body@dots{}=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A= =0A= --Apple-Mail=_E0076354-B2FE-48A7-B03C-9A9F5439C98F-- From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 23 12:59:36 2021 Received: (at submit) by debbugs.gnu.org; 23 Aug 2021 16:59:36 +0000 Received: from localhost ([127.0.0.1]:42547 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIDIO-0003RK-4p for submit@debbugs.gnu.org; Mon, 23 Aug 2021 12:59:36 -0400 Received: from lists.gnu.org ([209.51.188.17]:51696) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIDIL-0003RB-A6 for submit@debbugs.gnu.org; Mon, 23 Aug 2021 12:59:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIDIJ-0000o6-CS for bug-gnu-emacs@gnu.org; Mon, 23 Aug 2021 12:59:33 -0400 Received: from mout.web.de ([212.227.17.11]:41999) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIDIF-00019Z-F3 for bug-gnu-emacs@gnu.org; Mon, 23 Aug 2021 12:59:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1629737953; bh=UA1ZeNNdSmIRuOIAvq9tBVKOJfUXKIKh1U1FntkJBrY=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=Er4xsn/+cAEE6/PZYSedXJFWUG9x1yHLltp2H/pl2sJG6Gx19XQiQxL55ReY5zLnW 6jKP87AOLOXniK+R+Trd5aqDd8BcuOpDL9yEptsqCLHk4JRnoxmydtyet/lZdpZYpk EbsqcpwZi3XTLjxzwkO9fUP5HK8KUUzE52NV6WYA= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from drachen.dragon ([88.66.201.45]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LnS8Q-1myPs63c0U-00hgWx; Mon, 23 Aug 2021 18:59:12 +0200 From: Michael Heerdegen To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Subject: Re: 28.0.50; A problem with rx-let expansion References: <878s0wcj3j.fsf@web.de> <87y28whw1b.fsf@web.de> <878s0vc97a.fsf@web.de> <3541B092-BD63-4610-BDA8-A43ABD4FAF6D@acm.org> <87a6l84ey2.fsf@web.de> <9CAC5CC8-CFC7-4B9A-952D-6E5BD43D0D80@acm.org> Date: Mon, 23 Aug 2021 18:59:11 +0200 In-Reply-To: <9CAC5CC8-CFC7-4B9A-952D-6E5BD43D0D80@acm.org> ("Mattias =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Mon, 23 Aug 2021 17:20:42 +0200") Message-ID: <87eeak85cw.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:SCu0ZujnN8B3PX6OkHnIswmiGzEQR7PjR00jq6v5cUS2r+a56eG eIvonTXJO3fu39MteX7wEl7wABd2+biu2/UMnYWCoXiqsJCuWHKiRVtb9QrWFhh0aDFfdJB 6oPHHtAX0Ukc9YNqQ1oZ4jVppLfhtCTO/vGZzrOKCahyDrhOiuhLL54ev2AO/agHcs6SBMJ tyYjpluPgwv0xXBvEfohg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:n9Drpd9gcgI=:TeS5Pvu2a+axHnzrNtnAVt hJPo4TN7QmpDjmlY7mNMQCT6A0tpkziwgdiov3uHE2wTjLCZTatR2Xxl2d4HH3QisHFVxStIu autIcdQzgxiVzgDBsgqVNdXekD2HRDH+LyypvkG5hwb8tTQRs3DNph981oEf7lB14m2TGzK++ irdOPzGTJqZDZ2Om+XhGD3bm6Q/ipc870knBNv0adLIsfKTLWF6du9jSl7zy5Jhjz8oKk2hsI bbunwymlwmbfdTjMZOtt7x+KeLL8Y8vZD/ZqltGuJeYBiuRZBSb8/eoFFRkzzGF5QVN4VFfem Firfyw/uXnqhGclKFNAmj2a4Y1nRjSWhSoaPptN/WPFms9FAZ1YIIH/CTG2I/ZokWiAhKHPHi Ys7I6QpuO/tren3N482dafTTtc3vDbKegIbmjlcFZuwso7+rAH/suCWqNjKOaX7AbbruG3OkA 3jzI/kxbarc2wizExbGwfhCwTp1APfPTwd98uyH6d6k6eyVG40eHy92epvP2kQh9k62604QD7 OGEBz/L/JYn0CpFh7gB2+VNcFmLhsADJZ5enRI6KZugMyR9CH1EsicMzN1PTSGX4+YYjbs9ya ALIM0ctSOj2VuWDvu0AstVqzygsK/9x72GQmDefVmZS44IBXj2WYP1ijsHqsCMSfc0cGo4GF0 oY7SX9b78hy68jmZgxeFyoI1yk8de9N5n1vEb7o6ONSKOW5Q36UPKC+PXd+OgpHPotnO7KKL8 JnjrueAgPLxuaOm27WOFt0LnPoxEW8el7LnmA4SbKwDxvGbxaoSC21MMg1xPMmxhoRCB67r1j vkZUyuYFkJI0lsPjeSCPx2u5lQPO9kye5r7fiMRnICytBg12GvtRd9baGFR73BuIe0+pf3rVz tfPXovK3yc5IT+F5H55oxFf0f/F/VHpEUbUr2WXs5Pv3OHPSklSNcOoDQEBoeOO4YxyE+WXyT W4VoXLO/cue3oECEV3dka6uxGMlsoEx66uW2ku2a/QjdtquP5tYu3YIgiHgjjAAtISnPa70hN kI0aDUygF8r7XhU49NMxYHIlItP7rnAd+6II0LHQ7QpFmNLbBsFRF9dsA69M+UzZGCHqHfjqF juy95wRFRPP0St2KkPmw/BnEGYMrBTDSCQ5k0tmb4gt2QZIBGHHn/mGDg== Received-SPF: pass client-ip=212.227.17.11; envelope-from=michael_heerdegen@web.de; helo=mout.web.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Mattias Engdeg=C3=A5rd writes: > Here is my proposed change to the manual. I didn't change the doc > strings since they already refer to that Info node. Maybe at least one sentence about that this mechanism just performs trivial substitution? > +User-defined forms themselves only perform simple template > +substitution. I find the term "user-defined" distracting, because anybody (including library and package developers) is "affected". Apart from that, ok for me. > For arbitrary computations, use them together with with > +the @code{rx} forms @code{eval}, @code{regexp} or @code{literal}. > +Example: > + > +@example > +@group > +(defun n-tuple-rx (n element) > + `(seq "<" > + (group-n 1 ,element) > + ,@@(mapcar (lambda (i) `(seq ?, (group-n ,i ,element))) > + (number-sequence 2 n)) > + ">")) > +(rx-define n-tuple (n element) (eval (n-tuple-rx n 'element))) > +(rx (n-tuple 3 (+ (in "0-9")))) > + @result{} "<\\(?1:[0-9]+\\),\\(?2:[0-9]+\\),\\(?3:[0-9]+\\)>" > +@end group > +@end example > @end defmac Didn't try the example, but it looks good. I have one more thing, however, once we are here: In the docstring of `rx', near the end: | (eval EXPR) Match the rx sexp from evaluating EXPR at compile time. can we say "expansion time" instead of "compile time"? Regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 23 14:05:52 2021 Received: (at 50136-done) by debbugs.gnu.org; 23 Aug 2021 18:05:52 +0000 Received: from localhost ([127.0.0.1]:42590 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIEKH-00051b-Gt for submit@debbugs.gnu.org; Mon, 23 Aug 2021 14:05:52 -0400 Received: from mail210c50.megamailservers.eu ([91.136.10.220]:40058 helo=mail194c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIEKB-00051N-II for 50136-done@debbugs.gnu.org; Mon, 23 Aug 2021 14:05:35 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1629741929; bh=kPF2HM2Xsh1wl//vgfo55bTYFXnge1ip8OA3E7U4VA8=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=Rbg+MQlsyt+wn9sSMMu2TgA1+8/2ewKbH3ltawM9cgLEFERu86HI+KftthVKGHb5G SIjeCIy6cTkPKbc+Efb1FBLZ6bwsry4qEPXzwsDn6kp56EUGlZYOf2fFf8b861d3+s KC3qvc+0AsckPlxUtI1u6UstecmKMsyqC61G9bug= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail194c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 17NI5Qi1012191; Mon, 23 Aug 2021 18:05:28 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: 28.0.50; A problem with rx-let expansion From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: <87eeak85cw.fsf@web.de> Date: Mon, 23 Aug 2021 20:05:26 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <4A408FC9-3B89-40D9-9A88-60AA384BF9DC@acm.org> References: <878s0wcj3j.fsf@web.de> <87y28whw1b.fsf@web.de> <878s0vc97a.fsf@web.de> <3541B092-BD63-4610-BDA8-A43ABD4FAF6D@acm.org> <87a6l84ey2.fsf@web.de> <9CAC5CC8-CFC7-4B9A-952D-6E5BD43D0D80@acm.org> <87eeak85cw.fsf@web.de> To: Michael Heerdegen X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F1B.6123E369.004E, 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-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=QJQWuTDL c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=FGYxDdbKyvrQEEl72uAA:9 a=CjuIK1q_8ugA:10 X-Origin-Country: SE X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 23 aug. 2021 kl. 18.59 skrev Michael Heerdegen : > Maybe at least one sentence about that this mechanism just performs > trivial substitution? I didn't do that now, because I couldn't see how it could be interpreted otherwise (and there's the manual link). Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-Debbugs-Envelope-To: 50136-done Cc: 50136-done@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 23 aug. 2021 kl. 18.59 skrev Michael Heerdegen = : > Maybe at least one sentence about that this mechanism just performs > trivial substitution? I didn't do that now, because I couldn't see how it could be interpreted = otherwise (and there's the manual link). > I find the term "user-defined" distracting, because anybody (including > library and package developers) is "affected". Apart from that, ok = for > me. Thank you, changed. > Didn't try the example, but it looks good. Thanks for looking at it. Good examples are always hard to write! > | (eval EXPR) Match the rx sexp from evaluating EXPR at compile = time. >=20 > can we say "expansion time" instead of "compile time"? We can, and now do! Closing; I think we're done here (complain if not). From unknown Sat Jun 21 03:22:06 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 21 Sep 2021 11:24:04 +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