From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bob Proulx Newsgroups: gmane.emacs.help Subject: Re: No automatic tabs in Emacs? Date: Thu, 2 Dec 2010 10:40:09 -0700 Message-ID: <20101202174009.GC15659@hysteria.proulx.com> References: <4CF554E6.4090009@interia.pl> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1291311669 5873 80.91.229.12 (2 Dec 2010 17:41:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 2 Dec 2010 17:41:09 +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 18:41:05 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 1POD9P-0002T6-0y for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Dec 2010 18:40:59 +0100 Original-Received: from localhost ([127.0.0.1]:33573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1POD9O-00062A-FY for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Dec 2010 12:40:58 -0500 Original-Received: from [140.186.70.92] (port=41391 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1POD8i-0005vC-QQ for help-gnu-emacs@gnu.org; Thu, 02 Dec 2010 12:40:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1POD8g-0007tn-Kz for help-gnu-emacs@gnu.org; Thu, 02 Dec 2010 12:40:16 -0500 Original-Received: from joseki.proulx.com ([216.17.153.58]:46740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1POD8g-0007tY-Ar for help-gnu-emacs@gnu.org; Thu, 02 Dec 2010 12:40:14 -0500 Original-Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id C3B5E21312; Thu, 2 Dec 2010 10:40:09 -0700 (MST) Original-Received: by hysteria.proulx.com (Postfix, from userid 1000) id BB5AB2DD7A; Thu, 2 Dec 2010 10:40:09 -0700 (MST) Mail-Followup-To: Bob Proulx , Sueroski , help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <4CF554E6.4090009@interia.pl> User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) 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:75481 Archived-At: Sueroski wrote: > And I'm flustrated about one think... so, I'm programmer (mainly > Python and PHP) and actually all editors gives me automatic adding > tab... I haven't this on Emacs and I don't know how to do it. I must > on every line press TAB and it's not good ;[ > So... what I must change to have auto tabs in Emacs? I searched most > of sites but everything telling how to select type of tabs, leight > of tabs etc. I think the default expectation is that instead of pressing Enter (also known as C-m the carriage return character) that if you press C-j you will get what you want. The C-j (the newline character) is by default bound to newline-and-indent. Try using C-j instead of Enter and see if that does what you want. You can change your keymap so that Enter (C-m) also calls newline-and-indent just like C-J and automatically indents the next line for you. Set up a hook for the modes you care about and change the keymap. (add-hook 'c-mode-hook '(lambda () (define-key c-mode-map "\C-m" 'newline-and-indent))) Change the above as appropriate for the other modes you wish to use. I used to always map C-m to newline-and-indent. But more recently have been using random unconfigured machines and don't get my normal customizations. I have therefore trained myself to use C-j now instead since that is a default behavior and doesn't need configuration. Bob