Subject: Re: bug#10480: 24.0.92;?cc-mode breakage due to "Large brace-block initialisation makes CC?Mode slow: Fix"

From: Alan Mackenzie <[email-masked]>
Date: Sun, 15 Jan 2012 09:59:41 +0000

In article <[email-masked]> you
wrote:
>
> I'm currently tracking the Emacs BZR/GIT repo for the current bleeding
> edge code. It seems it broke over Christmas. While editing C code I
> was
> constantly hit with back traces like the following:

> Debugger entered--Lisp error: (args-out-of-range 10389 15607)
>  parse-partial-sexp(10389 15607)
>  c-literal-limits(nil nil t)
>  c-indent-new-comment-line(t)
>  default-indent-new-line(t)
>  do-auto-fill()
>  apply(do-auto-fill nil)
>  c-mask-paragraph(nil t do-auto-fill)
>  c-do-auto-fill()
>  self-insert-command(1)
>  newline()
>  newline-and-indent()
>  call-interactively(newline-and-indent nil nil)

Sorry about this, and thanks for reporting the bug.

> This often left emacs unusable, sometime wiping the current editing
> buffer. Bisecting through the code tree I found it was the Large
> brace-block fix that causes the regression.

This looks to be the same as bug #10463 which has already been fixed.
The fix was committed to the savannah repository on 2012-01-11, revision
#106849.

Would you please apply that bug's patch and let me know if it fails to
fix the current bug.  Here is that patch:

*** orig/cc-engine.el	2012-01-09 20:27:51.000000000 +0000
--- cc-engine.el	2012-01-10 11:09:42.000000000 +0000
***************
*** 4225,4236 ****
  
  Note that this function might do hidden buffer changes.	 See the
  comment at the start of cc-engine.el for more info."
!   (let* ((safe-place (c-state-safe-place (point)))
! 	 (lit (c-state-pp-to-literal safe-place (point))))
!     (or (cadr lit)
! 	(and detect-cpp
! 	     (save-excursion (c-beginning-of-macro))
! 	     'pound))))
  
  (defun c-literal-limits (&optional lim near not-in-delimiter)
    "Return a cons of the beginning and end positions of the comment or
--- 4225,4238 ----
  
  Note that this function might do hidden buffer changes.	 See the
  comment at the start of cc-engine.el for more info."
!   (save-restriction
!     (widen)
!     (let* ((safe-place (c-state-safe-place (point)))
! 	   (lit (c-state-pp-to-literal safe-place (point))))
!       (or (cadr lit)
! 	  (and detect-cpp
! 	       (save-excursion (c-beginning-of-macro))
! 	       'pound)))))
  
  (defun c-literal-limits (&optional lim near not-in-delimiter)
    "Return a cons of the beginning and end positions of the comment or
***************
*** 4250,4258 ****
    (save-excursion
      (let* ((pos (point))
  	   (lim (or lim (c-state-safe-place pos)))
! 	   (pp-to-lit (c-state-pp-to-literal lim pos))
  	   (state (car pp-to-lit))
- 	   (lit-type (cadr pp-to-lit))
  	   (lit-limits (car (cddr pp-to-lit))))
  
        (cond
--- 4252,4261 ----
    (save-excursion
      (let* ((pos (point))
  	   (lim (or lim (c-state-safe-place pos)))
! 	   (pp-to-lit (save-restriction
! 			(widen)
! 			(c-state-pp-to-literal lim pos)))
  	   (state (car pp-to-lit))
  	   (lit-limits (car (cddr pp-to-lit))))
  
        (cond

> Regards,

> Alex

-- 
Alan Mackenzie (Nuremberg, Germany).