From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#19873: Ill-formed regular expression is constructed in forward-paragraph. Date: Thu, 02 Dec 2021 11:39:51 +0100 Message-ID: <87y25347ew.fsf@gnus.org> References: <20150215103122.GA3282@acm.fritz.box> <87o9xodhq4.fsf@jane> <20170309210445.GB4046@acm> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15041"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Marcin Borkowski , 19873@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 02 11:41:30 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1msjWr-0003jF-L3 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Dec 2021 11:41:29 +0100 Original-Received: from localhost ([::1]:47462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1msjWq-0004k4-KZ for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Dec 2021 05:41:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msjWQ-0004DM-4w for bug-gnu-emacs@gnu.org; Thu, 02 Dec 2021 05:41:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35220) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1msjWP-00035P-SJ for bug-gnu-emacs@gnu.org; Thu, 02 Dec 2021 05:41:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1msjWP-0003GQ-R4 for bug-gnu-emacs@gnu.org; Thu, 02 Dec 2021 05:41:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Dec 2021 10:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19873 X-GNU-PR-Package: emacs Original-Received: via spool by 19873-submit@debbugs.gnu.org id=B19873.163844160512464 (code B ref 19873); Thu, 02 Dec 2021 10:41:01 +0000 Original-Received: (at 19873) by debbugs.gnu.org; 2 Dec 2021 10:40:05 +0000 Original-Received: from localhost ([127.0.0.1]:46766 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msjVU-0003Ey-Tl for submit@debbugs.gnu.org; Thu, 02 Dec 2021 05:40:05 -0500 Original-Received: from quimby.gnus.org ([95.216.78.240]:37714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msjVS-0003EO-74 for 19873@debbugs.gnu.org; Thu, 02 Dec 2021 05:40:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=FN3XvIHdVL+NHPsNW8sRiWoLevSdLzipVRnP3Zr/huo=; b=nuz1ZFZJaC0q/tCf23hOgA24f3 7quQsO17GNGQ85n5panylEJiOgmONSiNOQwZKpNvBTGi33bqTVb3IzvF/UEOCAvqBtbx+Mv1cffC3 SNBq/cd39jYnlw/M6Aycb6m6tgRLTcD/jAwcq4riski/EoWiMJWKOPX/j0fiJ55hq3WE=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1msjVI-0008NR-0n; Thu, 02 Dec 2021 11:39:55 +0100 X-Now-Playing: Riow Aral's _Beat Bracelet_: "Brick Bat" In-Reply-To: <20170309210445.GB4046@acm> (Alan Mackenzie's message of "Thu, 9 Mar 2017 21:04:45 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:221289 Archived-At: Alan Mackenzie writes: > I think this idea is workable, but you'll have to check for one or both > of paragraph-s{tart,eparate} starting with "[ \t]+". A good strategy > here might be to begin the target regexp with "^[ \t]*", then begin one > or both components with "[ \t]" (without the "*"). > > There may be other gotchas which I haven't thought about yet. > > One needs a twisted mind to do this sort of thing properly, so I offer my > services to review your upcoming patch. ;-) The problem seems rather intractable to me. Is there really any way to examine a regexp to determine "does this in practice match [ \t]*"? I wonder whether instead of trying to construct a better overall regexp could rewrite the loop. That is, instead of searching for sp-parstart, search for parstart "\\|" parsep, and then check whether (match-beginning 0) of that comes after "^[ \t]*". Or something along those lines. But I don't know whether that'd be any faster in practice. Do you have a test case that demonstrates the slowness? In that case I could try to see whether there's any alternate approach here that's faster. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no