unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to turn off auto indent in C++ mode?
@ 2008-06-05  9:38 Zhongxing Xu
  2008-06-06 16:26 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Zhongxing Xu @ 2008-06-05  9:38 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 395 bytes --]

When I am using c++ mode to edit c++ sources, emacs always auto indent the
class declarations inside a namespace. I don't want the auto indentation
inside a namespace. How to turn off it?

Code example:
I want such style:

namespace foo {
class A {
};
}

emacs forces to:

namespace foo {
  class A {
  };
}

I have to delete the spaces in front of "class A" manually.

Greetings,

Zhongxing Xu

[-- Attachment #2: Type: text/html, Size: 495 bytes --]

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

* Re: How to turn off auto indent in C++ mode?
  2008-06-05  9:38 How to turn off auto indent in C++ mode? Zhongxing Xu
@ 2008-06-06 16:26 ` Eli Zaretskii
  2008-06-07  2:46   ` Zhongxing Xu
  2008-06-07  9:42   ` Nikolaj Schumacher
  0 siblings, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2008-06-06 16:26 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Thu, 5 Jun 2008 17:38:13 +0800
> From: "Zhongxing Xu" <mymlreader@gmail.com>
> 
> When I am using c++ mode to edit c++ sources, emacs always auto indent the
> class declarations inside a namespace. I don't want the auto indentation
> inside a namespace. How to turn off it?
> 
> Code example:
> I want such style:
> 
> namespace foo {
> class A {
> };
> }
> 
> emacs forces to:
> 
> namespace foo {
>   class A {
>   };
> }

Does "C-c C-l" in the buffer where you edit C++ do what you want?




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

* Re: How to turn off auto indent in C++ mode?
  2008-06-06 16:26 ` Eli Zaretskii
@ 2008-06-07  2:46   ` Zhongxing Xu
  2008-06-07  6:41     ` Eli Zaretskii
  2008-06-07  9:42   ` Nikolaj Schumacher
  1 sibling, 1 reply; 6+ messages in thread
From: Zhongxing Xu @ 2008-06-07  2:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 640 bytes --]

Yes! You are amazing!

On Sat, Jun 7, 2008 at 12:26 AM, Eli Zaretskii <eliz@gnu.org> wrote:

> > Date: Thu, 5 Jun 2008 17:38:13 +0800
> > From: "Zhongxing Xu" <mymlreader@gmail.com>
> >
> > When I am using c++ mode to edit c++ sources, emacs always auto indent
> the
> > class declarations inside a namespace. I don't want the auto indentation
> > inside a namespace. How to turn off it?
> >
> > Code example:
> > I want such style:
> >
> > namespace foo {
> > class A {
> > };
> > }
> >
> > emacs forces to:
> >
> > namespace foo {
> >   class A {
> >   };
> > }
>
> Does "C-c C-l" in the buffer where you edit C++ do what you want?
>
>
>

[-- Attachment #2: Type: text/html, Size: 1087 bytes --]

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

* Re: How to turn off auto indent in C++ mode?
  2008-06-07  2:46   ` Zhongxing Xu
@ 2008-06-07  6:41     ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2008-06-07  6:41 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 7 Jun 2008 10:46:29 +0800
> From: "Zhongxing Xu" <mymlreader@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> 
> > Does "C-c C-l" in the buffer where you edit C++ do what you want?
> 
> Yes!

In that case, you can customize this in your .emacs by adding the
following line to the c++-mode-hook:

  (c-toggle-electric-state -1)

This will do the equivalent of "C-c C-l" in all buffers where you edit
C++ code.




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

* Re: How to turn off auto indent in C++ mode?
  2008-06-06 16:26 ` Eli Zaretskii
  2008-06-07  2:46   ` Zhongxing Xu
@ 2008-06-07  9:42   ` Nikolaj Schumacher
  2008-06-13 12:04     ` Zhongxing Xu
  1 sibling, 1 reply; 6+ messages in thread
From: Nikolaj Schumacher @ 2008-06-07  9:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> wrote:

>> Date: Thu, 5 Jun 2008 17:38:13 +0800
>> From: "Zhongxing Xu" <mymlreader@gmail.com>
>>
>> I want such style:
>>
>> namespace foo {
>> class A {
>> };
>> }
>
> Does "C-c C-l" in the buffer where you edit C++ do what you want?

Instead of turning of electric indentation, you can also configure
indentation to do what you want.

In this case, customize the variable `c-offsets-alist' and set the value
`innamespace' to 0.

regards,
Nikolaj Schumacher




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

* Re: How to turn off auto indent in C++ mode?
  2008-06-07  9:42   ` Nikolaj Schumacher
@ 2008-06-13 12:04     ` Zhongxing Xu
  0 siblings, 0 replies; 6+ messages in thread
From: Zhongxing Xu @ 2008-06-13 12:04 UTC (permalink / raw)
  To: Nikolaj Schumacher; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 621 bytes --]

Thanks again!

On 6/7/08, Nikolaj Schumacher <n_schumacher@web.de> wrote:
>
> Eli Zaretskii <eliz@gnu.org> wrote:
>
>
> >> Date: Thu, 5 Jun 2008 17:38:13 +0800
> >> From: "Zhongxing Xu" <mymlreader@gmail.com>
> >>
>
> >> I want such style:
> >>
> >> namespace foo {
> >> class A {
> >> };
> >> }
> >
>
> > Does "C-c C-l" in the buffer where you edit C++ do what you want?
>
>
> Instead of turning of electric indentation, you can also configure
> indentation to do what you want.
>
> In this case, customize the variable `c-offsets-alist' and set the value
> `innamespace' to 0.
>
> regards,
>
> Nikolaj Schumacher
>
>
>

[-- Attachment #2: Type: text/html, Size: 1118 bytes --]

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

end of thread, other threads:[~2008-06-13 12:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-05  9:38 How to turn off auto indent in C++ mode? Zhongxing Xu
2008-06-06 16:26 ` Eli Zaretskii
2008-06-07  2:46   ` Zhongxing Xu
2008-06-07  6:41     ` Eli Zaretskii
2008-06-07  9:42   ` Nikolaj Schumacher
2008-06-13 12:04     ` Zhongxing Xu

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