[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with braces in C
From: |
Colin S. Miller |
Subject: |
Re: Problem with braces in C |
Date: |
Thu, 05 Nov 2009 23:52:00 +0000 |
User-agent: |
Mozilla-Thunderbird 2.0.0.22 (X11/20090706) |
Burkhard Schultheis wrote:
Am 05.11.2009 19:47, schrieb despen@verizon.net:
Are there #if/#ifdef around some parts of the braces?
No. ;-)
Regards
Burkhard
Hmm.
The normal way of spooking paren-mode is to do something like this, as Scott
suggested
#if DEBUG
void myFunc(int a, float b, const char *FILE, int LINE) {
#else
void myFunc(int a, float b) {
#endif
replacing with
#if DEBUG
void myFunc(int a, float b, const char *FILE, int LINE)
#else
void myFunc(int a, float b)
#endif
{
will fix it.
As paren mode looks at the file before it pre-processed, it needs the brackets
to match literally.
Other things that can spook it include (nb. brackets include {} () [] - if the
order doesn't match, then
paren-mode can get confused)
1) Brackets in C++ style // comments, if C mode doesn't define these as a
comment.
2) Brackets in pre-processor expansions.
Try placing the cursor immediately after the last curly bracket, and pressing
C-M-p. This will jump the cursor to what emacs thinks is the matching bracket.
Likewise, pressing C-M-n on an opening bracket will make the cursor jump
to the corresponding closing bracket.
hide-show-mode might be useful to see how emacs is blocking the code,
but hide-show-mode might get to confused to be much help.
HTH,
Colin S. Miller
--
Replace the obvious in my email address with the first three letters of the
hostname to reply.