(setq vip-inhibit-startup-message t)
(put 'eval-expression 'disabled nil)

;; auto load definitions

(defun prepend-to-auto-mode-alist (pair)
  "Add PAIR onto start of auto-mode-alist"
  (setq auto-mode-alist (cons pair auto-mode-alist)))

(prepend-to-auto-mode-alist ' ("\\.mod$" . g-mode))
(prepend-to-auto-mode-alist ' ("\\.def$" . g-mode))

(setq load-path (cons "/user/gaius/m2/comp/el" load-path))

(autoload 'g-mode "g-mode" "Gaius' modula-2 mode")

;; enable vi-style scrolling one line at a time
(setq scroll-step 1)

;; load info so we can munge its keymap.
;; lets us put the cursor on top of a menu entry, then <RETURN> to select it.
(require 'info)
(define-key Info-mode-map "\C-m" 'Info-menu)
(define-key Info-mode-map "\C-j" 'Info-menu)
;; Ronald's current ~/.emacs

;; a couple of modules that weren't included in the original distribution.
(autoload 'getris "tetris" "Tetris Game" t)
(autoload 'gdbsrc "gdbsrc" "GDB source debugger mode" t)

;; Takes *ages* to load, but have to do it now, so we can munge
;; its keymap.  Also, we want to be able to turn on VI mode at the touch
;; of a ^Z
;;(vip-mode)
;;(define-key vip-mode-map " " 'forward-char)
;;(define-key vip-mode-map "\C-m" 'vip-next-line-at-bol)
;;(define-key vip-mode-map "\C-j" 'vip-next-line-at-bol)

(global-set-key "\M-o"  'other-window)
(global-set-key "\C-i" 'self-insert-command)
;; (global-set-key "\C-s", 'shell)
;; (global-set-key "\C-g", 'goto-line)
;; (global-set-key "\C-w", 'what-line)
;; (global-set-key "\C-d", 'gdb)
;; (global-set-key "\C-c", 'compile)
;; (global-set-key "\C-t", 'toggle-read-only)

(defun setup-escape-paren-function-keys ()

;; Function keys that are available on VT100/ANSI style terminals
;; Just a few samples.  I don't actually use these bindings other than
;; the F12 Next-error which is *very* useful.
	(define-key global-map "\M-[M" 'describe-key)	;; F1
	(define-key global-map "\M-[N" 'where-is)	;; F2
	(define-key global-map "\M-[O" 'info)		;; F3
	(define-key global-map "\M-[P" 'next-error)	;; F4
	(define-key global-map "\M-[Q" 'next-error)	;; F5
	(define-key global-map "\M-[R" 'next-error)	;; F6
	(define-key global-map "\M-[S" 'next-error)	;; F7
	(define-key global-map "\M-[T" 'next-error)	;; F8
	(define-key global-map "\M-[U" 'next-error)	;; F9
	(define-key global-map "\M-[V" 'next-error)	;; F10
	(define-key global-map "\M-[W" 'next-error)	;; F11
	(define-key global-map "\M-[X" 'next-error)	;; F12
)

(setq term-setup-hook
  (function
   (lambda ()
     (setq TERM (or (getenv "TERM") ""))
     (if (or
	(string-match "^vt100$" TERM)
	(string-match "^vt102$" TERM)
	(string-match "^ansi$" TERM)
	(string-match "^ansiemacs$" TERM))
	(setup-escape-paren-function-keys)
     ))))
