GNU logs - #19873, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#19873: Ill-formed regular expression is constructed in forward-paragraph.
Resent-From: Alan Mackenzie <acm@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 15 Feb 2015 10:39:01 +0000
Resent-Message-ID: <handler.19873.B.142399673610209 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 19873
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 19873 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.142399673610209
          (code B ref -1); Sun, 15 Feb 2015 10:39:01 +0000
Received: (at submit) by debbugs.gnu.org; 15 Feb 2015 10:38:56 +0000
Received: from localhost ([127.0.0.1]:44317 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YMwbH-0002ea-Rn
	for submit <at> debbugs.gnu.org; Sun, 15 Feb 2015 05:38:56 -0500
Received: from eggs.gnu.org ([208.118.235.92]:59461)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <acm@HIDDEN>) id 1YMwbF-0002eN-LL
 for submit <at> debbugs.gnu.org; Sun, 15 Feb 2015 05:38:54 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <acm@HIDDEN>) id 1YMwb5-0005JY-9o
 for submit <at> debbugs.gnu.org; Sun, 15 Feb 2015 05:38:48 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:56085)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <acm@HIDDEN>)
 id 1YMwb5-0005JU-72
 for submit <at> debbugs.gnu.org; Sun, 15 Feb 2015 05:38:43 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:32938)
 by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <acm@HIDDEN>)
 id 1YMwb0-0006Jm-Hc
 for bug-gnu-emacs@HIDDEN; Sun, 15 Feb 2015 05:38:43 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <acm@HIDDEN>) id 1YMwav-0005GD-VC
 for bug-gnu-emacs@HIDDEN; Sun, 15 Feb 2015 05:38:38 -0500
Received: from colin.muc.de ([193.149.48.1]:28511 helo=mail.muc.de)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <acm@HIDDEN>)
 id 1YMwav-0005G0-LB
 for bug-gnu-emacs@HIDDEN; Sun, 15 Feb 2015 05:38:33 -0500
Received: (qmail 94991 invoked by uid 3782); 15 Feb 2015 10:31:51 -0000
Received: from acm.muc.de (pD951970A.dip0.t-ipconnect.de [217.81.151.10]) by
 colin.muc.de (tmda-ofmipd) with ESMTP;
 Sun, 15 Feb 2015 11:31:50 +0100
Received: (qmail 3374 invoked by uid 1000); 15 Feb 2015 10:31:22 -0000
Date: Sun, 15 Feb 2015 10:31:22 +0000
Message-ID: <20150215103122.GA3282@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.22 (2013-10-16)
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.3 (----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.3 (----)

Hello, Emacs!

In forward-paragraph, L37, a regular expression is constructed as
follows:

(let* ...
 (sp-parstart (concat "^[ \t]*\\(?:" parstart "\\|" parsep "\\)"))
 ...)

.  Here parstart and parsep are, more or less,
paragraph-{start,separate}.

The problem is that parstart and parsep themselves are likely to begin
with "[ \t]*" (the default values certainly do), so we have two
consecutive matchers for an arbitrary amount of whitespace.  This causes
the regexp engine to run very slowly when a line starts with lots of WS
but doesn't match.

This problem seems to be the cause of bug # 19846 (where holding down the
spacebar inside a C comment causes Emacs to seize up when auto-fill mode
is enabled).

-- 
Alan Mackenzie (Nuremberg, Germany).




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.503 (Entity 5.503)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Alan Mackenzie <acm@HIDDEN>
Subject: bug#19873: Acknowledgement (Ill-formed regular expression is
 constructed in forward-paragraph.)
Message-ID: <handler.19873.B.142399673610209.ack <at> debbugs.gnu.org>
References: <20150215103122.GA3282@HIDDEN>
X-Gnu-PR-Message: ack 19873
X-Gnu-PR-Package: emacs
Reply-To: 19873 <at> debbugs.gnu.org
Date: Sun, 15 Feb 2015 10:39:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 19873 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
19873: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D19873
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#19873: Ill-formed regular expression is constructed in forward-paragraph.
Resent-From: Marcin Borkowski <mbork@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 26 Feb 2017 16:45:01 +0000
Resent-Message-ID: <handler.19873.B19873.148812746923970 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 19873
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Alan Mackenzie <acm@HIDDEN>
Cc: 19873 <at> debbugs.gnu.org
Received: via spool by 19873-submit <at> debbugs.gnu.org id=B19873.148812746923970
          (code B ref 19873); Sun, 26 Feb 2017 16:45:01 +0000
Received: (at 19873) by debbugs.gnu.org; 26 Feb 2017 16:44:29 +0000
Received: from localhost ([127.0.0.1]:56965 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ci1vw-0006EY-Oz
	for submit <at> debbugs.gnu.org; Sun, 26 Feb 2017 11:44:28 -0500
Received: from mx1.amu.edu.pl ([150.254.65.108]:49719)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mbork@HIDDEN>) id 1ci1vu-0006EH-C2
 for 19873 <at> debbugs.gnu.org; Sun, 26 Feb 2017 11:44:27 -0500
Received: from localhost (localhost [127.0.0.1])
 by mx1.amu.edu.pl (Postfix) with ESMTP id 82F8F1B1820;
 Sun, 26 Feb 2017 17:44:15 +0100 (CET)
X-Virus-Scanned: amavisd-new at amu.edu.pl
Received: from mx1.amu.edu.pl ([127.0.0.1])
 by localhost (mx1.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id E_-l3zrvYlt4; Sun, 26 Feb 2017 17:44:15 +0100 (CET)
Received: from pp.amu.edu.pl (pp.amu.edu.pl [150.254.65.67])
 by mx1.amu.edu.pl (Postfix) with ESMTPS;
 Sun, 26 Feb 2017 17:44:13 +0100 (CET)
Received: from localhost (pp.amu.edu.pl [127.0.0.1])
 by pp.amu.edu.pl (Postfix) with ESMTP id D6BF762737;
 Sun, 26 Feb 2017 17:44:17 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=amu.edu.pl; h=
 content-type:content-type:mime-version:user-agent:message-id
 :in-reply-to:date:date:references:subject:subject:from:from
 :received:received; s=pp; t=1488127457; x=1489941858; bh=K6gY5vo
 NKcOwsgGDsqKOjxyxbCH+7saMvQilm/RTzW0=; b=UiCBgp05LL/XWr2ywLTE61R
 X3MgSaUO2lbmNf/DwABBLJDr0AEWQPXhiFPgsxQEV8N8Te4/DvQNDIyIg2vOOYop
 +DDLIznzW2KTCOW3ahIqMri/nO/4Wpidl8LaD0lJolEjCTJENnemA9TnQPzyrhhC
 TX8d+jUHEYJqaVYqEWTg=
X-Virus-Scanned: amavisd-new at amu.edu.pl
Received: from pp.amu.edu.pl ([127.0.0.1])
 by localhost (pp.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id qF_l37BCbFeX; Sun, 26 Feb 2017 17:44:17 +0100 (CET)
Received: from localhost (static-dwadziewiec-jedenpiec7.echostar.pl
 [109.232.29.157])
 by pp.amu.edu.pl (Postfix) with ESMTPSA id 9E9DE6277B;
 Sun, 26 Feb 2017 17:44:17 +0100 (CET)
From: Marcin Borkowski <mbork@HIDDEN>
References: <20150215103122.GA3282@HIDDEN>
Date: Sun, 26 Feb 2017 17:44:51 +0100
In-Reply-To: <20150215103122.GA3282@HIDDEN> (Alan Mackenzie's message
 of "Sun, 15 Feb 2015 10:31:22 +0000")
Message-ID: <87o9xodhq4.fsf@jane>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

On 2015-02-15, at 10:31, Alan Mackenzie <acm@HIDDEN> wrote:

> Hello, Emacs!
>
> In forward-paragraph, L37, a regular expression is constructed as
> follows:
>
> (let* ...
>  (sp-parstart (concat "^[ \t]*\\(?:" parstart "\\|" parsep "\\)"))
>  ...)
>
> .  Here parstart and parsep are, more or less,
> paragraph-{start,separate}.
>
> The problem is that parstart and parsep themselves are likely to begin
> with "[ \t]*" (the default values certainly do), so we have two
> consecutive matchers for an arbitrary amount of whitespace.  This causes
> the regexp engine to run very slowly when a line starts with lots of WS
> but doesn't match.
>
> This problem seems to be the cause of bug # 19846 (where holding down the
> spacebar inside a C comment causes Emacs to seize up when auto-fill mode
> is enabled).

Hi Alan, hi all,

I put this bug on my todo-list some time ago and decided now to revisit
it.

I'm wondering what could be done about it.  First of all, my Emacs has
this as paragraph-start:

"\\|[ 	]*$"

and this as paragraph-separate:

"[ 	]*$"

and frankly speaking, I'm not sure why they differ at all (by default).
Also, even though forward-paragraph checks for "^" at their beginning,
they actually don't begin with that character (again, by default).

My first thought is to add a check whether paragraph-start and
paragraph-sep match something like

"^\\^?\\[[[:space:]]+\\][+*]?"

and if yes, make parstart/parsep equal to them, but without the matching
part.

WDYT?

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#19873: Ill-formed regular expression is constructed in forward-paragraph.
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 26 Feb 2017 16:58:02 +0000
Resent-Message-ID: <handler.19873.B19873.148812825725182 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 19873
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Marcin Borkowski <mbork@HIDDEN>
Cc: acm@HIDDEN, 19873 <at> debbugs.gnu.org
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Received: via spool by 19873-submit <at> debbugs.gnu.org id=B19873.148812825725182
          (code B ref 19873); Sun, 26 Feb 2017 16:58:02 +0000
Received: (at 19873) by debbugs.gnu.org; 26 Feb 2017 16:57:37 +0000
Received: from localhost ([127.0.0.1]:56979 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ci28f-0006Y6-Ju
	for submit <at> debbugs.gnu.org; Sun, 26 Feb 2017 11:57:37 -0500
Received: from eggs.gnu.org ([208.118.235.92]:56187)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1ci28d-0006Xt-E7
 for 19873 <at> debbugs.gnu.org; Sun, 26 Feb 2017 11:57:36 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1ci28V-0000bd-8q
 for 19873 <at> debbugs.gnu.org; Sun, 26 Feb 2017 11:57:30 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44347)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1ci28V-0000bW-5L; Sun, 26 Feb 2017 11:57:27 -0500
Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2068
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1ci28U-0003jT-6t; Sun, 26 Feb 2017 11:57:26 -0500
Date: Sun, 26 Feb 2017 18:57:05 +0200
Message-Id: <837f4criu6.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <87o9xodhq4.fsf@jane> (message from Marcin Borkowski on Sun, 26
 Feb 2017 17:44:51 +0100)
References: <20150215103122.GA3282@HIDDEN> <87o9xodhq4.fsf@jane>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

> From: Marcin Borkowski <mbork@HIDDEN>
> Date: Sun, 26 Feb 2017 17:44:51 +0100
> Cc: 19873 <at> debbugs.gnu.org
> 
> First of all, my Emacs has this as paragraph-start:
> 
> "\\|[ 	]*$"
> 
> and this as paragraph-separate:
> 
> "[ 	]*$"
> 
> and frankly speaking, I'm not sure why they differ at all (by default).

I believe this is explained in the Emacs manual, node "Paragraphs".
In a nutshell, these two regexps have different purposes.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#19873: Ill-formed regular expression is constructed in forward-paragraph.
Resent-From: Marcin Borkowski <mbork@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 26 Feb 2017 18:48:02 +0000
Resent-Message-ID: <handler.19873.B19873.14881348608919 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 19873
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: acm@HIDDEN, 19873 <at> debbugs.gnu.org
Received: via spool by 19873-submit <at> debbugs.gnu.org id=B19873.14881348608919
          (code B ref 19873); Sun, 26 Feb 2017 18:48:02 +0000
Received: (at 19873) by debbugs.gnu.org; 26 Feb 2017 18:47:40 +0000
Received: from localhost ([127.0.0.1]:57041 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ci3rA-0002Jk-3l
	for submit <at> debbugs.gnu.org; Sun, 26 Feb 2017 13:47:40 -0500
Received: from mx1.amu.edu.pl ([150.254.65.108]:58481)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mbork@HIDDEN>) id 1ci3r7-0002JW-K3
 for 19873 <at> debbugs.gnu.org; Sun, 26 Feb 2017 13:47:38 -0500
Received: from localhost (localhost [127.0.0.1])
 by mx1.amu.edu.pl (Postfix) with ESMTP id CC4421B2171;
 Sun, 26 Feb 2017 19:47:26 +0100 (CET)
X-Virus-Scanned: amavisd-new at amu.edu.pl
Received: from mx1.amu.edu.pl ([127.0.0.1])
 by localhost (mx1.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id P8hec17PKkDJ; Sun, 26 Feb 2017 19:47:26 +0100 (CET)
Received: from pp.amu.edu.pl (pp.amu.edu.pl [150.254.65.67])
 by mx1.amu.edu.pl (Postfix) with ESMTPS;
 Sun, 26 Feb 2017 19:47:23 +0100 (CET)
Received: from localhost (pp.amu.edu.pl [127.0.0.1])
 by pp.amu.edu.pl (Postfix) with ESMTP id 2EE6262737;
 Sun, 26 Feb 2017 19:47:28 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=amu.edu.pl; h=
 content-type:content-type:mime-version:date:date:in-reply-to
 :message-id:subject:subject:from:from:user-agent:references
 :received:received; s=pp; t=1488134848; x=1489949249; bh=b2qWsyz
 Yq+HGcUdt3DiVY1JSqD1Frm6t7kq4Ltn1Exc=; b=UrhNBEVY0GoLdxRBffIYkVl
 4tFCO3cfQ2MJo3rAoLwRvIzURqUVjLUGrcdHpc13UeDVsijsIt9urwSFfymtWfE9
 WoqlGpwNvjlAiL6XdtQdmDj7xA3Z5UKCGNI4K1bjqhUO/c0vyeDSbp1Le2noLiiS
 0IjxD42Z8tzSIk17FD6A=
X-Virus-Scanned: amavisd-new at amu.edu.pl
Received: from pp.amu.edu.pl ([127.0.0.1])
 by localhost (pp.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id L1q9m3yeN18o; Sun, 26 Feb 2017 19:47:28 +0100 (CET)
Received: from localhost (static-dwadziewiec-jedenpiec7.echostar.pl
 [109.232.29.157])
 by pp.amu.edu.pl (Postfix) with ESMTPSA id D5D1E62600;
 Sun, 26 Feb 2017 19:47:27 +0100 (CET)
References: <20150215103122.GA3282@HIDDEN> <87o9xodhq4.fsf@jane>
 <837f4criu6.fsf@HIDDEN>
User-agent: mu4e 0.9.19; emacs 26.0.50
From: Marcin Borkowski <mbork@HIDDEN>
Message-ID: <87mvd8dc0r.fsf@jane>
In-reply-to: <837f4criu6.fsf@HIDDEN>
Date: Sun, 26 Feb 2017 19:48:10 +0100
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)


On 2017-02-26, at 17:57, Eli Zaretskii <eliz@HIDDEN> wrote:

>> From: Marcin Borkowski <mbork@HIDDEN>
>> Date: Sun, 26 Feb 2017 17:44:51 +0100
>> Cc: 19873 <at> debbugs.gnu.org
>> 
>> First of all, my Emacs has this as paragraph-start:
>> 
>> "\\|[ 	]*$"
>> 
>> and this as paragraph-separate:
>> 
>> "[ 	]*$"
>> 
>> and frankly speaking, I'm not sure why they differ at all (by default).
>
> I believe this is explained in the Emacs manual, node "Paragraphs".
> In a nutshell, these two regexps have different purposes.

My bad, you're right.  Still, this has little to do with the bug itself.

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#19873: Ill-formed regular expression is constructed in forward-paragraph.
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 07 Mar 2017 16:49:01 +0000
Resent-Message-ID: <handler.19873.B19873.148890530522124 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 19873
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Marcin Borkowski <mbork@HIDDEN>
Cc: acm@HIDDEN, 19873 <at> debbugs.gnu.org
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Received: via spool by 19873-submit <at> debbugs.gnu.org id=B19873.148890530522124
          (code B ref 19873); Tue, 07 Mar 2017 16:49:01 +0000
Received: (at 19873) by debbugs.gnu.org; 7 Mar 2017 16:48:25 +0000
Received: from localhost ([127.0.0.1]:44819 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1clIHh-0005km-EW
	for submit <at> debbugs.gnu.org; Tue, 07 Mar 2017 11:48:25 -0500
Received: from eggs.gnu.org ([208.118.235.92]:49387)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1clIHf-0005kZ-MK
 for 19873 <at> debbugs.gnu.org; Tue, 07 Mar 2017 11:48:23 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1clIHX-0007Ak-Cr
 for 19873 <at> debbugs.gnu.org; Tue, 07 Mar 2017 11:48:18 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:39866)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1clIHX-0007AW-96; Tue, 07 Mar 2017 11:48:15 -0500
Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4080
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1clIHW-0000LY-Ct; Tue, 07 Mar 2017 11:48:14 -0500
Date: Tue, 07 Mar 2017 18:47:47 +0200
Message-Id: <83mvcxghjg.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <87o9xodhq4.fsf@jane> (message from Marcin Borkowski on Sun, 26
 Feb 2017 17:44:51 +0100)
References: <20150215103122.GA3282@HIDDEN> <87o9xodhq4.fsf@jane>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

> From: Marcin Borkowski <mbork@HIDDEN>
> Date: Sun, 26 Feb 2017 17:44:51 +0100
> Cc: 19873 <at> debbugs.gnu.org
> 
> My first thought is to add a check whether paragraph-start and
> paragraph-sep match something like
> 
> "^\\^?\\[[[:space:]]+\\][+*]?"
> 
> and if yes, make parstart/parsep equal to them, but without the matching
> part.
> 
> WDYT?

Can you suggest a patch along these lines?

Alan, any comments?

Thanks.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#19873: Ill-formed regular expression is constructed in forward-paragraph.
Resent-From: Alan Mackenzie <acm@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 09 Mar 2017 21:06:02 +0000
Resent-Message-ID: <handler.19873.B19873.148909352129300 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 19873
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Marcin Borkowski <mbork@HIDDEN>
Cc: Eli Zaretskii <eliz@HIDDEN>, 19873 <at> debbugs.gnu.org
Received: via spool by 19873-submit <at> debbugs.gnu.org id=B19873.148909352129300
          (code B ref 19873); Thu, 09 Mar 2017 21:06:02 +0000
Received: (at 19873) by debbugs.gnu.org; 9 Mar 2017 21:05:21 +0000
Received: from localhost ([127.0.0.1]:48079 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cm5FQ-0007cW-TX
	for submit <at> debbugs.gnu.org; Thu, 09 Mar 2017 16:05:21 -0500
Received: from ocolin.muc.de ([193.149.48.4]:10256 helo=mail.muc.de)
 by debbugs.gnu.org with smtp (Exim 4.84_2)
 (envelope-from <acm@HIDDEN>) id 1cm5FP-0007cO-Fs
 for 19873 <at> debbugs.gnu.org; Thu, 09 Mar 2017 16:05:20 -0500
Received: (qmail 19286 invoked by uid 3782); 9 Mar 2017 21:05:17 -0000
Received: from acm.muc.de (p548C735A.dip0.t-ipconnect.de [84.140.115.90]) by
 colin.muc.de (tmda-ofmipd) with ESMTP;
 Thu, 09 Mar 2017 22:05:16 +0100
Received: (qmail 26110 invoked by uid 1000); 9 Mar 2017 21:04:46 -0000
Date: Thu, 9 Mar 2017 21:04:45 +0000
Message-ID: <20170309210445.GB4046@acm>
References: <20150215103122.GA3282@HIDDEN>
 <87o9xodhq4.fsf@jane>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87o9xodhq4.fsf@jane>
User-Agent: Mutt/1.7.2 (2016-11-26)
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Hello, Marcin.

On Sun, Feb 26, 2017 at 17:44:51 +0100, Marcin Borkowski wrote:
> On 2015-02-15, at 10:31, Alan Mackenzie <acm@HIDDEN> wrote:

> > Hello, Emacs!

> > In forward-paragraph, L37, a regular expression is constructed as
> > follows:

> > (let* ...
> >  (sp-parstart (concat "^[ \t]*\\(?:" parstart "\\|" parsep "\\)"))
> >  ...)

> > .  Here parstart and parsep are, more or less,
> > paragraph-{start,separate}.

> > The problem is that parstart and parsep themselves are likely to begin
> > with "[ \t]*" (the default values certainly do), so we have two
> > consecutive matchers for an arbitrary amount of whitespace.  This causes
> > the regexp engine to run very slowly when a line starts with lots of WS
> > but doesn't match.

> > This problem seems to be the cause of bug # 19846 (where holding down the
> > spacebar inside a C comment causes Emacs to seize up when auto-fill mode
> > is enabled).

> Hi Alan, hi all,

> I put this bug on my todo-list some time ago and decided now to revisit
> it.

> I'm wondering what could be done about it.  First of all, my Emacs has
> this as paragraph-start:

> "\\|[ 	]*$"

> and this as paragraph-separate:

> "[ 	]*$"

> and frankly speaking, I'm not sure why they differ at all (by default).
> Also, even though forward-paragraph checks for "^" at their beginning,
> they actually don't begin with that character (again, by default).

> My first thought is to add a check whether paragraph-start and
> paragraph-sep match something like

> "^\\^?\\[[[:space:]]+\\][+*]?"

> and if yes, make parstart/parsep equal to them, but without the matching
> part.

> WDYT?

My first reaction is "This is a good idea, but be very careful!".  For
example, if paragraph-start and/or paragraph-separate begin with
"[ \t]+" (i.e. the paragraph start requires space at BOL), you will miss
it by removing matches of "^\\^?\\[[[:space:]]+\\][+*]?" from them.

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.  ;-)

> -- 
> Marcin Borkowski
> http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
> Faculty of Mathematics and Computer Science
> Adam Mickiewicz University

-- 
Alan Mackenzie (Nuremberg, Germany).




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#19873: Ill-formed regular expression is constructed in forward-paragraph.
Resent-From: Lars Ingebrigtsen <larsi@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 02 Dec 2021 10:41:01 +0000
Resent-Message-ID: <handler.19873.B19873.163844160512464 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 19873
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Alan Mackenzie <acm@HIDDEN>
Cc: Marcin Borkowski <mbork@HIDDEN>, 19873 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
Received: via spool by 19873-submit <at> debbugs.gnu.org id=B19873.163844160512464
          (code B ref 19873); Thu, 02 Dec 2021 10:41:01 +0000
Received: (at 19873) by debbugs.gnu.org; 2 Dec 2021 10:40:05 +0000
Received: from localhost ([127.0.0.1]:46766 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1msjVU-0003Ey-Tl
	for submit <at> debbugs.gnu.org; Thu, 02 Dec 2021 05:40:05 -0500
Received: from quimby.gnus.org ([95.216.78.240]:37714)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1msjVS-0003EO-74
 for 19873 <at> 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=;
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 <larsi@HIDDEN>)
 id 1msjVI-0008NR-0n; Thu, 02 Dec 2021 11:39:55 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
References: <20150215103122.GA3282@HIDDEN> <87o9xodhq4.fsf@jane>
 <20170309210445.GB4046@acm>
X-Now-Playing: Riow Aral's _Beat Bracelet_: "Brick Bat"
Date: Thu, 02 Dec 2021 11:39:51 +0100
In-Reply-To: <20170309210445.GB4046@acm> (Alan Mackenzie's message of "Thu, 9
 Mar 2017 21:04:45 +0000")
Message-ID: <87y25347ew.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Alan Mackenzie <acm@HIDDEN> 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] [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Alan Mackenzie <acm@HIDDEN> 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




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#19873: Ill-formed regular expression is constructed in forward-paragraph.
Resent-From: Lars Ingebrigtsen <larsi@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 02 Dec 2021 10:45:02 +0000
Resent-Message-ID: <handler.19873.B19873.163844188812895 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 19873
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Alan Mackenzie <acm@HIDDEN>
Cc: Marcin Borkowski <mbork@HIDDEN>, 19873 <at> debbugs.gnu.org
Received: via spool by 19873-submit <at> debbugs.gnu.org id=B19873.163844188812895
          (code B ref 19873); Thu, 02 Dec 2021 10:45:02 +0000
Received: (at 19873) by debbugs.gnu.org; 2 Dec 2021 10:44:48 +0000
Received: from localhost ([127.0.0.1]:46770 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1msja4-0003Lv-Gj
	for submit <at> debbugs.gnu.org; Thu, 02 Dec 2021 05:44:48 -0500
Received: from quimby.gnus.org ([95.216.78.240]:37796)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1msja2-0003Ld-Mr
 for 19873 <at> debbugs.gnu.org; Thu, 02 Dec 2021 05:44:47 -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=0ESAFhiUvtwNVbrLX735Et7yH9dUhw3+UYQZqwLlSR8=; b=Eda7fW+Mq2uzkROg9/w9RZOXAg
 3K3t8wtXlq4fYYDYJlWTXu4KGwksc1Dp6MhYTV60gFCIVUqLYunZhe9L2RkHzKynpAsbDTuEuyogF
 EyWN0/7iHjYFrgbT+ePESFuOiMWzxuGHnS8ZlpQpUW1sC33zaJga3gz6G+QDiX//52UI=;
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 <larsi@HIDDEN>)
 id 1msjZt-0008Q6-NL; Thu, 02 Dec 2021 11:44:40 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
References: <20150215103122.GA3282@HIDDEN> <87o9xodhq4.fsf@jane>
 <20170309210445.GB4046@acm> <87y25347ew.fsf@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAFVBMVEWNcHFWLTE3ChCt
 k5Lby8YfAAD///+vu6zwAAAAAWJLR0QGYWa4fQAAAAd0SU1FB+UMAgoSAwnOoaQAAAG3SURBVDjL
 dZRLltwgDEWFwXPAVXNQl+fQsACfoAVUnJP9byVgwJ92hYEHujxJ6GMAAI3Xo6CcEIJjF7tkaJUq
 IIQzsUxFSlRBGA4ATCQmXQNujyNhWrSlrjicgUyzoZA6CE1iJIyGKABQ/pbjN/sMXCkilrOiTjaJ
 BW9F0qvVG0h7FAPPB33b8kDqElfAFyAFxbK6gtR9SfYVFjaX7PguKY90o4ibHeGvFU2S8zJc0bLW
 9yCusUpyEClfqVUnA3w3XxqZj4s+wByrr8EqRw4PgK8GjI3Jn4Gtvrx5096ADcwNqD8pjhcgGngt
 vcoV4KPmO4gl4AW8KhiDd+sHwDV5/xEocv8DweOn4JL4FbR0nYzTD9AeKMWUGzx8KMlUXJ1AL+Ib
 eDiDveyGR6lRXRpVgDaPyEY099YaQ78U2udpGLbY+S6l37nBGzgGa8iA06DQlNJXe5sFgxMttkoO
 QZ4Cq02i7yo5ZrcUY0AeSasZGjhG9zmBSJJZtkK3+7oexrlsWTiDGM57axnPZclX9x3s5bYy+bwA
 id/WGU1yxT/82OZCuLc83X8Z2Z0IEOFuL2nzkAEovB/1DziVspmDzhX9AAAAJXRFWHRkYXRlOmNy
 ZWF0ZQAyMDIxLTEyLTAyVDEwOjE4OjAzKzAwOjAw83l+OQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAy
 MS0xMi0wMlQxMDoxODowMyswMDowMIIkxoUAAAAASUVORK5CYII=
X-Now-Playing: Riow Aral's _Beat Bracelet_: "Bitter Sweet"
Date: Thu, 02 Dec 2021 11:44:37 +0100
In-Reply-To: <87y25347ew.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Thu,
 02 Dec 2021 11:39:51 +0100")
Message-ID: <87tufr476y.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Lars Ingebrigtsen <larsi@HIDDEN> writes: > 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. Ah, there was
 a reproducer in bug#19846 (and it still reproduces). 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> 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.

Ah, there was a reproducer in bug#19846 (and it still reproduces).

I'll poke around here, then.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#19873: Ill-formed regular expression is constructed in forward-paragraph.
Resent-From: Lars Ingebrigtsen <larsi@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 02 Dec 2021 11:19:02 +0000
Resent-Message-ID: <handler.19873.B19873.163844389016246 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 19873
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Alan Mackenzie <acm@HIDDEN>
Cc: Marcin Borkowski <mbork@HIDDEN>, 19873 <at> debbugs.gnu.org
Received: via spool by 19873-submit <at> debbugs.gnu.org id=B19873.163844389016246
          (code B ref 19873); Thu, 02 Dec 2021 11:19:02 +0000
Received: (at 19873) by debbugs.gnu.org; 2 Dec 2021 11:18:10 +0000
Received: from localhost ([127.0.0.1]:46800 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1msk6K-0004Dw-Hz
	for submit <at> debbugs.gnu.org; Thu, 02 Dec 2021 06:18:10 -0500
Received: from quimby.gnus.org ([95.216.78.240]:38314)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1msk6G-0004DP-6e
 for 19873 <at> debbugs.gnu.org; Thu, 02 Dec 2021 06:18:07 -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=heriiMj858g2XELglxiqS4p6wLdkS89U6cEC7C4lAtI=; b=W5gCncsANPl0nSSU+trTcHQrC2
 hrnW+U0XoH1cqBSBUZKfef8oV5G1RcSVTK9Yhsmsh2wvQjxu46UrHzCVHmErCFXO3ksLB+3solqb9
 hw4d5EZlv0hYqX5nYIcJTn2ALm+LV6Vr+V8V7jTiSsPSylFkHRSZ+uyYysOYia5jEKgY=;
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 <larsi@HIDDEN>)
 id 1msk66-0000LS-PM; Thu, 02 Dec 2021 12:17:57 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
References: <20150215103122.GA3282@HIDDEN> <87o9xodhq4.fsf@jane>
 <20170309210445.GB4046@acm> <87y25347ew.fsf@HIDDEN>
 <87tufr476y.fsf@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAIVBMVEUQDQkwLSkiHxpC
 PjvR0M79/f2fnZpgXlrAv72CgHz////dq+NpAAAAAWJLR0QKaND0VgAAAAd0SU1FB+UMAgsPDonR
 2zIAAAGiSURBVDjLddJLT8JAEADg6ZJQjrQmeK0biFeRGK+iKfFa7QDeECjliBgIVw2oP8Do33X2
 1W5L3YTQ2S/z2G0BABwoLyeQf7UmVC/tFcsHOKnKYuHgdF2VUMf4ubLSbpBW7jPv9dpqz3Zv2aPv
 s2x/G+I4cL5eJPCAoPtS6/a8FtIazBH1OajUz8xN098E9ZInzzs0C9ADyOhgg0cHD47BaTIO7oeW
 MIfWlOb6xn4ZXJz2rpf0JG+RYQYdTNUkEzm52d/DBhcq/UbBWMESEtxjDi6OVLSl+fSED+oN9FWU
 wiHW8CiggXcqmoEpiiMFnyp6A4wNMAkLFb1DNriG5RE8EbAGzlXUz2EooI6J6WgD4xkMqXlogAN3
 400OOmPMabmoIc5LxQJq5h7QAl9m4H9AHWXXEjjiroeHAuAlQZDc0xkSOVUB+PmW7pkmiywQpXhA
 7SOC2zKIuaIr8QWUSvEzusA24sqCtYTggFFbfEw5dBUkGHUwDo5hg1EdsQC+yXBLpQzc1goQZzCh
 yS6sN+gZWPHQHnfkeXpcAdYBR6qU2BS/P2Yp9fsldDLvAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIx
 LTEyLTAyVDExOjE1OjE0KzAwOjAw0hwSHAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMS0xMi0wMlQx
 MToxNToxNCswMDowMKNBqqAAAAAASUVORK5CYII=
X-Now-Playing: DACM's =?UTF-8?Q?=5FSt=C3=A9r=C3=A9otypie=5F:?= "Marie"
Date: Thu, 02 Dec 2021 12:17:54 +0100
In-Reply-To: <87tufr476y.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Thu,
 02 Dec 2021 11:44:37 +0100")
Message-ID: <87lf1345nh.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Lars Ingebrigtsen <larsi@HIDDEN> writes: > Ah, there was
 a reproducer in bug#19846 (and it still reproduces). > > I'll poke around
 here, then. The following is about 100x faster in the test case, and doesn't
 seem to lead to any obvious regressions. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Ah, there was a reproducer in bug#19846 (and it still reproduces).
>
> I'll poke around here, then.

The following is about 100x faster in the test case, and doesn't seem to
lead to any obvious regressions.

But it's kinda ugly.

Any comments?

An alternate approach would be to just go line by line, and see whether
the regexp matches at the start of the line (either before or after
skipping past any leading whitespace).  But I'm not sure that's any
prettier.

diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index 59b15e82a8..e0d633d49b 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -238,7 +238,7 @@ forward-paragraph
 		      fill-prefix-regexp "[ \t]*$")
 	    parsep))
 	 ;; This is used for searching.
-	 (sp-parstart (concat "^[ \t]*\\(?:" parstart "\\|" parsep "\\)"))
+	 (sp-parstart (concat "\\(?:" parstart "\\|" parsep "\\)"))
 	 start found-start)
     (while (and (< arg 0) (not (bobp)))
       (if (and (not (looking-at parsep))
@@ -278,7 +278,7 @@ forward-paragraph
 		    ;;      multiple-lines
 		    ;;      (forward-line 1))
 		    (not (bobp)))
-		(while (and (re-search-backward sp-parstart nil 1)
+		(while (and (paragraph--line-search nil sp-parstart)
 			    (setq found-start t)
 			    ;; Found a candidate, but need to check if it is a
 			    ;; REAL parstart.
@@ -328,7 +328,7 @@ forward-paragraph
 		      (not (looking-at parsep))
 		      (looking-at fill-prefix-regexp))
 	    (forward-line 1))
-	(while (and (re-search-forward sp-parstart nil 1)
+	(while (and (paragraph--line-search t sp-parstart)
 		    (progn (setq start (match-beginning 0))
 			   (goto-char start)
 			   (not (eobp)))
@@ -344,6 +344,34 @@ forward-paragraph
     ;; Return the number of steps that could not be done.
     arg))
 
+;; We do it this way because the regexp commonly starts with optional
+;; whitespace.
+(defun paragraph--line-search (forward regexp)
+  "Look for REGEXP starting on a line.
+If FORWARD, search forward.  If not, go backward."
+  (catch 'found
+    (while (and (or (and forward
+                         (not (eobp)))
+                    (and (not forward)
+                         (not (bobp))))
+                (funcall (if forward
+                             #'re-search-forward
+                           #'re-search-backward)
+                         regexp nil 1))
+      (save-excursion
+        (goto-char (match-beginning 0))
+        (beginning-of-line)
+        (save-restriction
+          (narrow-to-region
+           (point) (match-beginning 0))
+          (when (looking-at-p "[ \t]*$")
+            (throw 'found t))))
+      (if forward
+          (unless (eobp)
+            (forward-char 1))
+        (unless (bobp)
+          (backward-char 1))))))
+
 (defun backward-paragraph (&optional arg)
   "Move backward to start of paragraph.
 With argument ARG, do it ARG times;


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#19873: Ill-formed regular expression is constructed in forward-paragraph.
Resent-From: Alan Mackenzie <acm@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 02 Dec 2021 20:46:01 +0000
Resent-Message-ID: <handler.19873.B19873.163847792812656 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 19873
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Lars Ingebrigtsen <larsi@HIDDEN>
Cc: Marcin Borkowski <mbork@HIDDEN>, 19873 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
Received: via spool by 19873-submit <at> debbugs.gnu.org id=B19873.163847792812656
          (code B ref 19873); Thu, 02 Dec 2021 20:46:01 +0000
Received: (at 19873) by debbugs.gnu.org; 2 Dec 2021 20:45:28 +0000
Received: from localhost ([127.0.0.1]:49430 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mssxM-0003I4-3f
	for submit <at> debbugs.gnu.org; Thu, 02 Dec 2021 15:45:28 -0500
Received: from colin.muc.de ([193.149.48.1]:33336 helo=mail.muc.de)
 by debbugs.gnu.org with smtp (Exim 4.84_2)
 (envelope-from <acm@HIDDEN>) id 1mssxJ-0003Hl-9M
 for 19873 <at> debbugs.gnu.org; Thu, 02 Dec 2021 15:45:26 -0500
Received: (qmail 86768 invoked by uid 3782); 2 Dec 2021 20:45:18 -0000
Received: from acm.muc.de (p4fe154df.dip0.t-ipconnect.de [79.225.84.223])
 (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP;
 Thu, 02 Dec 2021 21:45:18 +0100
Received: (qmail 7994 invoked by uid 1000); 2 Dec 2021 20:45:17 -0000
Date: Thu, 2 Dec 2021 20:45:17 +0000
Message-ID: <YakwXbh40S/F7XII@ACM>
References: <20150215103122.GA3282@HIDDEN> <87o9xodhq4.fsf@jane>
 <20170309210445.GB4046@acm> <87y25347ew.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87y25347ew.fsf@HIDDEN>
X-Submission-Agent: TMDA/1.3.x (Ph3nix)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello, Lars.

On Thu, Dec 02, 2021 at 11:39:51 +0100, Lars Ingebrigtsen wrote:
> Alan Mackenzie <acm@HIDDEN> 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]*"?

Back when the bug was new, I started writing a library to analyse a
regular expression and convert it into an equivalent well formed regular
expression.  It's actually working, but is incomplete.  It's currently
2757 lines long, including pretty complete unit testing.  I actually
looked at it again at the start of November.

> 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.

It strikes me as one of these things which needs to be done
systematically, which, as I said, I've already tried (and not yet given
up).  The question presents itself, would the effort be better spent
improving Emacs's regexp engine?

> 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.

Martin Rudalics had the original testcase.  The slowness was exponential
with the number of spaces typed, I think.

> -- 
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no

-- 
Alan Mackenzie (Nuremberg, Germany).




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#19873: Ill-formed regular expression is constructed in forward-paragraph.
Resent-From: Lars Ingebrigtsen <larsi@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 03 Dec 2021 16:16:02 +0000
Resent-Message-ID: <handler.19873.B19873.16385481459399 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 19873
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Alan Mackenzie <acm@HIDDEN>
Cc: Marcin Borkowski <mbork@HIDDEN>, 19873 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
Received: via spool by 19873-submit <at> debbugs.gnu.org id=B19873.16385481459399
          (code B ref 19873); Fri, 03 Dec 2021 16:16:02 +0000
Received: (at 19873) by debbugs.gnu.org; 3 Dec 2021 16:15:45 +0000
Received: from localhost ([127.0.0.1]:52046 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mtBDs-0002Qk-If
	for submit <at> debbugs.gnu.org; Fri, 03 Dec 2021 11:15:45 -0500
Received: from quimby.gnus.org ([95.216.78.240]:53918)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mtBDc-00026C-RS
 for 19873 <at> debbugs.gnu.org; Fri, 03 Dec 2021 11:15:43 -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=yjwuqK6JOgUKBMbnoJj8YSmZbm6VElZ4F1NyZqvx08Y=; b=NlhXbTkuAP1D14AKCLdmAONgei
 5ufhmy+4wuKoX7wi390TcLhts4Tu82oSO6bTwuN7BH93tDJh/PpSbA/qX2u7CBIBlfX89ETugGhiw
 sEz0kSfLvTsBXKj4ok2ABzda1t7aXJwWiLb9s0OpKkoVcnPIF5Svaho4PeHrgQoOSSvg=;
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 <larsi@HIDDEN>)
 id 1mtBDS-0004N8-MC; Fri, 03 Dec 2021 17:15:21 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
References: <20150215103122.GA3282@HIDDEN> <87o9xodhq4.fsf@jane>
 <20170309210445.GB4046@acm> <87y25347ew.fsf@HIDDEN>
 <YakwXbh40S/F7XII@ACM>
X-Now-Playing: Joni Mitchell's _Blue_: "River"
Date: Fri, 03 Dec 2021 17:15:18 +0100
In-Reply-To: <YakwXbh40S/F7XII@ACM> (Alan Mackenzie's message of "Thu, 2 Dec
 2021 20:45:17 +0000")
Message-ID: <875ys5y8a1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Alan Mackenzie <acm@HIDDEN> writes: > Back when the bug was
 new, I started writing a library to analyse a > regular expression and convert
 it into an equivalent well formed regular > expression. It's actually working, 
 but is incomplete. [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Alan Mackenzie <acm@HIDDEN> writes:

> Back when the bug was new, I started writing a library to analyse a
> regular expression and convert it into an equivalent well formed regular
> expression.  It's actually working, but is incomplete.  It's currently
> 2757 lines long, including pretty complete unit testing.  I actually
> looked at it again at the start of November.

Interesting.

> It strikes me as one of these things which needs to be done
> systematically, which, as I said, I've already tried (and not yet given
> up).  The question presents itself, would the effort be better spent
> improving Emacs's regexp engine?

Indeed -- making the Emacs regexp engine transform these complex regexps
into simpler, equivalent forms would be great.  We wouldn't have to use
it on all regexps -- the problem usually rears its head when we're
combining several user-defined regexps into a large one, so if we had a
`simplify-regexp' function that we could stick in here, that'd solve the
issue here (and in similar circumstances elsewhere).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 1 May 2022 14:57:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 01 10:57:31 2022
Received: from localhost ([127.0.0.1]:33918 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nlB0t-0002Vh-0i
	for submit <at> debbugs.gnu.org; Sun, 01 May 2022 10:57:31 -0400
Received: from quimby.gnus.org ([95.216.78.240]:59960)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1nlB0r-0002VS-Of
 for control <at> debbugs.gnu.org; Sun, 01 May 2022 10:57:30 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=aSUXjoIQEKGbvDdTJ4fAoVRwAZpiBerVukrOw4wdrcQ=; b=MWrMgHh8dN2PECBUhsG/mBDxpR
 zbogS7ZCpLB9GmlnirEwQxq0yvt48yxgBbOTqI0qWNereRfXD8R23ihtj11HzpBMDRo+CsHGFApS+
 Ztcta7HlPj1Vw4LsRl95X7ffQsi/SK7u/nGDmlPao300zy//AxxXqdPtizi54oYoMfGg=;
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 <larsi@HIDDEN>) id 1nlB0j-0006Q9-PA
 for control <at> debbugs.gnu.org; Sun, 01 May 2022 16:57:23 +0200
Date: Sun, 01 May 2022 16:57:21 +0200
Message-Id: <87pmkxe1wu.fsf@HIDDEN>
To: control <at> debbugs.gnu.org
From: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: control message for bug #19873
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  reassign 19873 emacs,cc-mode quit 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

reassign 19873 emacs,cc-mode
quit





Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 1 May 2022 14:57:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 01 10:57:49 2022
Received: from localhost ([127.0.0.1]:33927 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nlB1B-0002WV-Q0
	for submit <at> debbugs.gnu.org; Sun, 01 May 2022 10:57:49 -0400
Received: from quimby.gnus.org ([95.216.78.240]:59972)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1nlB19-0002WD-Qu
 for control <at> debbugs.gnu.org; Sun, 01 May 2022 10:57:48 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=9Z9FxpcGXWWfJWnvZGgwiSZrL/fvSNFn4ipFMPkeT1E=; b=Tehmn8AliSVWM7JYzsblH8IJr5
 FvgHFty8+4KVaq5VkqFgwDsnIzUd7ACWHtFBwGCUYPED7U+MZs2PrpaB5KDN8Q8VYPnB7HnOjxJbm
 I2XdfH0bzyraSDBDFbbpXA13xGc9LAskce4fwttoUvMJAQXNIeAOYlh/ZURSgx0oEDRQ=;
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 <larsi@HIDDEN>) id 1nlB12-0006Qe-4q
 for control <at> debbugs.gnu.org; Sun, 01 May 2022 16:57:42 +0200
Date: Sun, 01 May 2022 16:57:39 +0200
Message-Id: <87o80he1wc.fsf@HIDDEN>
To: control <at> debbugs.gnu.org
From: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: control message for bug #19873
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  forcemerge 19873 19846 quit 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

forcemerge 19873 19846
quit





Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 2 May 2022 08:42:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 02 04:42:41 2022
Received: from localhost ([127.0.0.1]:34771 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nlRdh-0000I6-6J
	for submit <at> debbugs.gnu.org; Mon, 02 May 2022 04:42:41 -0400
Received: from quimby.gnus.org ([95.216.78.240]:40474)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1nlRdf-0000Hr-7V
 for control <at> debbugs.gnu.org; Mon, 02 May 2022 04:42:39 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=lmvSid/EM1toEL9Tp1tVuo3dvoYcMDtOcV24nXkx4sk=; b=J1qe/xiUr+5EmPNoOHmbLGTqfv
 oRoMmgSajhupq29+DyOvw8ecc1dQycENBl6uU3eYl4tBXiKrzs3lbtvTr9v1wilkd4P82ryPp7mOp
 wD2nN2dVnD8duCtrY0v63PX/d/dr42kz3fzwulAb58NHHrubkNOEKyIYF1fOTbu+deaM=;
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 <larsi@HIDDEN>) id 1nlRdX-00076a-Eg
 for control <at> debbugs.gnu.org; Mon, 02 May 2022 10:42:33 +0200
Date: Mon, 02 May 2022 10:42:30 +0200
Message-Id: <87wnf48gw9.fsf@HIDDEN>
To: control <at> debbugs.gnu.org
From: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: control message for bug #19873
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  tags 19873 - moreinfo quit 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

tags 19873 - moreinfo
quit






Last modified: Mon, 2 May 2022 08:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.