From: Alan Mackenzie <acm@muc.de>
To: Michael Welsh Duggan <mwd@cert.org>
Cc: Chong Yidong <cyd@stupidchicken.com>,
"5649@debbugs.gnu.org" <5649@debbugs.gnu.org>
Subject: bug#5649: 23.1.92; Indentation problems in C mode
Date: Mon, 1 Mar 2010 18:04:01 +0000 [thread overview]
Message-ID: <20100301180401.GA2864@muc.de> (raw)
In-Reply-To: <tntocj8ul5f.fsf@maru.green.cert.org>
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).
next prev parent reply other threads:[~2010-03-01 18:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-25 16:11 bug#5649: 23.1.92; Indentation problems in C mode Michael Welsh Duggan
2010-02-27 0:12 ` Chong Yidong
2010-03-01 11:38 ` Alan Mackenzie
2010-03-01 15:00 ` Chong Yidong
2010-03-01 15:17 ` Michael Welsh Duggan
2010-03-01 18:04 ` Alan Mackenzie [this message]
2010-03-01 18:40 ` Michael Welsh Duggan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100301180401.GA2864@muc.de \
--to=acm@muc.de \
--cc=5649@debbugs.gnu.org \
--cc=cyd@stupidchicken.com \
--cc=mwd@cert.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).