Subject: bug#6959: [PATCH] Add Microsoft support to cc-mode

From: Stefan Monnier <[email-masked]>
Date: Wed, 01 Sep 2010 08:38:50 +0200

[ Please don't send to both emacs-devel and bug-gnu-emacs, otherwise
every reply in emacs-devel risks generating a new bug-number. ]

> Microsoft uses a... unique programming style (erm, typedef void
> VOID?!) that tends to trip up cc-mode.

What do you mean by "trip up"?  Sounds like a plain bug to me: any
normal program may have such definitions (tho it depends on how "tripped
up" it gets; it's normal for cc-mode to behave suboptimally when
encountering unknown macros and type annotations, but it should try to
be robust in such circumstances).

> Particularly problematic are certain code annotations, as described in
> http://msdn.microsoft.com/en-us/library/aa383701(VS.85).aspx.  This
> patch adds support for this bizarre programming style and allows one
> to work on idiomatic Windows sources comfortably.

Similar needs arise for large projects (e.g. DEFUN and friends in
Emacs's C code), IIUC, right?

So I think we would want to move such project/system-specific outside
cc-langs.el so users can (load "cc-microsoft") or (load "cc-linux") or
(load "cc-emacs").  Tho, loading a file is the wrong interface, so maybe
it can live in cc-langs.el but it should be inside a function so you
could activate it with (cc-enable-microsoft-keywords), or maybe a minor
mode (cc-microsoft-keywords-mode 1), tho turning it off might not be
that important.
The point is to make it modular so it's easy for people to add support
for particular projects.

        Stefan