GNU bug report logs - #60196
29.0.60; re-builder should read all forms for the rx syntax

Previous Next

Package: emacs;

Reported by: Kai Ma <justksqsf <at> gmail.com>

Date: Mon, 19 Dec 2022 09:03:01 UTC

Severity: wishlist

Merged with 63918

Found in versions 28.2, 29.0.60

To reply to this bug, email your comments to 60196 AT debbugs.gnu.org.

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

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


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#60196; Package emacs. (Mon, 19 Dec 2022 09:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kai Ma <justksqsf <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 19 Dec 2022 09:03:02 GMT) Full text and rfc822 format available.

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

From: Kai Ma <justksqsf <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.60; re-builder should read all forms for the rx syntax
Date: Mon, 19 Dec 2022 17:02:27 +0800
Severity: wishlist

re-builder (rx syntax) currently cannot read multiple forms.  This
results in suboptimal user experience.  For example, even though

    (rx "<i>" (group (*? anychar)) "</i>")

is perfectly fine, but in re-builder, one has to write it as follows:

    '(and "<i>" (group (*? anychar)) "</i>")

Ideally, re-builder should allow users to simply write

    "<i>" (group (*? anychar)) "</i>"

(The relevant function seems to be 'reb-cook-regexp'.)

	Kai




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60196; Package emacs. (Fri, 30 Dec 2022 12:29:02 GMT) Full text and rfc822 format available.

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

From: Mattias Engdegård <mattiase <at> acm.org>
To: Kai Ma <justksqsf <at> gmail.com>
Cc: 60196 <at> debbugs.gnu.org
Subject: bug#60196: 29.0.60; re-builder should read all forms for the rx syntax
Date: Fri, 30 Dec 2022 13:28:14 +0100
The handling of rx input in re-builder is indeed unsatisfactory. We could adopt your proposed solution:

> Ideally, re-builder should allow users to simply write
> 
>     "<i>" (group (*? anychar)) "</i>"

which would be a definite improvement. We could also accept a Lisp expression that is evaluated, so that you'd write

    (rx "<i>" (group (*? anychar)) "</i>")

On the surface this looks more verbose, but since re-builder itself would provide the `(rx )` boilerplate, there wouldn't actually be any more typing. The main advantage would be that regexps could be built up from smaller pieces:

    (rx-let ((spaces (* " "))
             (identifier (: alpha (* alnum))))
      (rx identifier spaces "->" spaces identifier))

Either would be a definite improvement to the current rather strange re-builder behaviour with respect to rx input. Any preference?






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60196; Package emacs. (Fri, 30 Dec 2022 13:46:02 GMT) Full text and rfc822 format available.

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

From: Kai Ma <justksqsf <at> gmail.com>
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: 60196 <at> debbugs.gnu.org
Subject: Re: bug#60196: 29.0.60; re-builder should read all forms for the rx
 syntax
Date: Fri, 30 Dec 2022 21:45:21 +0800

> On Dec 30, 2022, at 20:28, Mattias Engdegård <mattiase <at> acm.org> wrote:
> 
> The handling of rx input in re-builder is indeed unsatisfactory. We could adopt your proposed solution:
> 
>> Ideally, re-builder should allow users to simply write
>> 
>>    "<i>" (group (*? anychar)) "</i>"
> 
> which would be a definite improvement. We could also accept a Lisp expression that is evaluated, so that you'd write
> 
>    (rx "<i>" (group (*? anychar)) "</i>")
> 
> On the surface this looks more verbose, but since re-builder itself would provide the `(rx )` boilerplate, there wouldn't actually be any more typing.

Good point!  And it is much easier to copy a whole Sexpr.

> The main advantage would be that regexps could be built up from smaller pieces:
> 
>    (rx-let ((spaces (* " "))
>             (identifier (: alpha (* alnum))))
>      (rx identifier spaces "->" spaces identifier))
> 
> Either would be a definite improvement to the current rather strange re-builder behaviour with respect to rx input. Any preference?

I like your proposal better! :-)





Forcibly Merged 60196 63918. Request was from Mattias Engdegård <mattias.engdegard <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 06 Jun 2023 13:08:02 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 11 days ago.

Previous Next


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