help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C formatting


From: Bijan Soleymani
Subject: Re: C formatting
Date: 27 Dec 2002 19:39:05 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Oodini <svdbg@free.fr> writes:

> hello,
> 
> I am fighting with EMacs in order to get my programmation style:
No need to fight, this is well documented in the CC-mode manual in the
section about customizing indentation. There is also useful
information in the emacs manual under the section about indentation,
and the section about editing programs.

I think there was a change at some point and if you want to use your
own style you have to set the CC-mode style to user.
 
> By the way, there is no way, in the buffer, to put two following tabs ??
Tab runs the indentation function and indents the current line based
on the current style. If you want to add an extra "tab" you should do
M-i (this is documented in the indentation section of the emacs manual).

Hope that helps,

Bijan
>From help-gnu-emacs-bounces@gnu.org  Fri Dec 27 20:10:11 2002
Path: 
shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!demon!peernews!peer.cwci.net!newspeer1-gui.server.ntli.net!ntli.net!newsfep1-gui.server.ntli.net.POSTED!53ab2750!not-for-mail
From: "chris.danx" <spamoff.danx@ntlworld.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130
X-Accept-Language: en, en-us
MIME-Version: 1.0
Newsgroups: gnu.emacs.help
References: <3E0CED7C.7020002@free.fr>
In-Reply-To: <3E0CED7C.7020002@free.fr>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Inktomi-Trace: pc2-bbrg1-4-cust73.renf.cable.ntl.com 1041037697 14785
        80.4.70.73 (28 Dec 2002 01:08:17 GMT)
Lines: 35
Message-ID: <6Q6P9.169$fA3.25203@newsfep1-gui.server.ntli.net>
Date: Sat, 28 Dec 2002 01:11:05 +0000
NNTP-Posting-Host: 80.1.224.5
X-Complaints-To: abuse@ntlworld.com
X-Trace: newsfep1-gui.server.ntli.net 1041037698 80.1.224.5 (Sat, 28 Dec 2002
        01:08:18 GMT)
NNTP-Posting-Date: Sat, 28 Dec 2002 01:08:18 GMT
Organization: ntl News Service
Xref: shelby.stanford.edu gnu.emacs.help:108524
To: help-gnu-emacs@gnu.org
Subject: Re: C formatting
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1b5
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/help-gnu-emacs>,
        <mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
List-Archive: <http://mail.gnu.org/pipermail/help-gnu-emacs>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/help-gnu-emacs>,
        <mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
X-List-Received-Date: Sat, 28 Dec 2002 01:10:11 -0000

Oodini wrote:
> hello,
> 
> I am fighting with EMacs in order to get my programmation style:

Did that a while back too, but thankfully someone gave me some code that 
gives a nice looking indentation style.

> void function(int x, int y)
> {
>      blabla;
>      if (...)
>      {
>           blabla
>           blabla
>      }
>      else
>           blabla;
> }

This works ok for me and produces indentation like above

(add-hook 'c-mode-hook (function (lambda () (c-set-style "bsd") (setq 
c-basic-offset 4))))

and this works for Java mode (just in case you need it later)

(add-hook 'java-mode-hook (function (lambda () (c-set-style "bsd") (setq 
c-basic-offset 4))))


Danx
-- 
for personal replies change spamoff to chris


reply via email to

[Prev in Thread] Current Thread [Next in Thread]