;;[C .emacs

;;; uncomment this line to disable loading of "default.el" at startup
(setq inhibit-default-init t)

;; turn on font-lock mode
(when (fboundp 'global-font-lock-mode)
(global-font-lock-mode t))

;; enable visual feedback on selections
;(setq transient-mark-mode t)

;; default to better frame titles
(setq frame-title-format
(concat "%b - emacs@" system-name))

;; default to unified diffs
(setq diff-switches "-u")
(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(case-fold-search t)
 '(current-language-environment "Latin-1")
 '(default-input-method "latin-1-prefix")
 '(global-font-lock-mode t nil (font-lock))
 '(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
 '(transient-mark-mode t)
 '(visible-cursor t))

(set-default-font "-bitstream-bitstream vera sans mono-medium-r-normal-*-12-*-75-75-m-*-*-*")
;(set-default-font "-misc-dejavu sans mono-medium-r-normal-*-12-120-75-75-m-*-*-*")
;; Make text mode as default and turn on Auto Fill
(setq default-major-mode 'text-mode)
(setq text-mode-hook 'turn-on-auto-fill)
;; For ruby
(autoload 'ruby-mode "ruby-mode" "Mode for editing ruby source files")
(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode))
(autoload 'run-ruby "inf-ruby" "Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby" "Set local key defs for inf-ruby in ruby-mode")
(setq scroll-step 1)
(setq scroll-conservatively 1)
(global-set-key "\em" 'goto-line)
(global-set-key (read-kbd-macro "<delete>") 'delete-char)
;;(load "/usr/local/share/lush/etc/lush.el")
(add-to-list 'load-path "/nfs1/krishnan/.emacs.d/")
(autoload 'matlab-mode "/nfs1/krishnan/.emacs.d/matlab.el" "Matlab Editing Mode" t)
(add-to-list 'auto-mode-alist '("\\.m$" . matlab-mode))
(setq matlab-indent-function t)
(autoload 'matlab-shell "matlab" "Interactive MATLAB mode." t)
(setq matlab-shell-command-switches '("-nojvm"))

(global-set-key [(f9)] 'compile)
(setq compilation-window-height 8 )
(setq compilation-finish-function
(lambda (buf str)
(if (string-match "exited abnormally" str)
;;there were errors
(message "compilation errors, press C-x ` to visit")
;;no errors, make the compilation window go away in 0.5 seconds
(run-at-time 0.5 nil 'delete-windows-on buf)
(message "NO COMPILATION ERRORS!"))))

;(set-cursor-color "wheat")
(autoload 'python-mode "python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))

(add-hook 'python-mode-hook
(lambda ()
(set (make-variable-buffer-local 'beginning-of-defun-function)
'py-beginning-of-def-or-class)
(setq outline-regexp "def\\|class ")))

(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(default ((t (:stipple nil :background "black" :foreground "wheat" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 120 :width normal :family "bitstream-bitstream vera sans mono")))))
