* indention in cc-mode not as expected
@ 2008-10-07 4:18 mfl
2008-10-07 6:08 ` Sean G. McLaughlin
0 siblings, 1 reply; 3+ messages in thread
From: mfl @ 2008-10-07 4:18 UTC (permalink / raw)
To: help-gnu-emacs
I am trying to indent the following code using c-indent-region
void foo()
{
if(true)
{
foo1();
foo2();
}
}
I want to get the following:
void foo()
{
if(true)
{
foo1();
foo2();
}
}
However, c-indent-region keeps generating the following:
void foo()
{
if(true)
{
foo1();
foo2();
}
}
I tried different values for these options: c-tabs-always-indent, c-
insert-tab-function, but none of them worked.
Can someone please help me on this? or is there a function to do "tab-
to-the-left" for a region in emacs?
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: indention in cc-mode not as expected
2008-10-07 4:18 indention in cc-mode not as expected mfl
@ 2008-10-07 6:08 ` Sean G. McLaughlin
2008-10-07 18:56 ` mfl
0 siblings, 1 reply; 3+ messages in thread
From: Sean G. McLaughlin @ 2008-10-07 6:08 UTC (permalink / raw)
To: help-gnu-emacs
mfl <mofliwsb@gmail.com> writes:
> I tried different values for these options: c-tabs-always-indent, c-
> insert-tab-function, but none of them worked.
> Can someone please help me on this? or is there a function to do "tab-
> to-the-left" for a region in emacs?
> Thanks.
You aren't taking into account the indenting *style*. The default is
GNU-style, which is distinguished by the half-indented braces you are
getting. The style you want looks most like BSD, which you can set with
(setq c-default-style "bsd")
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: indention in cc-mode not as expected
2008-10-07 6:08 ` Sean G. McLaughlin
@ 2008-10-07 18:56 ` mfl
0 siblings, 0 replies; 3+ messages in thread
From: mfl @ 2008-10-07 18:56 UTC (permalink / raw)
To: help-gnu-emacs
On Oct 6, 11:08 pm, s...@Pavilion.domain.invalid (Sean G. McLaughlin)
wrote:
> mfl <mofli...@gmail.com> writes:
> > I tried different values for these options: c-tabs-always-indent, c-
> > insert-tab-function, but none of them worked.
> > Can someone please help me on this? or is there a function to do "tab-
> > to-the-left" for a region in emacs?
> > Thanks.
>
> You aren't taking into account the indenting *style*. The default is
> GNU-style, which is distinguished by the half-indented braces you are
> getting. The style you want looks most like BSD, which you can set with
>
> (setq c-default-style "bsd")
Thanks, changing to BSD style works.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-10-07 18:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-07 4:18 indention in cc-mode not as expected mfl
2008-10-07 6:08 ` Sean G. McLaughlin
2008-10-07 18:56 ` mfl
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.