🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #1907

Re: c-mode per file customisation

#1907
From: Juergen Nickelsen
Date: Wed, 30 Dec 1992 14:04
38 lines
1786 bytes
In article <DAVE.92Dec30170656@grunge.auspost.com.au>
dave@grunge.auspost.com.au (Dave Cole) writes:

> What would be nice is if you could embed the c-mode settings in each
> source file - then set these as you read the file in to a buffer.
> When you switch to a buffer would also be a nice time to change these
> variables.

There are several variables that control the formatting style for C
programs -- I set the following in my .emacs:

    (setq c-indent-level 4)
    (setq c-continued-statement-offset 4)
    (setq c-brace-offset -4)
    (setq c-argdecl-indent 0)

(Please don't discuss these settings -- this is just an example of my
*personal* preferences.)

You can set these variables in each sources files separately by using
Emacs' "Local Variables" section (read the node "File Variables" in
the Emacs manual). The bottom of a source file would then look like
this:

/*
 * Local Variables:
 * c-indent-level: 4
 * c-continued-statement-offset: 4
 * c-brace-offset: -4
 * c-argdecl-indent: 0
 * End:
 */

These variables (usually global) become buffer-local when set in this
way.

--
Juergen Nickelsen
Technical Details
Message-ID: <NICKEL.92Dec30150430@tempest.cs.tu-berlin.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!Sirius.dfn.de!mailgzrz.TU-Berlin.DE!mailgzrz.tu-berlin.de!nickel
References: <DAVE.92Dec30170656@grunge.auspost.com.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!Sirius.dfn.de!mailgzrz.TU-Berlin.DE!mailgzrz.tu-berlin.de!nickel
From: nickel@cs.tu-berlin.de (Juergen Nickelsen)
Newsgroups: gnu.emacs.help
Subject: Re: c-mode per file customisation
Date: 30 Dec 1992 14:04:33 GMT
Organization: STONE Project, Technical University of Berlin, Germany
Lines: 38
Message-ID: <NICKEL.92Dec30150430@tempest.cs.tu-berlin.de>
References: <DAVE.92Dec30170656@grunge.auspost.com.au>
Reply-To: nickel@cs.tu-berlin.de
NNTP-Posting-Host: tempest.cs.tu-berlin.de
In-reply-to: dave@grunge.auspost.com.au's message of Wed, 30 Dec 1992 07:06:56 GMT