unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Chong Yidong <cyd@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Another bug in CC Mode's state cache.
Date: Fri, 20 Apr 2012 20:04:50 +0000	[thread overview]
Message-ID: <20120420200450.GA3541@acm.acm> (raw)

Hi, Yidong.

I've found and corrected another CC Mode state cache bug.  It occurred in
situations like this:

         {      }        (         {  }
	 a      b        c         e  f

Insert a closing paren after c:


         {      }        (    )     {  }
	 a      b        c    d     e  f

Previously, the backward search from e for a brace pair was bounded by
the paren at c.  After the insertion of d, the the paren pair c-d is
invisible to backward searching, hence the brace pair a-b is spuriously
found, leading to a cache corruption.

The solution is to use the cache's memory of c rather than the paren in
the buffer to bound the search.  This works.  I have tested it on 100,000
random points in xdisp.c and 20,000 points in lisp.h.  The results with
the new bugfix are identical to those without.

This clearly isn't a "regression".  Would it nevertheless be OK to
install this fix in the Emacs 24 branch?

-- 
Alan Mackenzie (Nuremberg, Germany).



             reply	other threads:[~2012-04-20 20:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-20 20:04 Alan Mackenzie [this message]
2012-04-20  6:19 ` Another bug in CC Mode's state cache Leo
2012-04-21  7:22   ` Alan Mackenzie
2012-04-21  2:30 ` Stefan Monnier
2012-04-21  7:19   ` Alan Mackenzie

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20120420200450.GA3541@acm.acm \
    --to=acm@muc.de \
    --cc=cyd@gnu.org \
    --cc=emacs-devel@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).