[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: No automatic tabs in Emacs?
From: |
PJ Weisberg |
Subject: |
Re: No automatic tabs in Emacs? |
Date: |
Wed, 1 Dec 2010 20:04:01 -0800 |
> I'm writing on C my code:
>
> #include "stdio.h"
> int main(){
> }
>
> And I wanna add something to main. I push Enter and write my code. In Emacs I
> get this:
>
> #include "stdio.h"
> int main(){
> printf("Hello World");
> }
Actually you don't, because emacs by default indents the line when you
press ';'. ;-)
There might be a better way to do it, but you can accomplish what you
describe by putting this in your .emacs file:
(defadvice newline (after always-auto-indent)
(indent-according-to-mode))
(ad-activate 'newline)
I'm personally at the point where I'm sometimes surprised when I
unconsciously press TAB in another editor and it inserts some
whitespace at the cursor instead of fixing my indentation. If you've
really got a love for having the editor take care of your whitespace,
try this:
(c-toggle-auto-newline 1)
(c-toggle-hungry-state 1)
- No automatic tabs in Emacs?, Sueroski, 2010/12/01
- Re: No automatic tabs in Emacs?, egarrulo, 2010/12/01
- Re: No automatic tabs in Emacs?, suvayu ali, 2010/12/02
- Re: No automatic tabs in Emacs?, egarrulo, 2010/12/02
- Message not available
- Re: No automatic tabs in Emacs?, despen, 2010/12/08
- Re: No automatic tabs in Emacs?, Elena, 2010/12/08
- Re: No automatic tabs in Emacs?, Jay Belanger, 2010/12/08
- Re: No automatic tabs in Emacs?, Pascal J. Bourguignon, 2010/12/08