help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [emacs] tabs, spaces, and indentation


From: Steve Revilak
Subject: Re: [emacs] tabs, spaces, and indentation
Date: Fri, 8 Oct 2010 22:08:01 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

From: Nerius Landys

The current default behavior that I am experiencing is as follows:

1. When I hit the Tab key, it indents the current line at the correct
indentation level.  Existing Tabs are preserved but spaces might be added.
2. When I complete some syntax on a line, such as adding a semicolon or
closing a paren, it indents the line for me automatically.

The behavior for this particular mode of operation that would be nice is as
follows:

1. Hitting the Tab key places a literal Tab character in my file.  That is
all.
2. I notice that sometimes when I complete a like (e.g. adding a semicolon
or adding a paren) it auto-indents for me.  I want to turn this off
completely.

CC-mode gives you a lot of options for controlling indentation.

  M-x Info-goto-node RET (ccmode)Commands RET

The subsections "Indentation commands", "Minor Modes" and "Electric
keys" will probably be the most relevant for what you're trying to
accomplish.

For (1) something like

 (setq c-basic-offset 8
       indent-tabs-mode t
       c-insert-tab-function 'tab-to-tab-stop)

 (setq c-syntactic-indentation nil) ; maybe, or maybe not this one

should be close to the behavior you're looking for.

For (2), try

  (c-toggle-electric-state -1)


Steve



Attachment: pgpo4GaqX4a33.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]