Subject: Root cause

From: Dima Kogan <[email-masked]>
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