Copyright (C) 2000-2012 |
GNU Info (ccmode)Frequently Asked QuestionsFrequently Asked Questions ************************** *Q.* _How do I re-indent the whole file?_ *A.* Visit the file and hit `C-x h' to mark the whole buffer. Then hit `C-M-\'. *Q.* _How do I re-indent the entire function? `C-M-x' doesn't work._ *A.* `C-M-x' is reserved for future Emacs use. To re-indent the entire function hit `C-c C-q'. *Q.* _How do I re-indent the current block?_ *A.* First move to the brace which opens the block with `C-M-u', then re-indent that expression with `C-M-q'. *Q.* _Why doesn't the `RET' key indent the new line?_ *A.* Emacs' convention is that `RET' just adds a newline, and that `C-j' adds a newline and indents it. You can make `RET' do this too by adding this to your `c-mode-common-hook': (define-key c-mode-base-map "\C-m" 'c-context-line-break) This is a very common question. If you want this to be the default behavior, don't lobby me, lobby RMS! :-) *Q.* _I put `(c-set-offset 'substatement-open 0)' in my `.emacs' file but I get an error saying that `c-set-offset''s function definition is void._ *A.* This means that CC Mode wasn't loaded into your Emacs session by the time the `c-set-offset' call was reached, most likely because CC Mode is being autoloaded. Instead of putting the `c-set-offset' line in your top-level `.emacs' file, put it in your `c-mode-common-hook', or simply modify `c-offsets-alist' directly: (setq c-offsets-alist '((substatement-open . 0))) *Q.* _How do I make strings, comments, keywords, and other constructs appear in different colors, or in bold face, etc.?_ *A.* "Syntax Colorization" is a standard Emacs feature, controlled by `font-lock-mode'. CC Mode does not contain font-lock definitions for any of its supported languages. *Q.* _`M-a' and `M-e' used to move over entire balanced brace lists, but now they move into blocks. How do I get the old behavior back?_ *A.* Use `C-M-f' and `C-M-b' to move over balanced brace blocks. Use `M-a' and `M-e' to move by statements, which will also move into blocks. *Q.* _Whenever I try to indent a line or type an "electric" key such as `;', `{', or `}', I get an error that look like this: `Invalid function: (macro . #[...'. What gives?_ *A.* This is a common error when CC Mode hasn't been compiled correctly, especially under Emacs 19.34(1). If you are using the standalone CC Mode distribution, try recompiling it according to the instructions in the `README' file. ---------- Footnotes ---------- (1) Technically, it's because some macros wasn't defined during the compilation, so the byte compiler put in function calls instead of the macro expansions. Later, when the interpreter tries to call the macros as functions, it shows this (somewhat cryptic) error message. automatically generated by info2www version 1.2.2.9 |