Path: utzoo!mnetor!uunet!husc6!mailrus!umix!umich!mibte!gamma!sabre!blade!ras From: ras@blade.UUCP (R.A. Schnitzler) Newsgroups: comp.emacs Subject: Re: Need help w/ Gnu auto-mode-alist Message-ID: <957@blade.UUCP> Date: 12 Feb 88 21:13:27 GMT References: <760003@hpwale.HP.COM> <3990004@hpesoc1.HP.COM> Organization: Bellcore, Red Bank ,NJ ) Lines: 32 In-reply-to: rsnyder@hpesoc1.UUCP's message of 9 Feb 88 17:30:41 GMT Posting-Front-End: GNU Emacs 18.41.4 of Fri May 22 1987 on blade (berkeley-unix) Rob Snyder (and other people) have suggested solutions such as: > (setq auto-mode-alist > (cons '("\\.c" . c++-mode) auto-mode-alist)) > (setq auto-mode-alist > (cons '("\\.doc" . nroff-mode) auto-mode-alist)) This certainly is fine, but I find it a bit cumbersome. Since no one else has mentioned this, here is my simple way of doing this: (defun auto-mode (pattern function) (setq auto-mode-alist (cons (cons pattern function) auto-mode-alist))) (auto-mode "\\.doc" 'nroff-mode) (auto-mode "\\.c" 'c++-mode) etc. By introducing the function, I make the declaration of modes more readable, and it is conceptually easier for me to add/delete/change/review them. "It's worse than that, Ray Schnitzler it's physics, Jim" Bell Communication Research arpa: schnitz!bellcore.com uucp: ...!bellcore!schnitz -- "It's worse than that, Ray Schnitzler it's physics, Jim" Bell Communication Research arpa: schnitz!bellcore.com uucp: ...!bellcore!schnitz