(setq inhibit-startup-message t)
(setq auto-save-list-file-prefix nil)
(put 'narrow-to-region 'disabled nil)
(put 'eval-expression 'disabled nil)
(setq default-major-mode 'indented-text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(setq transient-mark-mode t)
(setq mark-even-if-inactive t)

;; set function keys and mouse buttons
(load "dos-term")

;; prevent echoing ^M in the shell (a hard one)
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)

(if (locate-library "sml-site") (load "sml-site"))

;; rsl-mode
(load "rsl-mode")

;; rsltc
(load "rsltc")

;; use font lock mode if available
(if (locate-library "font-lock") (global-font-lock-mode t))

;; load auctex plus support for converting RSL to LaTeX
(if (locate-library "tex-site")
    (progn
      (load "tex-site")
      (require 'latex)
      (setq tex-default-mode 'latex-mode)
      (setq auto-mode-alist (cons '("\\.tex\\'" . latex-mode) auto-mode-alist))
      (load "rslconvert")
      (define-key LaTeX-mode-map "\C-cs" 'latex-symbol)
      (define-key LaTeX-mode-map "\C-c\C-n" 'rsl-n)
      (define-key LaTeX-mode-map "\C-c\C-t" 'do-rsl)
      (define-key LaTeX-mode-map "\C-c\C-u" 'undo-rsl)
      (define-key LaTeX-mode-map "\C-c\C-r" 'rsl-expr)
      ))

(cond ((file-exists-p "c:/ispell4/exe/ispell.exe")
       (autoload 'ispell-word "ispell4" 
         "Check spelling of word at or before point" t)
       (autoload 'ispell-complete-word "ispell4" 
         "Complete word at or before point" t)
       (autoload 'ispell-region "ispell4" 
         "Check spelling of every word in the region" t)
       (autoload 'ispell-buffer "ispell4" 
         "Check spelling of every word in the buffer" t)
       (setq ispell-command "c:/ispell4/exe/ispell.exe"
	     ispell-look-dictionary "c:/ispell4/ispell.words"
	     ispell-look-command "c:/ispell4/exe/look.exe"
	     ispell-command-options (list "-d" "c:/ispell4/ispell.dict"))
       ;;still necessary
      (setenv "TEMP" "c:/windows/temp")
      (setenv "TMP" "c:/windows/temp")))

; Don't use cygwin for shells
; (cond ((>= emacs-major-version 20)
; ;; This assumes that Cygwin is installed in C:\cygwin (the
; ;; default) and that C:\cygwin\bin is not already in your
; ;; Windows Path (it generally should not be).
; ;;
; (setq exec-path (cons "D:/cygwin/bin" exec-path))
; (setenv "PATH" (concat "D:\\cygwin\\bin;" (getenv "PATH")))
; ;;
; ;; NT-emacs assumes a Windows command shell, which you change
; ;; here.
; ;;
; (setq process-coding-system-alist '(("bash" . undecided-unix)))
; (setq w32-quote-process-args ?\")
; (setq shell-file-name "bash")
; (setenv "SHELL" shell-file-name) 
; (setq explicit-shell-file-name shell-file-name) 
; ;;
; ;; This removes unsightly ^M characters that would otherwise
; ;; appear in the output of java applications.
; ;;
; (add-hook 'comint-output-filter-functions
; 	  'comint-strip-ctrl-m)
; ))


;;end of _emacs


(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(TeX-command-list (quote (("TeX" "tex \\nonstopmode\\input %t" TeX-run-TeX nil t) ("LaTeX" "%l \\nonstopmode\\input{%t}" TeX-run-LaTeX nil t) ("LaTeX PDF" "pdflatex \\nonstopmode\\input{%t}" TeX-run-LaTeX nil t) ("View" "%v" TeX-run-discard nil nil) ("Print" "C:/Ghostgum/gsview/gsview32 %f" TeX-run-command t nil) ("File" "dvips %d -o %f " TeX-run-command t nil) ("BibTeX" "bibtex %s" TeX-run-BibTeX nil nil) ("Index" "makeindex %s" TeX-run-command nil t) ("Check" "lacheck %s" TeX-run-compile nil t) ("Other" "" TeX-run-command t t))))
 '(TeX-view-style (quote (("^a5$" "yap %d -paper a5") ("^landscape$" "yap %d -paper a4r -s 4") ("^epsf$" "C:/Ghostgum/gsview/gsview32 %f") ("." "yap -1 -s%n%b %d")))))
(custom-set-faces
  ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 )
