GNU bug report logs - #13713
24.3.50; C indent produces error when narrowing is active

Previous Next

Packages: cc-mode, emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Thu, 14 Feb 2013 08:59:02 UTC

Severity: normal

Tags: fixed

Found in versions 25.3, 24.3.50

Fixed in version 26.1

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 13713 <at> debbugs.gnu.org (full text, mbox):

From: Dima Kogan <dima <at> secretsauce.net>
To: 13713 <at> debbugs.gnu.org
Subject: Root cause
Date: Sun, 17 Feb 2013 00:06:49 -0800
I looked at it some more, and it's pretty clear what's happening. The
indentation command calls (c-determine-limit), which in turn calls
(parse-partial-sexp) in many places. (parse-partial-sexp) fails if asked to look
at the buffer outside of the narrowed region. Thus one way to fix this is to
wrap the definition of c-determine-limit in (save-restriction (widen) ... ).
This is a construct that already appears in many places in cc-engine.el, so
maybe it's appropriate here. This advice makes it work:


(defadvice c-determine-limit (around c-determine-limit-works-with-narrowing
				     (how-far-back &optional start try-size)
				     activate)
  "I lift the restriction around this function to get around emacs bug 13713"
  (save-restriction (widen) ad-do-it))


I don't know enough about the internal design of cc-engine.el to know if this is
an appropriate place to lift the restriction, or if lifting it is the way to go
at all.

Thanks




This bug report was last modified 7 years and 232 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.