GNU bug report logs - #6985
rx patterns don't compose

Previous Next

Package: emacs;

Reported by: Daniel Colascione <dan.colascione <at> gmail.com>

Date: Sat, 4 Sep 2010 23:37:02 UTC

Severity: wishlist

Tags: fixed, patch

Merged with 36237

Fixed in version 27.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6985 in the body.
You can then email your comments to 6985 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6985; Package emacs. (Sat, 04 Sep 2010 23:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Colascione <dan.colascione <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 04 Sep 2010 23:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Daniel Colascione <dan.colascione <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: rx patterns don't compose
Date: Sat, 04 Sep 2010 16:37:49 -0700
It's not possible to do this currently:

(defconst foo-re (rx "abc"))
(defconst bar-re (rx (* (what-goes-here? foo-re)))

in any sensible way. This won't work

  (defconst bar-re (rx (* (regexp foo-re))))

because regexp always expects a string.

This won't work, because eval always quotes its argument:

  (defconst bar-re (rx (* (eval foo-re))))

I propose allowing regexp to accept a symbol as well as a string, and
using that symbol's value literally. Alternatively, rx could provide an
eval-unquoted facility. Or both.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6985; Package emacs. (Sun, 05 Sep 2010 07:21:02 GMT) Full text and rfc822 format available.

Message #8 received at 6985 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Daniel Colascione <dan.colascione <at> gmail.com>
Cc: 6985 <at> debbugs.gnu.org
Subject: Re: bug#6985: rx patterns don't compose
Date: Sun, 05 Sep 2010 09:22:04 +0200
> It's not possible to do this currently:
> (defconst foo-re (rx "abc"))
> (defconst bar-re (rx (* (what-goes-here? foo-re)))

(defconst foo-re (rx "abc"))
(defconst bar-re `(rx (* (regexp ,foo-re)))


> in any sensible way. This won't work

>   (defconst bar-re (rx (* (regexp foo-re))))

> because regexp always expects a string.

> This won't work, because eval always quotes its argument:

>   (defconst bar-re (rx (* (eval foo-re))))

> I propose allowing regexp to accept a symbol as well as a string, and
> using that symbol's value literally. Alternatively, rx could provide an
> eval-unquoted facility. Or both.

eval-unquoted sounds OK


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6985; Package emacs. (Sun, 05 Sep 2010 07:38:01 GMT) Full text and rfc822 format available.

Message #11 received at 6985 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Daniel Colascione <dan.colascione <at> gmail.com>
Cc: 6985 <at> debbugs.gnu.org
Subject: Re: bug#6985: rx patterns don't compose
Date: Sun, 05 Sep 2010 09:39:41 +0200
Daniel Colascione <dan.colascione <at> gmail.com> writes:

> It's not possible to do this currently:
>
> (defconst foo-re (rx "abc"))
> (defconst bar-re (rx (* (what-goes-here? foo-re)))

(defconst bar-re (eval `(rx (* (regexp ,foo-re))))

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6985; Package emacs. (Sun, 05 Sep 2010 07:41:01 GMT) Full text and rfc822 format available.

Message #14 received at 6985 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Colascione <dan.colascione <at> gmail.com>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 6985 <at> debbugs.gnu.org
Subject: Re: bug#6985: rx patterns don't compose
Date: Sun, 05 Sep 2010 00:42:28 -0700
On 9/5/10 12:39 AM, Andreas Schwab wrote:
> Daniel Colascione <dan.colascione <at> gmail.com> writes:
>
>> It's not possible to do this currently:
>>
>> (defconst foo-re (rx "abc"))
>> (defconst bar-re (rx (* (what-goes-here? foo-re)))
>
> (defconst bar-re (eval `(rx (* (regexp ,foo-re))))

Or better yet,

(defconst bar-re (rx-to-string `(* (regexp ,foo-re))))

But it's still cumbersome.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6985; Package emacs. (Sun, 05 Sep 2010 10:45:02 GMT) Full text and rfc822 format available.

Message #17 received at 6985 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Daniel Colascione <dan.colascione <at> gmail.com>
Cc: 6985 <at> debbugs.gnu.org
Subject: Re: bug#6985: rx patterns don't compose
Date: Sun, 05 Sep 2010 12:45:55 +0200
Daniel Colascione <dan.colascione <at> gmail.com> writes:

> (defconst bar-re (rx-to-string `(* (regexp ,foo-re))))

To avoid the extra group:

(defconst bar-re (rx-to-string `(* (regexp ,foo-re)) t))

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Severity set to 'wishlist' from 'normal' Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Tue, 31 May 2016 21:36:02 GMT) Full text and rfc822 format available.

Merged 6985 36237. Request was from Mattias EngdegÄrd <mattiase <at> acm.org> to control <at> debbugs.gnu.org. (Tue, 25 Jun 2019 11:11:02 GMT) Full text and rfc822 format available.

Added tag(s) fixed. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 26 Jun 2019 02:09:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 36237 <at> debbugs.gnu.org and Noam Postavsky <npostavs <at> gmail.com> Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 26 Jun 2019 02:09:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 25 Jul 2019 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 248 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.