<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wikemacs.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mctpyt</id>
	<title>WikEmacs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wikemacs.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mctpyt"/>
	<link rel="alternate" type="text/html" href="https://wikemacs.org/wiki/Special:Contributions/Mctpyt"/>
	<updated>2026-04-21T00:09:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wikemacs.org/index.php?title=CC-mode&amp;diff=2846</id>
		<title>CC-mode</title>
		<link rel="alternate" type="text/html" href="https://wikemacs.org/index.php?title=CC-mode&amp;diff=2846"/>
		<updated>2012-05-26T00:07:08Z</updated>

		<summary type="html">&lt;p&gt;Mctpyt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox major-mode&lt;br /&gt;
|title = C&lt;br /&gt;
|library = cc-mode&lt;br /&gt;
|command = c-mode&lt;br /&gt;
|builtin = yes&lt;br /&gt;
|auto activates = *.c *.h *.xbm *.xpm *.y *.yacc *.lex *.i *.m&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''c-mode''' is the default [[major mode]] for editing [[C]] source files. Its major features are customizable indentation and font-locking (coloring of code). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-----DONT REMOVE ANYTHING FROM THIS TEMPLATE ------------------------------&amp;gt;&lt;br /&gt;
&amp;lt;!-----FEW MONTHS, YEARS FROM NOW, MAYBE WE CAN DELETE STUFF. NOT NOW ------------------&amp;gt;&lt;br /&gt;
&amp;lt;!-----YOU DON&amp;quot;T WANT WIKEMACS TO BE ANOTHER EMACSWIKI RIGHT ------------------&amp;gt;&lt;br /&gt;
&amp;lt;!-----PLEASE BE PATIENT AND CO-OPERATE FOR GREATER GOOD ------------------&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-------------------------------------------------------------------------&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Basic setup =&lt;br /&gt;
&lt;br /&gt;
c-mode is bundled with Emacs by default. No additional setup is required. &lt;br /&gt;
&lt;br /&gt;
= Helpful keybindings =&lt;br /&gt;
&lt;br /&gt;
; {{Keys|C-M-a}}&lt;br /&gt;
: Go to the beginning of the current function. If you are between 2 functions, go the start of the previous one.&lt;br /&gt;
&lt;br /&gt;
; {{Keys|C-M-e}}&lt;br /&gt;
: Go to the end of the current function. If you are between 2 functions, go to the end of the next one. &lt;br /&gt;
&lt;br /&gt;
; {{Keys|C-M-h}}&lt;br /&gt;
: Mark current function&lt;br /&gt;
&lt;br /&gt;
; {{Keys|M-a}}&lt;br /&gt;
: Go to beginning of current statement (or next one).&lt;br /&gt;
&lt;br /&gt;
; {{Keys|M-e}}&lt;br /&gt;
: Go to end of current statement (or previous one).&lt;br /&gt;
&amp;lt;!-------------------------------------------------------------------------&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Common Customization =&lt;br /&gt;
&amp;lt;!-- Customization common to all platforms goes here --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Style ==&lt;br /&gt;
Any mode based on {{ModeLink|cc-mode}} provides automatic indentation. The default style is &amp;lt;code&amp;gt;gnu&amp;lt;/code&amp;gt;. It is the one recommended by the Free Software Foundation for GNU projects but you can use a different one.&lt;br /&gt;
&lt;br /&gt;
Here is a basic list of predefined styles:&lt;br /&gt;
; &amp;lt;code&amp;gt;gnu&amp;lt;/code&amp;gt;&lt;br /&gt;
: The default style for GNU projects&lt;br /&gt;
; &amp;lt;code&amp;gt;k&amp;amp;r&amp;lt;/code&amp;gt;&lt;br /&gt;
: What Kernighan and Ritchie, the authors of C used in their book&lt;br /&gt;
; &amp;lt;code&amp;gt;bsd&amp;lt;/code&amp;gt;&lt;br /&gt;
: What BSD developers use, aka “Allman style” after Eric Allman.&lt;br /&gt;
; &amp;lt;code&amp;gt;whitesmith&amp;lt;/code&amp;gt;&lt;br /&gt;
: Popularized by the examples that came with Whitesmiths C, an early commercial C compiler.&lt;br /&gt;
; &amp;lt;code&amp;gt;stroustrup&amp;lt;/code&amp;gt;&lt;br /&gt;
: What Stroustrup, the author of C++ used in his book&lt;br /&gt;
; &amp;lt;code&amp;gt;ellemtel&amp;lt;/code&amp;gt;&lt;br /&gt;
: Popular C++ coding standards as defined by “Programming in C++, Rules and Recommendations,” Erik Nyquist and Mats Henricson, Ellemtel&lt;br /&gt;
; &amp;lt;code&amp;gt;linux&amp;lt;/code&amp;gt;&lt;br /&gt;
: What the Linux developers use for kernel development&lt;br /&gt;
; &amp;lt;code&amp;gt;python&amp;lt;/code&amp;gt;&lt;br /&gt;
: What Python developers use for extension modules&lt;br /&gt;
; &amp;lt;code&amp;gt;java&amp;lt;/code&amp;gt;&lt;br /&gt;
: The default style for java-mode (see below)&lt;br /&gt;
; &amp;lt;code&amp;gt;user&amp;lt;/code&amp;gt;&lt;br /&gt;
: When you want to define your own style&lt;br /&gt;
&lt;br /&gt;
You can look the [http://cc-mode.sourceforge.net/html-manual/Built_002din-Styles.html#Built_002din-Styles cc-mode documentation] for a complete list of builtin style.&lt;br /&gt;
For visual example of each style you can look the [http://en.wikipedia.org/wiki/Indent_style Wikipedia article on indenting style].&lt;br /&gt;
&lt;br /&gt;
* The default style is set via the variable {{Variable|c-default-style}}&lt;br /&gt;
* Use {{CommandKeys|C-c .|c-set-style}} to change the indentation style of the current buffer.&lt;br /&gt;
* The amount of space use to indent is set via the variable {{Variable|c-basic-offset}}.&lt;br /&gt;
&lt;br /&gt;
To set the default style to K&amp;amp;R and use 4 spaces, add this to your {{EmacsConfigFile}}:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lisp&amp;quot;&amp;gt;&lt;br /&gt;
; set k&amp;amp;r style&lt;br /&gt;
(setq c-default-style &amp;quot;k&amp;amp;r&amp;quot;)&lt;br /&gt;
; indent with 4 spaces&lt;br /&gt;
(setq c-basic-offset 4)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-------------------------------------------------------------------------&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= [[GNU/Linux]] =&lt;br /&gt;
&amp;lt;!-- Customization/Notes specific to GNU/Linux goes here --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-------------------------------------------------------------------------&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= [[OS X]] =&lt;br /&gt;
&amp;lt;!-- Customization/Notes specific to OS X goes here --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-------------------------------------------------------------------------&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= [[Windows]] =&lt;br /&gt;
&amp;lt;!-- Customization/Notes specific to Windows goes here --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-------------------------------------------------------------------------&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= [[Emacs-24]] =&lt;br /&gt;
&amp;lt;!-- Customization/Notes specific to Emacs-24 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Recent revision should come first. This way important information stays at top  --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-------------------------------------------------------------------------&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= [[Emacs-23]] =&lt;br /&gt;
&amp;lt;!-- Customization/Notes specific to Emacs-22 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-------------------------------------------------------------------------&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Recommended Reading =&lt;br /&gt;
&amp;lt;!-- Only internal links. DO NOT insert EXTERNAL LINKS --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-------------------------------------------------------------------------&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Project Pages =&lt;br /&gt;
* [http://cc-mode.sourceforge.net/ cc-mode]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-------------------------------------------------------------------------&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Tutorial Pages =&lt;br /&gt;
&amp;lt;!-- ;[http://wiki.bazaar.canonical.com/EmacsTips Emacs as commit message editor]  --&amp;gt;&lt;br /&gt;
&amp;lt;!-- :Tips for setting up Emacs as Bazaar commit editor. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-------------------------------------------------------------------------&amp;gt;&lt;br /&gt;
&amp;lt;!-- Add categories based on user-level (beginner etc), user-role (programming, emacs contributor etc), platform (windows, linux etc) or work flow (text editing, document authoring etc)  --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nice visual preview of different cc mode styles: http://davidha.wordpress.com/2009/05/15/emacs-cc-modes-built-in-styles-gallery/&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Mctpyt</name></author>
	</entry>
</feed>