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

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

Re: automatic indentation in C,C++ modes


From: Greg Hill
Subject: Re: automatic indentation in C,C++ modes
Date: Fri, 12 Apr 2002 18:06:55 -0700

At 5:56 PM -0500 4/12/02, Tony Harbin wrote:
How do I turn off all automatic indentation in C and C++ modes?  I find
this
behavior *VERY* annoying and would like to disable it permanently (i.e.
in the
.emacs file)

Thanks for your time.

Tony,

If all you want is to insert a tab character at the beginning of a line when you type the tab key, try adding this to your .emacs file:

(add-hook 'c-mode-hook
        (function (lambda ()
                (substitute-key-definition
                'c-indent-command 'self-insert-command c-mode-map))))

(add-hook 'c++-mode-hook
        (function (lambda ()
                (substitute-key-definition
                'c-indent-command 'self-insert-command c++-mode-map))))

If, while you are at it, you also want to define the size of a tab as, say, 3 spaces, make it:

(add-hook 'c-mode-hook
        (function (lambda ()
                (substitute-key-definition
                'c-indent-command 'self-insert-command c-mode-map)
                (setq tab-width 3))))


--Greg




reply via email to

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