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

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

Re: Tab question in c


From: Giorgos Keramidas
Subject: Re: Tab question in c
Date: Mon, 04 Sep 2006 13:26:58 +0300
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (berkeley-unix)

On 4 Sep 2006 01:52:50 -0700, "Leo.Hou" <leo.hou@gmail.com> wrote:
> Hi all,
> I've spent a lot of time searching for an answer over internet but got
> no clue. So I hope I can get some help here.
>
> I got a new project that requires indentation = 4 spaces in their
> coding style requirement. I couldn't config this in emacs properly. I
> have these two lines in .emacs but they dont work
>
>  '(standard-indent 4)
>  '(tab-always-indent t)
>
> And I don't want emacs to indent the braces like this:
> while (...)
>   {
>        ...
>   }
> How to set brace indent = 0?

For this purpose, I have a local C-style definition in my local cc-mode
setup file, at the `~/elisp/keramida-cc-extra.el' file, but you can
probably get very close to the required style with:

  (defun leo-c-mode-hook ()
    (c-set-style "linux")               ;Linux Coding Style
    (setq c-tab-always-indent t)        ;Always indent when TAB is hit
    (setq indent-tabs-mode nil)         ;Use only SPACES for indentation
    (setq c-basic-offset 4)             ;Standard cc-mode indentation size
    t)

  (add-hook 'c-mode-hook 'leo-c-mode-hook)

Converting the above to local file variables shouldn't be too hard, but
if you need help let me know.

- Giorgos



reply via email to

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