# emacs and C mode

This topic is 4810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Scheme has been placed on the back burner while C has been brought to the forefront along with emacs. So, I'm trying to write C code in emacs. "Beautiful!", I think, "emacs even has a C mode!", and it is beautiful for navigating my code. However, it has this annoying habit of reformatting my code. Now, I'm just coding for myself, so I think I should get to decide how I want my code formatted. Even if I couldn't make the decision, what's to say that emacs is doing what the coding standard deems appropriate? It seems to want to use two space indentations for most code, huge indentations for function parameters, and no indentation for cases/labels. I like three space indents for most things unless lining things up for increased readability. How do I make emacs either do what I want or stop doing what I don't want? On another subject entirely, I somehow got Ad Destroyer on my roommate's computer. How do I get rid of it? The popups and strange software (CashBack and EliteBar) are getting annoying.

##### Share on other sites
M-x
c-set-style
Possible completions are:bsd				   ellemtelgnu				   javak&r				   linuxpython			   stroustrupwhitesmith

Pick one or write your own C style. You will probably want stroustrup.

gl hf

##### Share on other sites
Man, that is an awesome link. I wish I'd had that back when I was learning how to use emacs with C. c-basic-wtf?!

The tab == indent-line thing may seem really annoying at first, but it catches lots of typo bugs before you even need to compile. When you tab to an unexpected column, you know it's time to re-read what you just wrote because there's probably an error.

##### Share on other sites
Quote:
 Original post by ajas95Man, that is an awesome link. I wish I'd had that back when I was learning how to use emacs with C. c-basic-wtf?!The tab == indent-line thing may seem really annoying at first, but it catches lots of typo bugs before you even need to compile. When you tab to an unexpected column, you know it's time to re-read what you just wrote because there's probably an error.
I'll vouch for that. I find loads of syntax errors this way. It's so ingrained in my workflow that I had forgotton I do that.

1. 1
2. 2
JoeJ
20
3. 3
4. 4
frob
13
5. 5

• 13
• 17
• 13
• 20
• 13
• ### Forum Statistics

• Total Topics
632191
• Total Posts
3004659

×