all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#60196: 29.0.60; re-builder should read all forms for the rx syntax
@ 2022-12-19  9:02 Kai Ma
  2022-12-30 12:28 ` Mattias Engdegård
  0 siblings, 1 reply; 3+ messages in thread
From: Kai Ma @ 2022-12-19  9:02 UTC (permalink / raw)
  To: 60196

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#60196: 29.0.60; re-builder should read all forms for the rx syntax
  2022-12-19  9:02 bug#60196: 29.0.60; re-builder should read all forms for the rx syntax Kai Ma
@ 2022-12-30 12:28 ` Mattias Engdegård
  2022-12-30 13:45   ` Kai Ma
  0 siblings, 1 reply; 3+ messages in thread
From: Mattias Engdegård @ 2022-12-30 12:28 UTC (permalink / raw)
  To: Kai Ma; +Cc: 60196

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?







^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#60196: 29.0.60; re-builder should read all forms for the rx syntax
  2022-12-30 12:28 ` Mattias Engdegård
@ 2022-12-30 13:45   ` Kai Ma
  0 siblings, 0 replies; 3+ messages in thread
From: Kai Ma @ 2022-12-30 13:45 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: 60196



> On Dec 30, 2022, at 20:28, Mattias Engdegård <mattiase@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! :-)






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-30 13:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-19  9:02 bug#60196: 29.0.60; re-builder should read all forms for the rx syntax Kai Ma
2022-12-30 12:28 ` Mattias Engdegård
2022-12-30 13:45   ` Kai Ma

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.