🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #189840

Re: c++-mode.el

#189840
From: Brian A. Kell
Date: Tue, 06 Nov 1990 14:36
36 lines
1999 bytes
In article <125503@linus.mitre.org>, jfjr@mbunix.mitre.org (Freedman) writes:
> ... How do I arrange things so that
> c++-mode.el is installed and I automagically go into
> c++mode when I edit a file with a .cc extension...
>                                  Jerry Freedman,Jr

I have the following in my .emacs file.  it adds the needed .cc
extension to the list of known extensions, so that the right mode runs
automatically...

...
;; Add the .cc suffix to the auto-mode-alist to automatically invoke c++ mode:
(setq auto-mode-alist (cons (cons "\\.cc$" 'c++-mode) auto-mode-alist))

;; Add '.txt' extension to auto-mode-alist to automatically invoke text mode:
(setq auto-mode-alist (cons (cons "\\.txt$" 'text-mode) auto-mode-alist))
...

Obviously, any other extensions could also be added.  If you want to 
add more than one, you should probably do something like:

...
(setq auto-mode-alist (append
                           (list
                                 (cons "\\.cc$" 'c++-mode)
                                 (cons "\\.txt$" 'text-mode)
                                 (... any other extensions ...))
		       auto-mode-alist))
...

--------------------------------------------------------------------
Brian Kell
SUNY/Albany Departments of Computer Science and Biological Sciences
brian@isadora.albany.edu
kell@cs.albany.edu
bk7295@albnyvms.bitnet
Technical Details
Message-ID: <242@karp.albany.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!shelby!apple!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!crdgw1!cs.albany.edu!kell
References: <125503@linus.mitre.org>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103b8b,10c7f806c9b1fa88
X-Google-Attributes: gid103b8b,public
X-Google-ArrivalTime: 1990-11-06 06:36:15 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!shelby!apple!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!crdgw1!cs.albany.edu!kell
From: kell@cs.albany.edu (Brian A. Kell)
Newsgroups: gnu.emacs.help
Subject: Re: c++-mode.el
Message-ID: <242@karp.albany.edu>
Date: 6 Nov 90 14:36:15 GMT
References: <125503@linus.mitre.org>
Organization: SUNY Albany, Comp Sci Dept, Albany, NY
Lines: 36
Posted: Tue Nov  6 15:36:15 1990