emacs-devel
[Top][All Lists]
Advanced

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

Re: Ugly regexps


From: Eli Zaretskii
Subject: Re: Ugly regexps
Date: Wed, 03 Mar 2021 18:30:30 +0200

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: emacs-devel@gnu.org
> Date: Wed, 03 Mar 2021 10:46:20 -0500
> 
> >>     (string-match (ere "\\(def(macro|un|subst) .{1,}"))
> >>
> >> instead of
> >>
> >>     (string-match "(def\\(macro\\|un\\|subst\\) .\\{1,\\}")
> >
> > Why not use 'rx' in those cases?
> 
> Not sure what you mean by "those cases".  I'm thinking this `ere` would
> be useful for the cases where the author finds `rx` unpalatable for
> some reason.

Why would someone find rx unpalatable?

> > IMO it makes the regexp even more easy to write and read.
> 
> I believe this depends on taste and circumstances.  Experience shows
> that while some packages use `rx` extensively, most ELisp code doesn't.

If this is about personal preferences and tastes, then I think having
3 different flavors of regexps in our sources due to personal
preferences is not necessarily a good idea.  We have coding
conventions for a reason.



reply via email to

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