all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* C indentation customization
@ 2015-07-24 14:24 Rusi
  2015-07-24 14:53 ` Rusi
  0 siblings, 1 reply; 5+ messages in thread
From: Rusi @ 2015-07-24 14:24 UTC (permalink / raw)
  To: help-gnu-emacs

http://emacswiki.org/emacs/IndentingC
seems to say that doing

(setq c-default-style "linux"
          c-basic-offset 4)

will indent like this:

if(foo)
{
    bar++;
}

ie '{' is not indented, contents is 4 space indented.

Likewise setting to bsd
as described https://en.wikipedia.org/wiki/Indent_style#Allman_style
seems to say that the '{' wont be indented

None of these work; ie the '{' is always indented.


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

* Re: C indentation customization
  2015-07-24 14:24 C indentation customization Rusi
@ 2015-07-24 14:53 ` Rusi
  2015-07-25  5:25   ` Rusi
  0 siblings, 1 reply; 5+ messages in thread
From: Rusi @ 2015-07-24 14:53 UTC (permalink / raw)
  To: help-gnu-emacs

On Friday, July 24, 2015 at 7:54:41 PM UTC+5:30, Rusi wrote:
> http://emacswiki.org/emacs/IndentingC
> seems to say that doing
> 
> (setq c-default-style "linux"
>           c-basic-offset 4)
> 
> will indent like this:
> 
> if(foo)
> {
>     bar++;
> }
> 
> ie '{' is not indented, contents is 4 space indented.
> 
> Likewise setting to bsd
> as described https://en.wikipedia.org/wiki/Indent_style#Allman_style
> seems to say that the '{' wont be indented
> 
> None of these work; ie the '{' is always indented.

Evidently restarting emacs makes it work
[ie these bindings need to be in effect before CC-mode is loaded(?)]


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

* Re: C indentation customization
  2015-07-24 14:53 ` Rusi
@ 2015-07-25  5:25   ` Rusi
  2015-07-25  7:38     ` Eli Zaretskii
       [not found]     ` <mailman.7372.1437809994.904.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Rusi @ 2015-07-25  5:25 UTC (permalink / raw)
  To: help-gnu-emacs

On Friday, July 24, 2015 at 8:23:11 PM UTC+5:30, Rusi wrote:
> On Friday, July 24, 2015 at 7:54:41 PM UTC+5:30, Rusi wrote:
> > http://emacswiki.org/emacs/IndentingC
> > seems to say that doing
> > 
> > (setq c-default-style "linux"
> >           c-basic-offset 4)
> > 
> > will indent like this:
> > 
> > if(foo)
> > {
> >     bar++;
> > }
> > 
> > ie '{' is not indented, contents is 4 space indented.
> > 
> > Likewise setting to bsd
> > as described https://en.wikipedia.org/wiki/Indent_style#Allman_style
> > seems to say that the '{' wont be indented
> > 
> > None of these work; ie the '{' is always indented.
> 
> Evidently restarting emacs makes it work
> [ie these bindings need to be in effect before CC-mode is loaded(?)]

Should not the early-binding of these deserve a place somewhere (prominent)
in the docs?
Something like:
- For permanent settings do ...
- For temporary trying out do ...


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

* Re: C indentation customization
  2015-07-25  5:25   ` Rusi
@ 2015-07-25  7:38     ` Eli Zaretskii
       [not found]     ` <mailman.7372.1437809994.904.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2015-07-25  7:38 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Fri, 24 Jul 2015 22:25:27 -0700 (PDT)
> From: Rusi <rustompmody@gmail.com>
> 
> On Friday, July 24, 2015 at 8:23:11 PM UTC+5:30, Rusi wrote:
> > On Friday, July 24, 2015 at 7:54:41 PM UTC+5:30, Rusi wrote:
> > > http://emacswiki.org/emacs/IndentingC
> > > seems to say that doing
> > > 
> > > (setq c-default-style "linux"
> > >           c-basic-offset 4)
> > > 
> > > will indent like this:
> > > 
> > > if(foo)
> > > {
> > >     bar++;
> > > }
> > > 
> > > ie '{' is not indented, contents is 4 space indented.
> > > 
> > > Likewise setting to bsd
> > > as described https://en.wikipedia.org/wiki/Indent_style#Allman_style
> > > seems to say that the '{' wont be indented
> > > 
> > > None of these work; ie the '{' is always indented.
> > 
> > Evidently restarting emacs makes it work
> > [ie these bindings need to be in effect before CC-mode is loaded(?)]
> 
> Should not the early-binding of these deserve a place somewhere (prominent)
> in the docs?
> Something like:
> - For permanent settings do ...
> - For temporary trying out do ...

Did you read the node "Config Basics" in the CC Mode manual?  It seems
to discuss precisely these issues.



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

* Re: C indentation customization
       [not found]     ` <mailman.7372.1437809994.904.help-gnu-emacs@gnu.org>
@ 2015-07-25 16:55       ` Rusi
  0 siblings, 0 replies; 5+ messages in thread
From: Rusi @ 2015-07-25 16:55 UTC (permalink / raw)
  To: help-gnu-emacs

On Saturday, July 25, 2015 at 1:09:58 PM UTC+5:30, Eli Zaretskii wrote:
> > Date: Fri, 24 Jul 2015 22:25:27 -0700 (PDT)
> > From: Rusi 
> > 
> > On Friday, July 24, 2015 at 8:23:11 PM UTC+5:30, Rusi wrote:
> > > On Friday, July 24, 2015 at 7:54:41 PM UTC+5:30, Rusi wrote:
> > > > http://emacswiki.org/emacs/IndentingC
> > > > seems to say that doing
> > > > 
> > > > (setq c-default-style "linux"
> > > >           c-basic-offset 4)
> > > > 
> > > > will indent like this:
> > > > 
> > > > if(foo)
> > > > {
> > > >     bar++;
> > > > }
> > > > 
> > > > ie '{' is not indented, contents is 4 space indented.
> > > > 
> > > > Likewise setting to bsd
> > > > as described https://en.wikipedia.org/wiki/Indent_style#Allman_style
> > > > seems to say that the '{' wont be indented
> > > > 
> > > > None of these work; ie the '{' is always indented.
> > > 
> > > Evidently restarting emacs makes it work
> > > [ie these bindings need to be in effect before CC-mode is loaded(?)]
> > 
> > Should not the early-binding of these deserve a place somewhere (prominent)
> > in the docs?
> > Something like:
> > - For permanent settings do ...
> > - For temporary trying out do ...
> 
> Did you read the node "Config Basics" in the CC Mode manual?  It seems
> to discuss precisely these issues.

I did.
If you know what you are looking for, you can look for it :-)
Also its not there in the describe-variable for c-default-style except in a
backhanded sort of way:
-------
The default style gets installed before your mode hooks run, so you
can always override the use of `c-default-style' by making calls to
`c-set-style' in the appropriate mode hook.
-------


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

end of thread, other threads:[~2015-07-25 16:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-24 14:24 C indentation customization Rusi
2015-07-24 14:53 ` Rusi
2015-07-25  5:25   ` Rusi
2015-07-25  7:38     ` Eli Zaretskii
     [not found]     ` <mailman.7372.1437809994.904.help-gnu-emacs@gnu.org>
2015-07-25 16:55       ` Rusi

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.