From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.bugs Subject: bug#19873: Ill-formed regular expression is constructed in forward-paragraph. Date: Sun, 26 Feb 2017 17:44:51 +0100 Message-ID: <87o9xodhq4.fsf@jane> References: <20150215103122.GA3282@acm.fritz.box> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1488127513 26676 195.159.176.226 (26 Feb 2017 16:45:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 26 Feb 2017 16:45:13 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 19873@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Feb 26 17:45:09 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ci1wX-00069z-4B for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Feb 2017 17:45:05 +0100 Original-Received: from localhost ([::1]:47478 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ci1wd-0000AY-9R for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Feb 2017 11:45:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ci1wX-0000A2-Dk for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2017 11:45:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ci1wU-0004kD-AE for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2017 11:45:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58766) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ci1wT-0004k0-VP for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2017 11:45:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ci1wT-0006Fl-PO for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2017 11:45:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Marcin Borkowski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Feb 2017 16:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19873 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19873-submit@debbugs.gnu.org id=B19873.148812746923970 (code B ref 19873); Sun, 26 Feb 2017 16:45:01 +0000 Original-Received: (at 19873) by debbugs.gnu.org; 26 Feb 2017 16:44:29 +0000 Original-Received: from localhost ([127.0.0.1]:56965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ci1vw-0006EY-Oz for submit@debbugs.gnu.org; Sun, 26 Feb 2017 11:44:28 -0500 Original-Received: from mx1.amu.edu.pl ([150.254.65.108]:49719) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ci1vu-0006EH-C2 for 19873@debbugs.gnu.org; Sun, 26 Feb 2017 11:44:27 -0500 Original-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 Original-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) Original-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) Original-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 Original-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) Original-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) In-Reply-To: <20150215103122.GA3282@acm.fritz.box> (Alan Mackenzie's message of "Sun, 15 Feb 2015 10:31:22 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:129827 Archived-At: On 2015-02-15, at 10:31, Alan Mackenzie 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