From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philip Newsgroups: gmane.emacs.help Subject: Re: Indenting with 2 spaces Date: Wed, 3 Nov 2010 15:21:20 -0700 (PDT) Organization: http://groups.google.com Message-ID: <051748c4-3a8c-4bbb-8ab9-75dc082329b7@j25g2000yqa.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1291884792 3478 80.91.229.12 (9 Dec 2010 08:53:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 08:53:12 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 09 09:53:08 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 1PQcFP-0005KE-VA for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 09:53:08 +0100 Original-Received: from localhost ([127.0.0.1]:55453 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQcFP-0004qO-CZ for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 03:53:07 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!j25g2000yqa.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 54 Original-NNTP-Posting-Host: 71.182.241.220 Original-X-Trace: posting.google.com 1288822880 9559 127.0.0.1 (3 Nov 2010 22:21:20 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 3 Nov 2010 22:21:20 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j25g2000yqa.googlegroups.com; posting-host=71.182.241.220; posting-account=_7wIHwoAAAAD-ffJstuJiKvbB0nCKtnv User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/9.10 (karmic) Firefox/3.6.12,gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:182184 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:76889 Archived-At: On Nov 3, 10:07=A0am, Giorgos Keramidas wrote: > On Tue, 2 Nov 2010 20:15:23 -0700 (PDT), Philip = wrote: > > How can I set the indentation level to 2 spaces in all modes, so that > > I get (for example) when I press Tab on the second line, I get the > > following: > > > if test "$x"; then > > =A0 echo yes > > fi > > > Notice there are only 2 spaces before the "echo" > > The indentation step is mode specific, so you can't set its value for > *all* programming modes in one place. =A0You will have to add a hook to > those modes you are interested in like: > > =A0 =A0 ;;; Indentation setup for cc-mode and derivatives. > > =A0 =A0 (defun keramida/cc-mode-setup () > =A0 =A0 =A0 (interactive) > =A0 =A0 =A0 (make-local-variable 'c-basic-offset) > =A0 =A0 =A0 (setq c-basic-offset 2)) > > =A0 =A0 (eval-after-load "cc-mode" > =A0 =A0 =A0 '(add-hook 'c-mode-common-hook 'keramida/cc-mode-setup)) > > =A0 =A0 ;;; Indentation setup for text-mode and derivatives. > > =A0 =A0 (defun keramida/text-mode-setup () > =A0 =A0 =A0 (interactive) > =A0 =A0 =A0 (make-local-variable 'standard-indent) > =A0 =A0 =A0 (setq standard-indent 2)) > > =A0 =A0 (eval-after-load "text-mode" > =A0 =A0 =A0 '(add-hook 'text-mode-hook 'keramida/text-mode-setup)) > > =A0 =A0 ;; Indentation setup for sh-mode and derivatives. > > =A0 =A0 (defun keramida/sh-mode-setup () > =A0 =A0 =A0 (interactive) > =A0 =A0 =A0 (setq sh-basic-offset 2 > =A0 =A0 =A0 =A0 =A0 =A0 sh-indentation 2)) > > =A0 =A0 (eval-after-load "sh-mode" > =A0 =A0 =A0 '(add-hook 'sh-mode-hook 'keramida/sh-mode-setup)) > > Note: Using `eval-after-load' to set up the mode-hooks means that your > average startup time shouldn't increase too much, and Emacs shouldn't > try to auto-load all the affected modes *every* time it launches. Thanks! That seems like a big limitation of Emacs that there is no way to specify all modes at once.