all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: 19846@debbugs.gnu.org
Subject: bug#19846: 25.0.50; Problem with auto-fill-mode and C mode
Date: Sat, 14 Feb 2015 16:31:09 +0000	[thread overview]
Message-ID: <20150214163109.GA5459@acm.fritz.box> (raw)
In-Reply-To: <20150214114837.96359.qmail@mail.muc.de>

Hi, Martin.

On Sat, Feb 14, 2015 at 11:48:37AM -0000, Alan Mackenzie wrote:

> In article <mailman.19768.1423766347.1147.bug-gnu-emacs@gnu.org> 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).





  reply	other threads:[~2015-02-14 16:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-12 18:37 bug#19846: 25.0.50; Problem with auto-fill-mode and C mode martin rudalics
2015-02-13 17:07 ` Stefan Monnier
     [not found] ` <jwv4mqp91vo.fsf-monnier+emacsbugs@gnu.org>
2015-02-13 18:27   ` martin rudalics
     [not found] ` <mailman.19768.1423766347.1147.bug-gnu-emacs@gnu.org>
2015-02-14 11:48   ` Alan Mackenzie
2015-02-14 16:31     ` Alan Mackenzie [this message]
2015-02-14 18:21     ` martin rudalics
2022-05-01 10:08       ` Lars Ingebrigtsen
2022-05-01 11:35         ` Alan Mackenzie
     [not found]         ` <Ym5wnNUf/qHOVi9F@ACM>
2022-05-01 11:44           ` Lars Ingebrigtsen
2022-05-01 14:53             ` Alan Mackenzie
2022-05-01 14:55               ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150214163109.GA5459@acm.fritz.box \
    --to=acm@muc.de \
    --cc=19846@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.