🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #189125

Re: Selective file loading in .emacs

#189125
From: Barr3y Jaspan
Date: Thu, 25 Apr 1991 00:03
21 lines
1547 bytes
In article <5705@ns-mx.uiowa.edu>, csh007@umaxc.weeg.uiowa.edu (Paul Henning) writes:
|> I was wondering if there is a way to selectively load an .elc file from
|> .emacs depending on the extension of the file being loaded...

The situation you've described is EXACTLY what the auto-mode-alist is for.  If
you want to enter ada-mode when you load a file that ends in .a, add the
following lines your .emacs:

(setq auto-mode-alist (append '(("\\.a$" . ada-mode)) auto-mode-alist))

(Using append instead of cons makes sure that your setting for .a overrides
any site-defined default.)  Now, in order to make sure that ada-mode is loaded
when it is first called (and not before), add the following line to your
.emacs:

(autoload 'ada-mode "ada-mode" "Major Mode for ADA." t nil)

The second argument should be the full path of your ada-mode.el{,c} file. 

-- 
Barr3y Jaspan, bjaspan@mit.edu
Technical Details
Message-ID: <1991Apr25.000314.29469@athena.mit.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!bjaspan
References: <5705@ns-mx.uiowa.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103b8b,168ec0827c4bd125
X-Google-Attributes: gid103b8b,public
X-Google-ArrivalTime: 1991-04-25 12:38:26 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!bjaspan
From: bjaspan@athena.mit.edu (Barr3y Jaspan)
Newsgroups: gnu.emacs.help
Subject: Re: Selective file loading in .emacs
Message-ID: <1991Apr25.000314.29469@athena.mit.edu>
Date: 25 Apr 91 00:03:14 GMT
References: <5705@ns-mx.uiowa.edu>
Sender: news@athena.mit.edu (News system)
Distribution: gnu
Organization: Massachusetts Institute of Technology
Lines: 21