help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: No automatic tabs in Emacs?


From: Glenn Morris
Subject: Re: No automatic tabs in Emacs?
Date: Wed, 01 Dec 2010 21:08:58 -0800
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

Sueroski wrote:

> 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");
>    }
>
> And I wanna get by default without pressing TAB, get this:
>
>    #include "stdio.h"
>    int main(){
>         printf("Hello World");
>    }

It sounds like you want the command `newline-and-indent', which is bound
to ctrl-j. You can make the enter key do this for you by adding
something like the following to ~/.emacs:

(add-hook 'c-mode-hook (lambda () (local-set-key "\r" 'newline-and-indent)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]