emacs-devel
[Top][All Lists]
Advanced

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

Re: modern regexes in emacs


From: Lars Ingebrigtsen
Subject: Re: modern regexes in emacs
Date: Mon, 25 Feb 2019 15:47:49 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Richard Stallman <address@hidden> writes:

> That's true, of course.  But I wonder if some other interface could
> make it possible to offer optional use of egrep syntax in a compatible
> way that would not break anything.

I have not followed this discussion closely, so I'm sorry if I'm
repeating points others have made before, but:

I think it would be nice if Emacs had a regexp object.  That would allow
us to extend Emacs in a compatible way somewhat seamlessly over a period
of time.

We could have a number of different functions that use different regexp
syntaxes, but they'd all return a regexp object.

For instance, we could have (erx "foo\\|bar") and (pcre "foo|bar") etc,
and this would allow us to experiment with different syntaxes more
freely.

The base Emacs functions that do stuff on regexps have to be adjusted en
masse, probably, but there aren't thousands of them --
`re-search-forward' etc -- to take these objects in addition to strings.

And: The final endpoint (many years in the future) of all this would be
to deprecate the `re-' functions altogether, and allow functions like
`search-forward' to take either a string or a regexp object and behave
in the obvious fashion...

(search-forward (pcre "foo|bar"))

-- 
(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]