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#16585: c-invalidate-state-cache fails if called when narrowed Date: Wed, 5 Feb 2014 23:16:07 +0000 Message-ID: <20140205231607.GD3381__37209.8025087782$1391642440$gmane$org@acm.acm> References: <52E862C0.3010608@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1391642426 4778 80.91.229.3 (5 Feb 2014 23:20:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Feb 2014 23:20:26 +0000 (UTC) Cc: 16585@debbugs.gnu.org To: Daniel Colascione Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 06 00:20:33 2014 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 1WBBlf-0004jR-SN for geb-bug-gnu-emacs@m.gmane.org; Thu, 06 Feb 2014 00:20:32 +0100 Original-Received: from localhost ([::1]:33682 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBBlf-0002qS-C1 for geb-bug-gnu-emacs@m.gmane.org; Wed, 05 Feb 2014 18:20:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57685) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBBlS-0002qJ-EL for bug-gnu-emacs@gnu.org; Wed, 05 Feb 2014 18:20:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WBBlL-0003fb-4Q for bug-gnu-emacs@gnu.org; Wed, 05 Feb 2014 18:20:18 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37356) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBBlD-0003E6-7P; Wed, 05 Feb 2014 18:20:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WBBlC-00075y-LG; Wed, 05 Feb 2014 18:20: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: Wed, 05 Feb 2014 23:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16585 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: X-Debbugs-Original-Cc: bug-cc-mode@gnu.org, 16585@debbugs.gnu.org, Glenn Morris Original-Received: via spool by 16585-submit@debbugs.gnu.org id=B16585.139164237027227 (code B ref 16585); Wed, 05 Feb 2014 23:20:02 +0000 Original-Received: (at 16585) by debbugs.gnu.org; 5 Feb 2014 23:19:30 +0000 Original-Received: from localhost ([127.0.0.1]:51375 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WBBkg-000754-8o for submit@debbugs.gnu.org; Wed, 05 Feb 2014 18:19:30 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:47303 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WBBke-00074w-7D for 16585@debbugs.gnu.org; Wed, 05 Feb 2014 18:19:28 -0500 Original-Received: (qmail 29786 invoked by uid 3782); 5 Feb 2014 23:19:27 -0000 Original-Received: from acm.muc.de (pD951B331.dip0.t-ipconnect.de [217.81.179.49]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 06 Feb 2014 00:19:26 +0100 Original-Received: (qmail 5224 invoked by uid 1000); 5 Feb 2014 23:16:07 -0000 Content-Disposition: inline In-Reply-To: <52E862C0.3010608@dancol.org> User-Agent: Mutt/1.5.21 (2010-09-15) 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:84651 Archived-At: Hi, Daniel. On Tue, Jan 28, 2014 at 06:09:04PM -0800, Daniel Colascione wrote: > c-invalidate-state-cache can fail if called in a narrowed region: we end > up calling c-clear-char-property for bob even if that's before > point-min, causing remote-text-properties to raise (args-out-of-range 1 2). > We get into this situation when expanding yasnippet snippets; we're > calling c-invalidate-state-cache from c-before-change. > To repro manually, first write this to some buffer. > #include > void foo() { > } > Then (this is important) run M-x c-mode. After starting the mode, move > point to inside foo's body and eval (save-restriction (narrow-to-region > (point-at-bol) (point-at-eol)) (c-invalidate-state-cache (point))). You > should break into the debugger. > The patch below seems correct and fixes the problem for me, but it'd be > nice if Alan could take a look at it before I push it to trunk. The > version of c-invalidate-state-cache in cc-mode trunk is very different. I think I'd like to check that nothing can go awry in c-invalidate-state-cache-1 with the widened buffer. Give me a day or two. -- Alan Mackenzie (Nuremberg, Germany).