cmacexp

Homepage: https://www.gnu.org/software/emacs

Author: Francesco Potortì

Summary

Expand C macros in a region

Commentary

USAGE =============================================================

In C mode C-c C-e is bound to `c-macro-expand'.  The result of the
expansion is put in a separate buffer.  A user option allows the
window displaying the buffer to be optimally sized.

When called with a C-u prefix, `c-macro-expand' replaces the selected
region with the expansion.  Both the preprocessor name and the
initial flag can be set by the user.  If `c-macro-prompt-flag' is set
to a non-nil value the user is offered to change the options to the
preprocessor each time `c-macro-expand' is invoked.  Preprocessor
arguments default to the last ones entered.  If `c-macro-prompt-flag'
is nil, one must use M-x set-variable to set a different value for
`c-macro-cppflags'.

A `c-macro-expansion' function is provided for non-interactive use.

INSTALLATION ======================================================

Put the following in your init file.

If you want the *Macroexpansion* window to be not higher than
necessary:

    (setq c-macro-shrink-window-flag t)

If you use a preprocessor other than /lib/cpp (be careful to set a
-C option or equivalent in order to make the preprocessor not to
strip the comments):

    (setq c-macro-preprocessor "gpp -C")

If you often use a particular set of flags:

    (setq c-macro-cppflags "-I /usr/include/local -DDEBUG"

If you want the "Preprocessor arguments: " prompt:

    (setq c-macro-prompt-flag t)

BUG REPORTS =======================================================

Please report bugs, suggestions, complaints and so on to
bug-gnu-emacs@gnu.org and pot@gnu.org (Francesco Potortì).

ACKNOWLEDGMENTS ===================================================

A lot of thanks to Don Maszle who did a great work of testing, bug
reporting and suggestion of new features.  This work has been
partially inspired by Don Maszle and Jonathan Segal's.

BUGS ==============================================================

If the start point of the region is inside a macro definition the
macro expansion is often inaccurate.

Dependencies

Reverse dependencies