Path: utzoo!utgpu!water!watmath!clyde!bellcore!decvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!ukc!eagle!arc1 From: arc1@eagle.ukc.ac.uk (A.R.Curtis) Newsgroups: comp.emacs Subject: Re: Need help w/ Gnu auto-mode-alist Message-ID: <4412@eagle.ukc.ac.uk> Date: 14 Feb 88 11:20:25 GMT References: <760003@hpwale.HP.COM> Reply-To: arc1@ukc.ac.uk (A.R.Curtis) Organization: Computing Lab, University of Kent at Canterbury, UK. Lines: 38 Summary: Expires: Sender: Followup-To: In article <760003@hpwale.HP.COM> frede@hpwale.HP.COM (Fred Ehrhardt) writes: >Can anyone answer a question about modifying Gnuemacs' auto-mode-alist? >I'd like files with a .c suffix to cause c++-mode to be loaded and run, >and files with a .doc suffix to invoke nroff-mode. The Gnu manual >suggests that this can be done using E-lisp. Ok, suppose we do it just for yourself. I've never installed emacs (what a shame) and so I can't really help you there (though intuition tells me that defaults.el might be right). The auto-mode-alist consists of a list of pairs associating file name patterns with modes (..... ("\\.c$" . c++-mode) ("\\.doc$" . nroff-mode) .....) would be what you want. I have things like this in my .emacs, e.g. ;;; all files ending ".n(roff)", ".doc(ument)" are assumed to be for nroff. (if (assoc "\\.n$" auto-mode-alist) nil (nconc auto-mode-alist '(("\\.n$" . nroff-mode)))) (if (assoc "\\.doc$" auto-mode-alist) nil (nconc auto-mode-alist '(("\\.doc$" . nroff-mode)))) (plus some others....) Hope this is of some help Tony .-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-. | Tony Curtis |Computing Lab., Univ. Kent At Canterbury | | ..!mcvax!ukc!arc1 arc1@uk.ac.ukc |Canterbury, Kent CT2 7NZ | `-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-'