Jump to content
  • Advertisement
Sign in to follow this  

emacs and C mode

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
M-x
c-set-style

Possible completions are:
bsd ellemtel
gnu java
k&r linux
python stroustrup
whitesmith

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

More info.

gl hf

Share this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by ajas95
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.
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!