From: Philip <phil.ganchev@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Indenting with 2 spaces
Date: Wed, 3 Nov 2010 15:21:20 -0700 (PDT) [thread overview]
Message-ID: <051748c4-3a8c-4bbb-8ab9-75dc082329b7@j25g2000yqa.googlegroups.com> (raw)
In-Reply-To: xeiafwviv6td.fsf@kobe.laptop
On Nov 3, 10:07 am, Giorgos Keramidas <keram...@ceid.upatras.gr>
wrote:
> On Tue, 2 Nov 2010 20:15:23 -0700 (PDT), Philip <phil.ganc...@gmail.com> 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
> > 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. You will have to add a hook to
> those modes you are interested in like:
>
> ;;; Indentation setup for cc-mode and derivatives.
>
> (defun keramida/cc-mode-setup ()
> (interactive)
> (make-local-variable 'c-basic-offset)
> (setq c-basic-offset 2))
>
> (eval-after-load "cc-mode"
> '(add-hook 'c-mode-common-hook 'keramida/cc-mode-setup))
>
> ;;; Indentation setup for text-mode and derivatives.
>
> (defun keramida/text-mode-setup ()
> (interactive)
> (make-local-variable 'standard-indent)
> (setq standard-indent 2))
>
> (eval-after-load "text-mode"
> '(add-hook 'text-mode-hook 'keramida/text-mode-setup))
>
> ;; Indentation setup for sh-mode and derivatives.
>
> (defun keramida/sh-mode-setup ()
> (interactive)
> (setq sh-basic-offset 2
> sh-indentation 2))
>
> (eval-after-load "sh-mode"
> '(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.
next parent reply other threads:[~2010-11-03 22:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <afc2d1bd-05a2-4068-bfd7-3793f40f9a96@j18g2000yqd.googlegroups.com>
[not found] ` <xeiafwviv6td.fsf@kobe.laptop>
2010-11-03 22:21 ` Philip [this message]
[not found] ` <jwvwrosvroy.fsf-monnier+gnu.emacs.help@gnu.org>
2010-11-04 21:05 ` Indenting with 2 spaces despen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=051748c4-3a8c-4bbb-8ab9-75dc082329b7@j25g2000yqa.googlegroups.com \
--to=phil.ganchev@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.