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?K=C3=A9vin_Le_Gouguec?= Newsgroups: gmane.emacs.help Subject: Re: rx and rx-to-string handle (regexp VAR) differently Date: Fri, 09 Jun 2023 08:35:04 +0200 Message-ID: <87ilbxgn3b.fsf@gmail.com> References: <87ttvhvdco.fsf@gmail.com> <83zg591888.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30513"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: help-gnu-emacs@gnu.org To: Eli Zaretskii Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 09 08:36:14 2023 Return-path: Envelope-to: geh-help-gnu-emacs@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 1q7VjK-0007lT-AE for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 09 Jun 2023 08:36:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7Vif-0004y0-TW; Fri, 09 Jun 2023 02:35:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7ViI-0004t1-It for help-gnu-emacs@gnu.org; Fri, 09 Jun 2023 02:35:24 -0400 Original-Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q7ViG-0007kj-Pk; Fri, 09 Jun 2023 02:35:10 -0400 Original-Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-30b023b0068so1058039f8f.0; Thu, 08 Jun 2023 23:35:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686292505; x=1688884505; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1JLw2/nJyv72JAsfg/l5B5Ml/TK02m64/3fyNyFLtq0=; b=Hc+uXB7mbBtsHqvAdIshz13/vjudvf+FkbfLXAEHbB0XCCsl7xSE6yX6h2GPRbxSRW JBtF0DEnMtv7Rc7Pxx6j8iVOy2ir6TUXcYM2/t34RArpPqZDefqC3/RDv00VXw+qst0P mUEZ3+tUzNXvHBC/w5Kfv/jfMkTAUBkOAi/lJvbajKkGgSS7LGCR4yy4BBzmiO7S774I BEiTk3d1ZviKp1dECBDPGIrDjyKMmkB8tWOU91WfwZhehqs6CZqjNMnCI0WixYLnyLKK KtaiGwLg7bqD2wVECat/dK+aRNxWxHAexBdGnghz50faccPBh1x+hgI+SZ2+DeAjAs7+ E4gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686292505; x=1688884505; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1JLw2/nJyv72JAsfg/l5B5Ml/TK02m64/3fyNyFLtq0=; b=P3dr66SeVQyFydRFPUksOZirktt1lr/KtBcgzycWTh8IHPUDvVXeffQS95jOJKTIyg bzOSZha3uREfjsQmx0G5oJoZeoLcKRsagzu1mOYug4dLO2edIBUiw8BynqI8zxafVeLK 7iYzdcR70VWzHHcA5HRXOodvH8tOmobSFYa9u/BwiJ/+aBVlJ88U5DQwCFSlSVyLxwwU nm47t14NQCRfPn9qWV3F1SN2vZG0nwNkSpVGKxq3YSITZzANaG7QFHKhI4xS9S0GtB4P IeTYHbJla01rkCum+U1+6i6+Coy+WgKmGr573WL945ijDbCxn8ZjKSvpPExAg4TQwlSl /M4A== X-Gm-Message-State: AC+VfDyjSRyM4OD9OdOXo3IuZ3c/m8XfvlNmKb6Cq0weFHKgcxRJzjZ2 nh2alKTmkcIlW013yXaXyHSR5XnEtjI= X-Google-Smtp-Source: ACHHUZ4+pQK81d6zvcm/eXcaGNmtm/A/yk5ZfrgV6wprlmF/xEZX0PFNia6oeEs3mATr7ja6ft/qzg== X-Received: by 2002:a05:6000:182:b0:30a:f68f:9b94 with SMTP id p2-20020a056000018200b0030af68f9b94mr3413486wrx.21.1686292505222; Thu, 08 Jun 2023 23:35:05 -0700 (PDT) Original-Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id s12-20020a7bc38c000000b003f7ba52eeccsm1643806wmj.7.2023.06.08.23.35.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 23:35:04 -0700 (PDT) In-Reply-To: <83zg591888.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 09 Jun 2023 09:05:11 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=kevin.legouguec@gmail.com; helo=mail-wr1-x42f.google.com 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_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:143898 Archived-At: Eli Zaretskii writes: >> From: K=C3=A9vin Le Gouguec >> Date: Thu, 08 Jun 2023 23:44:07 +0200 >>=20 >> Is there a bug to file here, or have I missed something in the >> documentation that explains why rx can work with (regexp VAR) but >> rx-to-string cannot? > > FWIW, "Extending Rx" in the ELisp manual says: > > =E2=80=A2 Definitions are only ever expanded in calls to =E2=80=98rx= =E2=80=99 or > =E2=80=98rx-to-string=E2=80=99, not merely by their presence in defi= nition macros. > > So I think this ought to be supported, and you should file a bug: > either the implementation or the documentation should be fixed. ACK; will do. I see that the note in rx-to-string's docstring re. only supporting literal strings for 'regexp' and 'literal' dates from 2019-06-25 "Support (rx (and (regexp EXPR) (literal EXPR))) (Bug#36237)" (b59ffd2290f): (defun rx-to-string (form &optional no-group) "Parse and produce code for regular expression FORM. FORM is a regular expression in sexp form. -NO-GROUP non-nil means don't put shy groups around the result." +NO-GROUP non-nil means don't put shy groups around the result. + +In contrast to the `rx' macro, subforms `literal' and `regexp' +will not accept non-string arguments, i.e., (literal STRING) +becomes just a more verbose version of STRING." I might also give that thread a read to see what prompted this limitation.