[comp.emacs] Adding to auto-mode-alist

kge@hpsmtc1.HP.COM (Kevin Ewert) (10/18/88)

I'm a new user of gnuemacs, and I'm very much sold on it as a powerful
addition to my set of software development tools.  But I'd like to add
a simple (at least in my mind) customization to my .emacs file, but I
don't know LISP well enough to attempt it.  I would like to add
another file type to the auto-mode-alist variable that invokes the
text-mode, but I can't seem to get the syntax right.

Any help in this area would be greatly appreciated.  Thanks.

av@utacs.UTA.FI (Arto Viitanen) (10/20/88)

In article <11520001@hpsmtc1.HP.COM> kge@hpsmtc1.HP.COM (Kevin Ewert) writes:

> I would like to add
>another file type to the auto-mode-alist variable that invokes the
>text-mode, but I can't seem to get the syntax right.
>
>Any help in this area would be greatly appreciated.  Thanks.

I use following command in my .emacs file, 

(setq auto-mode-alist (append auto-mode-alist
			      '(("\\.pc$*" . c-mode)
				("\\.pro$" . mprolog-mode))))

i.e. files with extension .pc invoke c-mode and files with .pro extension
invoke mprolog-mode (prolog-mode with minor changes).

Hope this helps.

Arto Viitanen
University Of Tampere, Department of Computer Science
P.O.Box 607
SF-33101 TAMPERE
FINLAND

av@utacs.uta.fi,
av@comic.uta.fi

----------------

bob@allosaur.cis.ohio-state.edu (Bob Sutterfield) (10/21/88)

In article <11520001@hpsmtc1.HP.COM> kge@hpsmtc1.HP.COM (Kevin Ewert) writes:
>I would like to add another file type to the auto-mode-alist variable
>that invokes the text-mode, but I can't seem to get the syntax right.

There may be an easier, more elegant way, but this works for me, in my
.emacs file.  Nothing here does text-mode, but you'll get the idea.

	(setq auto-mode-alist (append '(
				       ("\\.1$" . nroff-mode)
				       ("\\.2$" . nroff-mode)
				       ("\\.3$" . nroff-mode)
				       ("\\.4$" . nroff-mode)
				       ("\\.5$" . nroff-mode)
				       ("\\.6$" . nroff-mode)
				       ("\\.7$" . nroff-mode)
				       ("\\.8$" . nroff-mode)
				       ("\\.man$" . nroff-mode)
				       ("\\.me$" . nroff-mode)
				       ("\\.mm$" . nroff-mode)
				       ("\\.mr$" . nroff-mode)
				       ("\\.ms$" . nroff-mode)
				       ("\\.Z$" . z-mode)
				       ) auto-mode-alist))
-=-
Zippy sez,								--Bob
I need to discuss BUY-BACK PROVISIONS with at least
 six studio SLEAZEBALLS!!

kge@hpsmtc1.HP.COM (Kevin Ewert) (10/22/88)

Thanks to all of you who sent mail to me with suggestions on adding to
auto-mode-alist.  It works great!

iwm@asun2.ic.ac.uk (Ian Moor) (10/26/88)

>>I would like to add another file type to the auto-mode-alist variable
>>that invokes the text-mode, but I can't seem to get the syntax right.

>There may be an easier, more elegant way, but this works for me, in my
>.emacs file.  Nothing here does text-mode, but you'll get the idea.

	(setq auto-mode-alist (append '(
				       ("\\.1$" . nroff-mode)
				       ("\\.2$" . nroff-mode)
				       ("\\.3$" . nroff-mode)
				       ("\\.4$" . nroff-mode)
				       ("\\.5$" . nroff-mode)
				       ("\\.6$" . nroff-mode)
				       ("\\.7$" . nroff-mode)
				       ("\\.8$" . nroff-mode)
				       ("\\.man$" . nroff-mode)
				       ("\\.me$" . nroff-mode)
				       ("\\.mm$" . nroff-mode)
				       ("\\.mr$" . nroff-mode)
				       ("\\.ms$" . nroff-mode)
				       ("\\.Z$" . z-mode)
				       ) auto-mode-alist))

The thing that caught me is that you must load the file containing the mode
definition or put it on your autoload list thus
   (autoload 'z-mode "z-mode" "Uncompress file" t)
otherwise you get a strange complaint about file syntax.

bob@allosaur.cis.ohio-state.edu (Bob Sutterfield) (11/01/88)

In article <IWM.88Oct25183558@asun2.ic.ac.uk> iwm@asun2.ic.ac.uk (Ian Moor) writes:
|>>I would like to add another file type to the auto-mode-alist variable
|>>that invokes the text-mode, but I can't seem to get the syntax right.
|>
|>There may be an easier, more elegant way, but this works for me, in my
|>.emacs file.  Nothing here does text-mode, but you'll get the idea.
|
|The thing that caught me is that you must load the file containing
|the mode definition or put it on your autoload list thus
|   (autoload 'z-mode "z-mode" "Uncompress file" t)
|otherwise you get a strange complaint about file syntax.

Good point.  Autoloads come earlier in my own .emacs, and the original
inquiry was only about auto-mode-alist appending syntax, so I didn't
bother including the autoload line that looks remarkably similar to
the one you suggest.
-=-
Zippy sez,								--Bob
My life is a patio of fun!