From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sam Peterson Newsgroups: gmane.emacs.help Subject: Re: Indentation. Date: Fri, 27 Oct 2006 09:53:21 -0700 Organization: University of California, Davis Message-ID: References: <1161965854.252710.306610@f16g2000cwb.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1161972257 4230 80.91.229.2 (27 Oct 2006 18:04:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 27 Oct 2006 18:04:17 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 27 20:04:15 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GdVh6-00017J-JX for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Oct 2006 19:40:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GdVh6-0001cz-4U for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Oct 2006 13:40:36 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.news.ucla.edu!ucdavis!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 40 Original-NNTP-Posting-Host: moobilenet-58-145.ucdavis.edu Original-X-Trace: skeeter.ucdavis.edu 1161967965 25541 128.120.58.145 (27 Oct 2006 16:52:45 GMT) Original-X-Complaints-To: usenet@ucdavis.edu Original-NNTP-Posting-Date: Fri, 27 Oct 2006 16:52:45 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) Cancel-Lock: sha1:dipoXjeJoxbt7CoKApunynaFBC4= Original-Xref: shelby.stanford.edu gnu.emacs.help:142710 Original-To: help-gnu-emacs@gnu.org 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:38331 Archived-At: >>>>> "zombek" == zombek writes: > Hi. I'm new to emacs and I'd like to set 2 things: 1) 4 space > indentation (no mather which language) and it shouldn't care > about the syntax - when I say indent then indent 2)when I press > RETURN when beeing on some indentation level i should > automatically go to the same indentation level in the new line > without the need to press TAB (setq-default indent-tabs-mode nil) (global-set-key "\C-m" 'newline-and-indent) (global-set-key "\C-m" 'newline) For cc-mode and modes derivative of cc-mode, the following will set indentation to 4 spaces: (setq c-basic-offset 4) For the same modes, this will turn off syntactic indentation (electric parens and braces). (setq c-syntactic-indentation nil) For other languages I'm not sure. I always saw syntactic indentation as a useful feature. If you absolutely want TAB to indent 4-spaces regardless, try this: (fset 'four-space-indent "\C-u ") (add-hook 'c-mode-hook (lambda () (local-set-key [tab] 'four-space-indent))) Use other hooks for other language modes. HTH. -- Sam Peterson skpeterson At nospam ucdavis.edu "if programmers were paid to remove code instead of adding it, software would be much better" -- unknown