+;; ❄ emacs setup ❄
+
 (defun mjhoy/load-init-file (path &optional noerror)
   "Load a file from the ~/.emacs.d directory."
   (let ((file (file-name-sans-extension
 	       (expand-file-name path user-emacs-directory))))
     (load file noerror)))
 
-;; required for inf-ruby??
-(require 'thingatpt)
+;; load packages, functions
+(mjhoy/load-init-file "mjhoy/packages.el")
+(mjhoy/load-init-file "mjhoy/commands.el")
 
-;; backups under ~/.emacs.d
+(setq user-mail-address "michael.john.hoy@gmail.com")
+
+;; keep backups under ~/.emacs.d
 (setq backup-directory-alist
       (list (cons "." (expand-file-name "backups" user-emacs-directory))))
+
+
+;; interface
+;; =========
 
 ;; no menu bar
 (menu-bar-mode 0)

;; no splash screen
(setq inhibit-splash-screen t)

(mjhoy/load-init-file "mjhoy/packages.el")
(mjhoy/load-init-file "mjhoy/commands.el")

;; theme
;;(load-theme 'zenburn t)
;;(require 'color-theme-sanityinc-tomorrow)
(load-theme 'sanityinc-tomorrow-bright t)

;; line number format: add a space
(setq linum-format "%d ")

;; begone, crazy command
(global-unset-key (kbd "C-x C-u"))

(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode 1)

;; Ruby file extensions/naming
(add-to-list 'auto-mode-alist '("Rakefile\\'"   . ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile\\'"    . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-mode))

;; hippy expand!
(setq hippie-expand-try-functions-list
      '(try-expand-all-abbrevs
        try-expand-dabbrev

        try-complete-file-name
        try-complete-lisp-symbol-partially
        try-complete-lisp-symbol))


;; org mode
;; ========

(setq org-agenda-files (list "~/org/class.org"
			     "~/org/work.org"
			     "~/org/daily.org"))

;; global bindings
;; ===============

;; begone, crazy command
(global-unset-key (kbd "C-x C-u"))

;; hippy expand
(global-set-key "\M- " 'hippie-expand)

;; org agenda
(global-set-key (kbd "C-c a") 'org-agenda)

;; copy region without deleting
(global-set-key (kbd "C-c C-w") 'copy-region-as-kill)


;; haskell
;; =======

(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
(defun mjhoy/define-haskell-keys ()
  (define-key haskell-mode-map (kbd "C-c C-c") 'haskell-compile))
