From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: PJ Weisberg Newsgroups: gmane.emacs.help Subject: Re: No automatic tabs in Emacs? Date: Wed, 1 Dec 2010 20:04:01 -0800 Message-ID: References: <4CF554E6.4090009@interia.pl> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1291262681 23859 80.91.229.12 (2 Dec 2010 04:04:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 2 Dec 2010 04:04:41 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Sueroski Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 02 05:04:37 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PO0PM-0007ic-LZ for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Dec 2010 05:04:36 +0100 Original-Received: from localhost ([127.0.0.1]:49406 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PO0PM-0003UE-3t for geh-help-gnu-emacs@m.gmane.org; Wed, 01 Dec 2010 23:04:36 -0500 Original-Received: from [140.186.70.92] (port=38130 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PO0Ot-0003R5-TQ for help-gnu-emacs@gnu.org; Wed, 01 Dec 2010 23:04:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PO0Os-00077k-P4 for help-gnu-emacs@gnu.org; Wed, 01 Dec 2010 23:04:07 -0500 Original-Received: from p3plsmtpa01-04.prod.phx3.secureserver.net ([72.167.82.84]:55422) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PO0Os-000775-D6 for help-gnu-emacs@gnu.org; Wed, 01 Dec 2010 23:04:06 -0500 Original-Received: (qmail 23038 invoked from network); 2 Dec 2010 04:04:03 -0000 Original-Received: from unknown (74.125.82.49) by p3plsmtpa01-04.prod.phx3.secureserver.net (72.167.82.84) with ESMTP; 02 Dec 2010 04:04:03 -0000 Original-Received: by wwb17 with SMTP id 17so847968wwb.30 for ; Wed, 01 Dec 2010 20:04:01 -0800 (PST) Original-Received: by 10.227.170.78 with SMTP id c14mr10428977wbz.49.1291262641608; Wed, 01 Dec 2010 20:04:01 -0800 (PST) Original-Received: by 10.227.57.213 with HTTP; Wed, 1 Dec 2010 20:04:01 -0800 (PST) In-Reply-To: <4CF554E6.4090009@interia.pl> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:75475 Archived-At: > 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)