all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: Another small problem of CC Mode
Date: 12 Jan 2007 10:03:51 +0100	[thread overview]
Message-ID: <20070112101615.GA1659@muc.de> (raw)
In-Reply-To: <BAY112-F1841EE7751C2F2CD25C49CDAB00@phx.gbl>

Hi, Guanpeng!

On Fri, Jan 12, 2007 at 09:58:31AM +0800, Herbert Euler wrote:
> Hi,
> 
> In a file that contains C program like this:
> 
>    extern void g(void);
>    extern void h(void);
> 
>    int
>    f(void)
>    {
>            do {
>    #ifdef M1
>            } while (g());
>    #else
>            } while (h());
>    #endif /* M1 */
>    }

> Many functions in CC mode will behave incorrectly:
> `c-beginning-of-defun' and `c-end-of-defun' cannot go to the right
> place; `c-indent-command' cannot indent to the right column;
> `c-electric-brace' tells an error, which is not, when typing the `}'
> that finishes the function `f'; and so on.

Yes.  C is a ghastly language.  ;-)

> Of course, this is rare.  But will making CC Mode detect this
> situation and behave in a right way need much effort?

It's difficult to make Emacs's syntax stuff only see one of the "}"s.
Not impossible, just difficult.  I've been thinking about it, off and on,
for about two years now.  Fixing it would probably take more effort than
it's worth - but a mention in the "Limitation and Known Bugs" section of
the manual might be sensible.

> Thanks in advance.
 
> Regards,
> Guanpeng Xu

-- 
Alan Mackenzie (Ittersbach, Germany)

  parent reply	other threads:[~2007-01-12  9:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-12  1:58 Another small problem of CC Mode Herbert Euler
2007-01-12  2:05 ` Herbert Euler
2007-01-12  3:13 ` Alfred M. Szmidt
2007-01-12  9:03 ` Alan Mackenzie [this message]
2007-01-12 10:06   ` Herbert Euler
2007-01-13  2:12     ` Miles Bader

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070112101615.GA1659@muc.de \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.