emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Make regexp handling more regular


From: Lars Ingebrigtsen
Subject: Re: Make regexp handling more regular
Date: Thu, 03 Dec 2020 17:58:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I'm not completely sure what it would look like, tho.  Maybe
>
>     (let-re-match (overall (beg end)) (re-match "regexp")
>       ...)
>
> which would be equivalent to
>
>     (progn
>       (re-match "regexp")
>       (let ((overall (match-string 0))
>             (beg (match-beginning 1))
>             (end (match-end 1)))
>         ...))
>
> ??

Then we don't really need the re-match function at all...

     (let-re-match (overall (beg end)) ("regexp")
       ...)

or

     (let-re-match "regexp" (overall (beg end))
       ...)

(or something) would be sufficient...

But I think this would be too somewhat cumbersome.  Like, if you want to
write

(while (setq m1 (re-search "foo"))
  (setq m2 (re-match "[0-9]"))
  (zot (re-string m1 0) (re-end m2 0)))

you quickly find yourself deeply nested, and sometimes with awkward ways
of using the let-ret-matched variable if you want to use it later,
outside the form, etc.

Hm...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

[Prev in Thread] Current Thread [Next in Thread]