title: How do I make Emacs auto-indent my C code?
body: <p>I'm just starting to get a feel for emacs, but I am frustrated with it's tendency to not indent when I press the return key. I know if I press C-j it will do it, but I can't get into that habit. I just can't. I need to hit return, and I hate re-tabbing every time.</p>
  
  <p>I went into the options and found C mode hook, and C++ mode hook, etc--and they defined two keymappings (10 and 13, and I remembered that 0A and 0D are CR/LF because I used them a lot in assembly)--I figured since one said "<code>(lambda nil (define-key lisp-mode-map [13] (quote newline-and-indent))</code>" and the other the same but with <code>(quote newline)</code> instead, I just put the -and-indent at the end of it and figured it would work.</p>
  
  <p>But it doesn't: I set and saved it, tried, to no avail. Restarted emacs, still no success. How do I make it indent my code? It's terribly insane that emacs requires a degree in lisp just to configure it for your basic needs.</p>
  
  <p>Also, as a sort of side question: how do I copy to and paste from the <i>clipboard?</i> Killing/yanking is handy and all but I hate going edit->copy every time I want to paste  to somewhere else.</p>
  
  <p><b>-- EDIT --</b></p>
  
  <p>okay, I put the following lines into my .emacs and it worked:</p>
  
  <pre>(add-hook 'c-mode-common-hook (lambda ()
        (local-set-key (kbd "RET") 'newline-and-indent)))</pre>
  
  <p>thanks for the help</p>