 (add-hook 'mail-mode-hook 'turn-on-auto-fill)
 (add-hook 'mail-mode-hook (lambda () (setq fill-column 72)))
 
-;; shell stuff
-(setq sh-basic-offset tab-width)
+
+;; smart-compile
+(setup-lazy '(smart-compile) "smart-compile"
+  (setq smart-compile-alist
+        '( (emacs-lisp-mode  . (emacs-lisp-byte-compile))
+           (html-mode        . (browse-url-of-buffer))
+           (nxhtml-mode      . (browse-url-of-buffer))
+           (html-helper-mode . (browse-url-of-buffer))
+           (octave-mode      . (run-octave))
+           (c-mode           . "gcc -c99 -pedantic -Wall -W -Wextra -Wunreachable-code %f")
+           (java-mode        . "javac -Xlint:all -encoding UTF-8 %f")
+           (haskell-mode     . "ghc -Wall -fwarn-missing-import-lists %f") )))
+(global-set-key (kbd "C-c M-c") '("smart-compile" smart-compile compile))
 
 (provide 'setup-major-modes)


;; load ESS for R
;; (setq load-path (cons "/usr/share/emacs/site-lisp/ess" load-path))
(setup "ess-site"
  (setq inferior-julia-program-name "~/dev/julia/julia/usr/bin/julia-basic")
  (add-to-list 'auto-mode-alist '("\\.jl$" . julia-mode)))

;; auctex
(setup "latex"

  (add-to-list 'auto-mode-alist '("\\.m$" . matlab-mode)))

;; dired
(setup-lazy '(dired-jump) "dired"
  ;; move files between split panes
  (setq dired-dwim-target t))
(setup-after "dired" 
