From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#19846: 25.0.50; Problem with auto-fill-mode and C mode Date: Sat, 14 Feb 2015 16:31:09 +0000 Message-ID: <20150214163109.GA5459@acm.fritz.box> References: <54DCF303.6030202@gmx.at> <20150214114837.96359.qmail@mail.muc.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1423931550 2517 80.91.229.3 (14 Feb 2015 16:32:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 14 Feb 2015 16:32:30 +0000 (UTC) To: 19846@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 14 17:32:19 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YMfdh-00011d-69 for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Feb 2015 17:32:17 +0100 Original-Received: from localhost ([::1]:60296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMfdg-0005y6-Hu for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Feb 2015 11:32:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMfdY-0005xg-LK for bug-gnu-emacs@gnu.org; Sat, 14 Feb 2015 11:32:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YMfdX-0002uK-Mz for bug-gnu-emacs@gnu.org; Sat, 14 Feb 2015 11:32:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMfdS-0002ri-E3; Sat, 14 Feb 2015 11:32:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YMfdS-0003IO-9t; Sat, 14 Feb 2015 11:32:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sat, 14 Feb 2015 16:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19846 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 19846-submit@debbugs.gnu.org id=B19846.142393150112639 (code B ref 19846); Sat, 14 Feb 2015 16:32:02 +0000 Original-Received: (at 19846) by debbugs.gnu.org; 14 Feb 2015 16:31:41 +0000 Original-Received: from localhost ([127.0.0.1]:43977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YMfd7-0003Hn-3m for submit@debbugs.gnu.org; Sat, 14 Feb 2015 11:31:41 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:20602 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YMfd4-0003Hd-Lz for 19846@debbugs.gnu.org; Sat, 14 Feb 2015 11:31:39 -0500 Original-Received: (qmail 41255 invoked by uid 3782); 14 Feb 2015 16:31:37 -0000 Original-Received: from acm.muc.de (pD9518CA9.dip0.t-ipconnect.de [217.81.140.169]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 14 Feb 2015 17:31:36 +0100 Original-Received: (qmail 5882 invoked by uid 1000); 14 Feb 2015 16:31:09 -0000 Content-Disposition: inline In-Reply-To: <20150214114837.96359.qmail@mail.muc.de> User-Agent: Mutt/1.5.22 (2013-10-16) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:99393 Archived-At: Hi, Martin. On Sat, Feb 14, 2015 at 11:48:37AM -0000, Alan Mackenzie wrote: > In article you wrote: > > With current trunk/master and emacs -Q evaluate the following form > > (add-hook > > 'c-mode-hook > > '(lambda () > > (turn-on-auto-fill) > > (set (make-local-variable 'fill-column) 72))) > > and visit ~/src/xterm.c. Go to the end of that file, move a few lines > > backwards so that point is at the beginning of some non-empty line > > within the doc-string of `x-frame-normalize-before-maximize' (which is > > coded as a C comment). Now keep the SPC key pressed. Here Emacs > > consumes the entire available CPU and eventually redisplay gets stuck > > completely. This used to work without problems in Emacs 24.3. > A quick use of the profiler shows that forward-paragraph is taking ~87% > of the total CPU. There'll be a reason for this. I'll have a look at it. I think I've found it. In foward-paragraph (paragraphs.el) L+37, sp-parstat is bound as follows: (sp-parstart (concat "^[ \t]*\\(?:" parstart "\\|" parsep "\\)")) , where parstart and parsep are, basically, paragraph-start and paragraph-separate. In CC Mode, paragraph-s{tart,eparate} both start with "[ \t]*". So when a regexp search for sp-parstart is done on a non-matching line beginning with spaces, there will be a lot of alternative ways for the regexp engine to attempt to match the spaces before finally giving up on the line. The optimal solution to the bug would involve intelligently combining parstart and parsep into a safe regexp. I don't know how to do this (suggestions welcome). The alternative seems to be to search for parstart and parsep separately inside an `or' form. Any thoughts? > > martin -- Alan Mackenzie (Nuremberg, Germany).