unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* don't indent on nested namespaces in c++ mode
@ 2015-02-26 15:03 Glen Stark
  2015-02-26 15:35 ` Óscar Fuentes
  0 siblings, 1 reply; 2+ messages in thread
From: Glen Stark @ 2015-02-26 15:03 UTC (permalink / raw)
  To: help-gnu-emacs

Hi everyone.   I'm in Emacs 24.4.1.    I am able to get zero indentation 
on nested namespaces, if they are declared on separate lines, but not if 
they are on a single line.  

I have the following line in my configuration:

  (c-set-offset 'innamespace 0)

Which produces the desired result for:

   namespace foo{
   namespace bar{
   class foobar{};
   }

But when I have nested namespaces declared on a single line it
 produces the undesired:	
   namespace foo{ namespace bar{
       class foobar{};
   }


I've also tried the following (which I got from stack overflow), but it 
seems to have no effect whatsoever:
   (defconst my-cc-style
     '("cc-mode"
       (c-offsets-alist . ((innamespace . [0])))))

   (c-add-style "my-cc-mode" my-cc-style)


Can anyone explain what's going on, and tell me how to get the desired 
effect?

Many thanks, 

Glen Stark.


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

* Re: don't indent on nested namespaces in c++ mode
  2015-02-26 15:03 don't indent on nested namespaces in c++ mode Glen Stark
@ 2015-02-26 15:35 ` Óscar Fuentes
  0 siblings, 0 replies; 2+ messages in thread
From: Óscar Fuentes @ 2015-02-26 15:35 UTC (permalink / raw)
  To: help-gnu-emacs

Glen Stark <mail@glenstark.net> writes:

> Hi everyone.   I'm in Emacs 24.4.1.    I am able to get zero indentation 
> on nested namespaces, if they are declared on separate lines, but not if 
> they are on a single line.  
>
> I have the following line in my configuration:
>
>   (c-set-offset 'innamespace 0)
>
> Which produces the desired result for:
>
>    namespace foo{
>    namespace bar{
>    class foobar{};
>    }
>
> But when I have nested namespaces declared on a single line it
>  produces the undesired:	
>    namespace foo{ namespace bar{
>        class foobar{};
>    }
>
>
> I've also tried the following (which I got from stack overflow), but it 
> seems to have no effect whatsoever:
>    (defconst my-cc-style
>      '("cc-mode"
>        (c-offsets-alist . ((innamespace . [0])))))
>
>    (c-add-style "my-cc-mode" my-cc-style)
>
>
> Can anyone explain what's going on, and tell me how to get the desired 
> effect?

I cannot replicate your problem with my config. My style has (among
many other things)

    (innamespace . -)




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

end of thread, other threads:[~2015-02-26 15:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-26 15:03 don't indent on nested namespaces in c++ mode Glen Stark
2015-02-26 15:35 ` Óscar Fuentes

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