[gnu.emacs] fundamental-mode for .c files

scottb@ogccse.ogc.edu (Scott Baker) (11/13/89)

---------

I prefer to use fundamental-mode when editing .c files.  I tried
to create a .emacs file to default to fundamental mode regardless
of the file extension with the following line:

set-variable auto-mode-alist (".*" . fundamental-mode)

I tried a couple of variations of the above and nothing worked.
Anyone help me out.

		Thanks in Advance:
		Scott Baker <scottb@cse.ogc.edu>

wiles@talon.uucp (Dale Wiles) (11/14/89)

In article <5582@ogccse.ogc.edu> scottb@ogccse.ogc.edu (Scott Baker) writes:
>I prefer to use fundamental-mode when editing .c files.
>		[Stuff deleted]
>Anyone help me out.

This is what I use:
-------------------------Chop-----------------------------------------
;
;rm-auto-mode is a function to remove all the elements from
;auto-mode-alist that have the regexp 'old-mode as their car. This
;isn't needed, but it's nice house keeping.
;
(defun rm-auto-mode (old-mode)
  "Return all elements that don't have a car of OLD-MODE from auto-mode-alist"
  (let
      ((new-list ())
       (copy-list auto-mode-alist))
    (while copy-list
      (if (not (string= (car (car copy-list)) old-mode))
	  (setq new-list (append new-list (list (car copy-list)))))
      (setq copy-list (cdr copy-list)))
    new-list))
;
;Get rid of the old auto-mode for .c files.
;
(setq auto-mode-alist (rm-auto-mode "\\.c$"))

;
;Set a new default mode for .c files.
;(In this case fundamental-mode)
;
(setq auto-mode-alist
      (cons (cons '"\\.c$" 'fundamental-mode) auto-mode-alist))
--------------------------Chop----------------------------------------

This has the advantage of leaving all your other special modes intact.

Enjoy.

				Fundamental Dale.

Reply to: ...!{watmath,boulder,decvax,rutgers}!sunybcs!planck!hercules!wiles
*Disclaimer: Anyone who's opinion is changed by a *Looks more (bonk)
*disclaimer should be shot. If I said it, I meant *like a sick-e-more (bonk)
*it, or else you were too stupid to get the joke! *to me. Yogi the Space Bear.