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: Jonathan Groll
Subject: Re: [emacs] tabs, spaces, and indentation
Date: Thu, 07 Oct 2010 08:26:27 +0200
User-agent: Wanderlust/2.15.6 (Almost Unreal) Emacs/24.0 Mule/6.0 (HANACHIRUSATO)

On Wed, 6 Oct 2010 13:06:05 -0700,Nerius Landys wrote:
>I tried searching on Google for commands that may help me, but most of what I 
>found
>explained how to enable the kind of behavior that I'm NOT looking (I'm going 
>in the
>opposite direction unfortunately).

>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.

>Is it possible to toggle the mode consisting of #1 and #2 on and off?  Please 
>help,
>and thank you very much!

Here is a good resource: http://cscs.umich.edu/lr/Misc/emacs_tabs.htm
As the above guide says:

;;force TAB to insert just one TAB:
    (global-set-key (kbd "TAB") 'self-insert-command)

(This would be for every mode - but it may be best to just set it for
your C mode)

It is worth reading up on the eternal debate of tabs vs spaces. Here
is Jamie Zawinski's take:
http://www.jwz.org/doc/tabs-vs-spaces.html

Cheers,
JJG




reply via email to

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