Re: [vox-tech] emacs formatting

2005-05-13 Thread Charles McLaughlin
Thanks for all of the suggestions and comments.  I did a little reading 
on programming styles... it turns out my favorite style is called 
BSD/Allman.  :)

I played around with the emacs customize screen for a while, then ended 
up manually added this entry in my .emacs file:

(setq c-offsets-alist
  '((substatement-open . 0)))
Charles
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] emacs formatting

2005-05-13 Thread Rod Roark
On Friday 13 May 2005 11:16 am, Bill Kendrick wrote:
> Heh.  Yeah, yuck.  I'll do this for one-liners, sometimes, though:
>
>   if (foo) { do_something(); }

Actually in PHP, C and Java you can omit the braces for a
single statement:

if (foo) do_something();

Or in Perl:

do_something() if (foo);

-- Rod
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] emacs formatting

2005-05-13 Thread Micah J. Cowan
On Fri, May 13, 2005 at 11:27:21AM -0700, Jonathan Stickel wrote:
> > Charles McLaughlin wrote:
> > Hello,
> > 
> > I am hoping someone can point me in the write direction.  I want to 
> > change how emacs formats code.  I'm very picky about spacing and 
> > brackets.  If I have to make the change for every mode that is fine, but 
> > I'd prefer to make the change once and have it apply to all types of 
> > code I use.  The modes I'm mainly concerned about now are C/C++, PHP and 
> > Perl.
>
> I'm an amateur when it comes to emacs hacks, but I suspect you'll need
> to add appropriate lines for each mode to your ~/.emacs file.  Probably
> cut and paste will do much of it, though.

Actually, it's much, much more elegant than that.

Hit M-x customize (press ENTER). Go to the Programming group, then to
Languages, and then C. You should find everything you need in there. You
can pretty much customize everything. When you hit the "Save for Future
Sessions" button, it will automatically adjust your .emacs file
appropriately and safely.

-Micah
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] emacs formatting

2005-05-13 Thread Micah J. Cowan
On Fri, May 13, 2005 at 01:19:07PM -0400, Peter Jay Salzman wrote:
> > but in some situations emacs formats code like this:
> > 
> > if(foo)
> >   {
> > doSomething();
> >   }
>  
> *barf*!!!

This is the official GNU indentation style. It does have some nice things about 
it... but lately I tend to use K&R style.

-- 
Micah J. Cowan
[EMAIL PROTECTED]
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] emacs formatting

2005-05-13 Thread Jonathan Stickel
I'm an amateur when it comes to emacs hacks, but I suspect you'll need
to add appropriate lines for each mode to your ~/.emacs file.  Probably
cut and paste will do much of it, though.
Jonathan
Charles McLaughlin wrote:
Hello,
I am hoping someone can point me in the write direction.  I want to 
change how emacs formats code.  I'm very picky about spacing and 
brackets.  If I have to make the change for every mode that is fine, but 
I'd prefer to make the change once and have it apply to all types of 
code I use.  The modes I'm mainly concerned about now are C/C++, PHP and 
Perl.

Here is an example of how I like to format things:
if(foo)
{
  doSomething();
}
but in some situations emacs formats code like this:
if(foo)
  {
doSomething();
  }
apparently most of the world formats code like this:
if(foo) {
  doSomething();
}
That just doesn't work for me though. :)
Thanks in advance for any advice.
Charles
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] emacs formatting

2005-05-13 Thread Bill Kendrick
On Fri, May 13, 2005 at 01:19:07PM -0400, Peter Jay Salzman wrote:
> 
> if(foo)
> { doSomething();
> }
> 
> which is heretical.  ;)

Heh.  Yeah, yuck.  I'll do this for one-liners, sometimes, though:

  if (foo) { do_something(); }

I think I mostly do that in PHP, though, where you end up mashing HTML and
code together a lot.

-bill!
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] emacs formatting

2005-05-13 Thread Peter Jay Salzman
I can't resist...


On Fri 13 May 05, 10:06 AM, Charles McLaughlin <[EMAIL PROTECTED]> said:
> 
> Here is an example of how I like to format things:
> 
> if(foo)
> {
>   doSomething();
> }
 
This is my preferred style as well.  I'm meeting more and more people who
prefer this style, so I think it's gaining popularity.  I have seen this
though:

if(foo)
{ doSomething();
}

which is heretical.  ;)




> but in some situations emacs formats code like this:
> 
> if(foo)
>   {
> doSomething();
>   }
 
*barf*!!!


 
> apparently most of the world formats code like this:
> 
> if(foo) {
>   doSomething();
> }
> 
> That just doesn't work for me though. :)
 
I agree.  Doesn't float my_boat;  BTW, this is how you're supposed to code in
the Linux kernel.  The rationale is that it's still readable but conserves
virtual console rows, which at a standard 25, is at a premium.  But for
someone working on an xterm, it makes no sense to conserve the number of
lines you're using to display code.

Pete
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


[vox-tech] emacs formatting

2005-05-13 Thread Charles McLaughlin
Hello,
I am hoping someone can point me in the write direction.  I want to 
change how emacs formats code.  I'm very picky about spacing and 
brackets.  If I have to make the change for every mode that is fine, but 
I'd prefer to make the change once and have it apply to all types of 
code I use.  The modes I'm mainly concerned about now are C/C++, PHP and 
Perl.

Here is an example of how I like to format things:
if(foo)
{
  doSomething();
}
but in some situations emacs formats code like this:
if(foo)
  {
doSomething();
  }
apparently most of the world formats code like this:
if(foo) {
  doSomething();
}
That just doesn't work for me though. :)
Thanks in advance for any advice.
Charles
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech