🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #2055

c-mode per file customisation

#2055
From: Chris Moore
Date: Tue, 05 Jan 1993 07:48
57 lines
2606 bytes
dave@grunge.auspost.com.au (Dave Cole) said:

> Has anyone tackled the problem you have when more than one person
> works on some system where multiple formatting styles are present.

> 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's a package in the emacs lisp code archive which allows you to define
a set of named styles (eg. "BSD", "K&R", "GNU", etc), then you can tag
each file with the name of the style you want to use.

From the top of the file:

-----cut-----8<-----here-----8<--------------8<--------------
; Definitions for buffer specific c-mode indentation style.
; Written by Daniel LaLiberte (liberte@a.cs.uiuc.edu)
; while at Gould.  This is free.
 
; There are several ways to call set-c-style.
;
; 1. Set the c-style variable in the local variables list 
;    with "c-style: GNU" or whatever you like and
;    call set-c-style without argument in c-mode-hook.
;
; 2. Call set-c-style with style argument in c-mode-hook.
;    This will set the style for every c file the same.
;
; 3. Put "eval: (set-c-style 'GNU)" in the local variables list.
; 
; 4. Call set-c-style interactively.  It prompts for the style name.
 
; The default value of c-style is default-c-style.
; I put (autoload 'set-c-style "c-style.el" nil t) in my .emacs.
-----cut-----8<-----here-----8<--------------8<--------------

The LCD entry:

-----cut-----8<-----here-----8<--------------8<--------------
	    GNU Emacs Lisp Code Directory Apropos -- "c-style"


c-style		  87-08-27
     D. LaLiberte, <liberte@a.cs.uiuc.edu>
     archive.cis.ohio-state.edu:/pub/gnu/emacs/elisp-archive/as-is/c-src-doc.el.Z
     C-mode indentation.
-----cut-----8<-----here-----8<--------------8<--------------

Chris.
--
moore@src.bae.co.uk   /      Chris Moore      \
                     / Sowerby Research Centre \
                     \  British Aerospace PLC  /
tel: +44 272 363375   \      BRISTOL, UK      /
Technical Details
Message-ID: <9301050748.AA21343@sun19.src.bae.co.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!src.bae.co.UK!moore
References: <DAVE.92Dec30170656@grunge.auspost.com.au>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.help
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!src.bae.co.UK!moore
From: moore@src.bae.co.UK (Chris Moore)
Subject: c-mode per file customisation
Message-ID: <9301050748.AA21343@sun19.src.bae.co.uk>
Sender: daemon@cis.ohio-state.edu
Organization: Gatewayed from the GNU Project mailing list help-gnu-emacs@prep.ai.mit.edu
References: <DAVE.92Dec30170656@grunge.auspost.com.au>
Date: Tue, 5 Jan 1993 07:48:46 GMT
Lines: 57