Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!utgpu!water!watmath!clyde!cbosgd!mandrill!hal!ncoast!allbery
From: allbery@ncoast.UUCP
Newsgroups: comp.emacs
Subject: Re: Appending the new stuff to the auto-mode-alist
Message-ID: <6294@ncoast.UUCP>
Date: Sat, 28-Nov-87 17:38:35 EST
Article-I.D.: ncoast.6294
Posted: Sat Nov 28 17:38:35 1987
Date-Received: Tue, 1-Dec-87 05:08:53 EST
References: <414@slb-sdr.UUCP>
Reply-To: allbery@ncoast.UUCP (Brandon Allbery)
Followup-To: comp.emacs
Organization: Cleveland Public Access UN*X, Cleveland, Oh
Lines: 26

As quoted from <414@slb-sdr.UUCP> by saito@slb-sdr.UUCP (Naoki Saito):
+---------------
| 	Hello!  I tried to append the new stuff to the auto-mode-alist
| by putting the following line to my .emacs file.
| 
| (append 'auto-mode-alist '(("\\.F$" . fortran-mode)
| 			   ("\\.for$" . fortran-mode)
| 			   ("\\.txt$" . text-mode)))
| 
| 	But in fact, this didn't work.  Of course, it's possible to put
+---------------

The (append) form doesn't have side effects; it returns the new alist instead
as a result.  I see someone else suggested using (nconc) instead... but I
sure wouldn't want to try it!  (I have a healthy respect for code with side
effects; and (nconc) is a good reason for having such respect.)

The way to do it?  Add another form on the outside:

(setq auto-mode-alist (append 'auto-mode-alist ...))

That way, auto-mode-alist gets the new value and you haven't tempted Fate.
-- 
Brandon S. Allbery		      necntc!ncoast!allbery@harvard.harvard.edu
 {hoptoad,harvard!necntc,cbosgd,sun!mandrill!hal,uunet!hnsurg3}!ncoast!allbery
			Moderator of comp.sources.misc