GNU bug report logs -
#5649
23.1.92; Indentation problems in C mode
Previous Next
Reported by: mwd <at> md5i.com
Date: Thu, 25 Feb 2010 16:18:02 UTC
Severity: serious
Done: Chong Yidong <cyd <at> stupidchicken.com>
Bug is archived. No further changes may be made.
Full log
Message #28 received at 5649 <at> debbugs.gnu.org (full text, mbox):
Hello, again,
On Mon, Mar 01, 2010 at 10:17:00AM -0500, Michael Welsh Duggan wrote:
> Alan Mackenzie <acm <at> 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 <at> cert.org)
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 15 years and 85 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.