unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Tab question in c
@ 2006-09-04  8:52 Leo.Hou
  2006-09-04 10:26 ` Giorgos Keramidas
  0 siblings, 1 reply; 2+ messages in thread
From: Leo.Hou @ 2006-09-04  8:52 UTC (permalink / raw)


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?

Thanks a lot

Leo

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Tab question in c
  2006-09-04  8:52 Tab question in c Leo.Hou
@ 2006-09-04 10:26 ` Giorgos Keramidas
  0 siblings, 0 replies; 2+ messages in thread
From: Giorgos Keramidas @ 2006-09-04 10:26 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-04 10:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-04  8:52 Tab question in c Leo.Hou
2006-09-04 10:26 ` Giorgos Keramidas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).