unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* .emacs file to act like Visual C++
@ 2002-08-30 21:26 Ryan Boder
  0 siblings, 0 replies; 2+ messages in thread
From: Ryan Boder @ 2002-08-30 21:26 UTC (permalink / raw)



Hi, I am using emacs/g++ in a project where the other developers are using
Visual C++. I would to have my c++-mode alignment and all be the same as
theirs so that I can continue to do so.

1. Is there a .emacs file that is maintained or that some one on the list
has that accomplishes this?

or

2. The most important thing is that curly braces are aligned with if
statements and for/while loops when placed on the line beneath them, not 2
spaces over which is the default for emacs. Can some one tell me how to do
that?

Sorry if this is common knowledge, but I couldn't find the answer on the
web.

Ryan

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

* Re: .emacs file to act like Visual C++
       [not found] <mailman.1030742888.6455.help-gnu-emacs@gnu.org>
@ 2002-08-31 18:22 ` Alan Mackenzie
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Mackenzie @ 2002-08-31 18:22 UTC (permalink / raw)


Ryan Boder <icanoop@bitwiser.org> wrote on Fri, 30 Aug 2002 17:26:42
-0400 (EDT):

> Hi, I am using emacs/g++ in a project where the other developers are using
> Visual C++. I would to have my c++-mode alignment and all be the same as
> theirs so that I can continue to do so.

> 1. Is there a .emacs file that is maintained or that some one on the list
> has that accomplishes this?

> or

> 2. The most important thing is that curly braces are aligned with if
> statements and for/while loops when placed on the line beneath them, not 2
> spaces over which is the default for emacs. Can some one tell me how to do
> that?

> Sorry if this is common knowledge, but I couldn't find the answer on the
> web.

This is one of these things 'most everybody needs to do.  The definitive
description is in the cc-mode Info page, to be found as follows:
C-h i                 will get you to info
m cc-mode             takes you to the cc-mode page
Select the item "customizing indentation", which will tell you everything
you need to know, and a good deal more besides.

It may well be that one of the predefined "styles" is what you need.
By the sounds of it, "bsd" style is likely just right, and something like
the following in your .emacs (taken from the cc-mode info page) would do
the trick:

     (defun my-c-mode-common-hook ()
       ;; use Bsd style for all C like languages
       (c-set-style "bsd")
       (setq tab-width 4) ; or whatever indentation level your project uses
       ;; other customizations can go here
       )
     (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

All the best!

> Ryan

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

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

end of thread, other threads:[~2002-08-31 18:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-30 21:26 .emacs file to act like Visual C++ Ryan Boder
     [not found] <mailman.1030742888.6455.help-gnu-emacs@gnu.org>
2002-08-31 18:22 ` Alan Mackenzie

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