;;;-*-EMACS-LISP-*- ;;; ;;; Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994 Leigh L. Klotz, Jr. ;;; All Rights Reserved. ;;; ;;; ;;; default-major-mode isn't the right thing. This fixes it so the ;;; *scratch* buffer will still be in lisp-interaction-mode, and other ;;; buffers will be appropriately named. ;;; As a bonus, if you create a buffer named foo.ps it will be in PostScript ;;; mode, etc. ;;; (defvar default-appropriate-default-mode 'text-mode) (defun appropriate-default-mode () (catch 'return (let ((file (buffer-file-name (current-buffer)))) (if (null file) (let ((buffer (buffer-name))) (if (string-equal buffer "*scratch*") (lisp-interaction-mode) (progn (dolist (item auto-mode-alist) (if (string-match (car item) buffer) (throw 'return (funcall (cdr item))))) (funcall default-appropriate-default-mode)))) (funcall default-appropriate-default-mode))))) ;; This can't be set until the above function is defined, ;; since loading compiled files creates buffers. (setq default-major-mode 'appropriate-default-mode)