;;  gnu emacs startup file .emacs
;;
;;  Jwahar R. Bammi
;;
;; personal key preferences
;;
;;
;;
(setq debug-on-error nil)
;;
(global-set-key "\^X6" 'indent-region)
(global-set-key "\^X3" 'kill-compilation)
(global-set-key "\^]" 'isearch-forward)
(global-set-key "\^H" 'delete-backward-char)
(global-set-key "\^_" 'help-command)
(global-set-key "\eg" 'goto-line)
(global-set-key "\^Xd" 'cd)
(global-set-key "\^C\^C" 'compile)
(global-set-key "\^C\^G" 'grep)
(global-set-key "\e " 'set-mark-command)
(global-set-key "\en" 'next-error)
;;(global-set-key "\ec" 'ispell-complete)
(global-set-key "\e$" 'ispell-word)
(define-key ctl-x-map "g" 'goto-line)
(define-key ctl-x-map "!" 'electric-command-history)
(define-key ctl-x-map "=" 'what-line)
(define-key ctl-x-map "\^R" 'copy-to-register)
(define-key ctl-x-map "\^I" 'insert-register)
(define-key ctl-x-map "\^Z" 'scroll-other-window)
(setq default-major-mode 'text-mode)
(setq ctl-arrow t)
(setq meta-flag t)
(setq-default c-mode-hook
	      '(lambda ()		; for C mode:
		 (turn-on-auto-fill)	; use auto-fill
		 (defvar fill-loaded nil)
		 (if fill-loaded nil
		   (load-library "c-fill") ; load c-comment
		   (setq fill-loaded t)))) ; (only once!)

;; define function keys
(define-key global-map "\C-x\C-b" 'electric-buffer-list) ; ^X^B
(define-key global-map "\M-O" 'advertised-undo)   
;
(defun show-matching-paren (arg)
  "Act as if a close-paren had been self-inserted."
  (interactive "p")
  (forward-char)
  (blink-matching-open)
  (backward-char))

;; ESC-ESC
(put 'eval-expression 'disabled nil)
;;
;; All files end with a Newline automatically
(setq TeX-dvi-print-command "dviprint -d 5 -s")
;;
;; Where to find info directory
(setq Info-directory "/local/emacs/info/")
(setq Info-enable-edit t)
;;
;; default major mode
;; turn-on-auto-fill is def'ed in simple.el
(setq text-mode-hook 'turn-on-auto-fill) 
;;
;; Subshell prompt pattern
(setq shell-prompt-pattern "^[^#$%>]*[#$%>][0-9]* *")

;; default mode for TeX editing
(setq-default TeX-default-mode 'LaTeX-mode)
;;
(autoload 'gnu-plot-mode "gnuplot" nil t)
(autoload 'cal "calendar" "Nifty Calendar package" t)
(setq load-path (append load-path 
			(list
			 "/home/erlingh/Emacs"
			 "/home/erlingh/Emacs/modes"
			 "/home/erlingh/Emacs/modes/auc-tex"
			 "/home/erlingh/Emacs/templates"
			 "/home/erlingh/SmallTalk"
			 "/home/erlingh/Emacs/hooks")))
(autoload 'template "template" "Setter inn templat." t)
(autoload 'set-template-file-name "jonto" "Sett templat-filnavn.")
(setq template-file-directory "/home/erlingh/Emacs/templates")
(setq template-file-extension "-templates")

;(load "c-mode-hook" nil t)
;(defun header()
;  (interactive)
;  (template "function-header"))
;(global-set-key "\C-x7" 'template)
;(global-set-key "\C-x8" 'header)

(autoload 'c++-mode "c++-mode" "" t)
(setq auto-mode-alist (append '(("\\.bib$" . bibtex-mode)
				("\\.tex$" . latex-mode)
				("\\.el$" . lisp-interaction-mode)
				("\\.st$" . smalltalk-mode)
				("\\.cc$" . c++-mode)
				("\\.hh$" . c++-mode)) auto-mode-alist))

(autoload 'ispell-buffer "ispell" "" t)
(autoload 'smalltalk-mode "~/SmallTalk/st" "" t)
(global-set-key "\C-x9" 'compile)
(setq shell-file-name "/bin/sh")        ; Denne brukes ved compile.

(setq default-fill-column 70)
(setq require-final-newline "yes")
(setq mail-archive-file-name "~/OUTBOX" )
(load "time" nil t)
(display-time)
;(find-file "/usr/local/src/bootedit/minixed.cc")
