From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Regexp for c-or-c++-mode Date: Thu, 11 Jun 2020 09:40:53 +0000 Message-ID: <20200611094053.GA5703@ACM> References: <20200607164100.GB6212@ACM> <20200609201255.GB7104@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="8417"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Robert Pluim , emacs-devel@gnu.org To: =?utf-8?Q?Micha=C5=82?= Nazarewicz Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jun 11 11:41:57 2020 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 1jjJie-00025I-Gh for ged-emacs-devel@m.gmane-mx.org; Thu, 11 Jun 2020 11:41:56 +0200 Original-Received: from localhost ([::1]:33090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjJic-0003aS-Ir for ged-emacs-devel@m.gmane-mx.org; Thu, 11 Jun 2020 05:41:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjJhj-0002R6-GH for emacs-devel@gnu.org; Thu, 11 Jun 2020 05:40:59 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:16899 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1jjJhi-00072w-0l for emacs-devel@gnu.org; Thu, 11 Jun 2020 05:40:59 -0400 Original-Received: (qmail 5211 invoked by uid 3782); 11 Jun 2020 09:40:54 -0000 Original-Received: from acm.muc.de (p4fe15d82.dip0.t-ipconnect.de [79.225.93.130]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Thu, 11 Jun 2020 11:40:53 +0200 Original-Received: (qmail 10456 invoked by uid 1000); 11 Jun 2020 09:40:53 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/11 05:40:54 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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:252104 Archived-At: Hello, Micha�. On Thu, Jun 11, 2020 at 00:42:25 +0100, Michał Nazarewicz wrote: > On Wed, 10 Jun 2020 at 15:15, Robert Pluim wrote: > > >>>>> On Wed, 10 Jun 2020 14:58:18 +0100, Michał Nazarewicz said: > > Michał> On Wed, 10 Jun 2020 at 12:40, Robert Pluim wrote: > > Michał> I suppose you’re right. It should be [ \t\v\f] instead to catch > > Michał> all non-new-line white-space characters. Or [ \t\v\f\r\n] to catch > > Michał> all white-space characters. > > >> [[:blank:]] ? > > Michał> [[:blank:]] is defined in terms of Unicode properties so that would > > Michał> catch things which C does not consider white-space. > > [[:space:]] then, which uses the buffer's syntax table. > The regex under discussion needs to adhere to C syntax but is (may be) > used outside of cc-mode and thus should not rely on syntax table being > set up for C. How about using simply [ \t]? The \r doesn't really add any utility, just confusion, and there seem not to have been any problems with c-or-c++-mode so far. Like you said, including the "bigger" whitespace characters might lead to false positives. > -- > Best regards > ミハウ “𝓶𝓲𝓷𝓪86” ナザレヴイツ > «If at first you don’t succeed, give up skydiving» -- Alan Mackenzie (Nuremberg, Germany).