bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5649: 23.1.92; Indentation problems in C mode


From: Alan Mackenzie
Subject: bug#5649: 23.1.92; Indentation problems in C mode
Date: Mon, 1 Mar 2010 18:04:01 +0000
User-agent: Mutt/1.5.9i

Hello, again,

On Mon, Mar 01, 2010 at 10:17:00AM -0500, Michael Welsh Duggan wrote:
> Alan Mackenzie <acm@muc.de> writes:

> > I've just committed the folowing patch, which should fix the bug:

> I'm afraid this causes a much more serious bug.  Recipe:

> emacs -Q
> Open a new C-mode file.  Then type the following:
> #if FOO
> #endif

> int bar;

Sorry.

> For me the following happens:  The #endif is not fontified.  The "int
> bar" is not fontified.  The semicolon causes an error.  I have verified
> that reverting the patch below goes back to the old behavior, so this
> patch is what is causing the bug.

Yes.

> > === modified file 'lisp/progmodes/cc-engine.el'
> > --- lisp/progmodes/cc-engine.el     2010-02-25 21:21:25 +0000
> > +++ lisp/progmodes/cc-engine.el     2010-03-01 11:23:59 +0000
> > @@ -2641,7 +2641,8 @@
> >     ;; (car c-state-cache).  There can be no open parens/braces/brackets
> >     ;; between `good-pos'/`good-pos-actual-macro-start' and (point-max),
> >     ;; due to the interface spec to this function.
> > -   (setq pos (if good-pos-actual-macro-end
> > +   (setq pos (if (and good-pos-actual-macro-end
> > +                      (> in-macro-start good-pos-actual-macro-start))
> >                   (1+ good-pos-actual-macro-end) ; get outside the macro as
> >                                     ; marked by a `category' text property.
> >                 good-pos))

I was thrown by my own bad commenting.  :-(  I've committed a correction
to this.  The relevant diff (wrt the buggy "middle" version) is:


=== modified file 'lisp/progmodes/cc-engine.el'
--- lisp/progmodes/cc-engine.el 2010-03-01 11:31:42 +0000
+++ lisp/progmodes/cc-engine.el 2010-03-01 17:42:35 +0000
@@ -2591,7 +2591,7 @@
   (save-restriction
     (narrow-to-region 1 (point-max))
     (save-excursion
-      (let* ((in-macro-start   ; point-max or beginning of macro containing it
+      (let* ((in-macro-start   ; start of macro containing (point-max) or nil.
              (save-excursion
                (goto-char (point-max))
                (and (c-beginning-of-macro)
@@ -2642,7 +2642,8 @@
        ;; between `good-pos'/`good-pos-actual-macro-start' and (point-max),
        ;; due to the interface spec to this function.
        (setq pos (if (and good-pos-actual-macro-end
-                          (> in-macro-start good-pos-actual-macro-start))
+                          (not (eq good-pos-actual-macro-start
+                                   in-macro-start)))
                      (1+ good-pos-actual-macro-end) ; get outside the macro as
                                        ; marked by a `category' text property.
                    good-pos))


> > Thanks for the clean and concise bug report!

I hope it's right now.

> -- 
> Michael Welsh Duggan
> (mwd@cert.org)

-- 
Alan Mackenzie (Nuremberg, Germany).






reply via email to

[Prev in Thread] Current Thread [Next in Thread]