;                   -*- Lisp -*-

;;
;; This is a sample `~/.emacs' file. 
;;

;; Global stuff

(global-font-lock-mode 1)
(setq font-lock-maximum-decoration t)
(setq column-number-mode t)
(setq frame-title-format (concat user-login-name "@" invocation-name))

(defun jay-switch-cc-hh () (interactive)
  (let ((current-buf-name (buffer-file-name (current-buffer))))
    (if (stringp current-buf-name)
 (let ((match-h (string-match "\\.hh$" buffer-file-name)))
	  (if (or match-h
		  (string-match "\\.cc$" buffer-file-name))
	      (if match-h
		  (find-file (concat (substring buffer-file-name 0 -3) ".cc"))
		(find-file (concat (substring buffer-file-name 0 -3) ".hh")))
	    (error "Not a C++ file")))
	  (error "Not a C++ file"))))

(defun jay-goto-comp () (interactive)
  (switch-to-buffer "*compilation*"))

(custom-set-variables
 '(compilation-window-height 8)
 '(compilation-scroll-output t)
 '(compilation-error-screen-columns t)
 '(compilation-search-path (quote (nil)))
 '(compile-command ""))
(custom-set-faces)

(global-set-key [f2] 'rmail)
(global-set-key [f3] 'goto-line)
(global-set-key [f4] 'shell)
(global-set-key [f5] 'jay-switch-cc-hh)
(global-set-key [f6] 'auto-fill-mode)
(global-set-key [f9] 'compile) 
(global-set-key [f11] 'next-error)
(global-set-key [f12] 'jay-goto-comp)


(defun my-c-mode-common-hook ()
  (setq c-basic-offset 8)
  (c-set-offset 'substatement-open 0)
  (auto-fill-mode)
  (c-set-style "linux")
  (setq c-indent-level 8)
  (setq c-brace-offset 0)
  (setq c-continued-statement-offset 8)
  (setq c-continued-brace-offset -8)
  (setq c-label-offset -8)
  (setq c-member-init-indent 8)
  (setq c++-continued-member-init-offset NIL)
  (setq fill-column 100))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
(add-hook 'c++-mode-hook 'my-c-mode-common-hook)


;; Add local stuff here

