;; -*- emacs-lisp -*-
;;
;; .emacs
;;
;; Default Emacs startup file.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defconst cjw-emacsrc-version "$Id: emacs.rc,v 1.3 2000/10/17 15:07:57 cwynne Exp $")

; This function provided by
;    Matt Welsh and Karl E. Vogel <vogelke@c-17igp.wpafb.af.mil>
; through comp.emacs.

(defun byte-compile-if-newer-and-load (file)
	"Byte-compile file.el if newer than file.elc."
	(if (file-newer-than-file-p 
	     (concat file ".el") (concat file ".elc"))
	    (byte-compile-file (concat file ".el")))
	(load file))

; Decide whether we are running XEmacs, and whether we are in X.

(defvar running-xemacs-p (string-match "XEmacs\\|Lucid" emacs-version))
(if running-xemacs-p
    (defvar running-X-p	(eq (device-type) 'x))
  (defvar   running-X-p (eq window-system 'x))
  )

; For XEmacs:

(if running-xemacs-p
    (progn
      (defvar startup-file    "~/lib/emacs/lisp/xstartup")
      (setq save-options-file "~/lib/emacs/lisp/x-prefs.el")
	  (setq custom-file        save-options-file)
      (byte-compile-if-newer-and-load save-options-file)
    )
; For other Emacsen:
  (defvar startup-file "~/lib/emacs/lisp/startup"))

; Source the real startup file:

(byte-compile-if-newer-and-load startup-file)

(if (not running-xemacs-p)
;; Options Menu Settings
;; =====================
(cond
 ((and (string-match "XEmacs" emacs-version)
       (boundp 'emacs-major-version)
       (or (and
            (= emacs-major-version 19)
            (>= emacs-minor-version 14))
           (= emacs-major-version 20))
       (fboundp 'load-options-file))
  (load-options-file "~/lib/emacs/lisp/x-prefs.el")))
;; ============================
;; End of Options Menu Settings
)