From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Ugly regexps Date: Wed, 03 Mar 2021 18:30:30 +0200 Message-ID: <83v9a8jj2x.fsf@gnu.org> References: <83pn0g6ajq.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33695"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 03 17:34:05 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lHURp-0008ec-32 for ged-emacs-devel@m.gmane-mx.org; Wed, 03 Mar 2021 17:34:05 +0100 Original-Received: from localhost ([::1]:54480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHURo-0007XE-4w for ged-emacs-devel@m.gmane-mx.org; Wed, 03 Mar 2021 11:34:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHUOk-0006Ts-1R for emacs-devel@gnu.org; Wed, 03 Mar 2021 11:30:54 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:39355) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHUOj-0003xF-JF; Wed, 03 Mar 2021 11:30:53 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2660 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lHUOf-0000tx-Ew; Wed, 03 Mar 2021 11:30:51 -0500 In-Reply-To: (message from Stefan Monnier on Wed, 03 Mar 2021 10:46:20 -0500) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:265894 Archived-At: > From: Stefan Monnier > 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.