Macros which needn't (or mustn't) be followed by a semicolon when you
invoke them, macros with semicolons, are very common. These can
cause CC Mode to parse the next line wrongly as a
statement-cont (see Function Symbols) and thus mis-indent
it. At the top level, a macro invocation before a defun start can
cause, for example,
c-beginning-of-defun (C-M-a) not to
find the correct start of the current function.
You can prevent these by specifying which macros have semicolons. It doesn't matter whether or not such a macro has a parameter list:
- There are no macros with semicolons.
- a list of strings
- Each string is the name of a macro with a semicolon. Only valid
#definenames are allowed here. For example, to set the default value, you could write the following into your .emacs:(setq c-macro-names-with-semicolon '("Q_OBJECT" "Q_PROPERTY" "Q_DECLARE" "Q_ENUMS"))
- a regular expression
- This matches each symbol which is a macro with a semicolon. It must not match any string which isn't a valid
#definename. For example:(setq c-macro-names-with-semicolon "\\<\\(CLEAN_UP_AND_RETURN\\|Q_[[:upper:]]+\\)\\>")
Call this (non-interactive) function, which sets internal variables, each time you change the value of
c-macro-names-with-semicolonafter the major mode function has run. It takes no arguments, and its return value has no meaning. This function is called by CC Mode's initialization code, after the mode hooks have run.