            (function (nth 1 element)))
       (global-set-key (read-kbd-macro keyboard-string) function))))
 
-;; ----------
-;; -- Loading Modules
-;; ----------
-(defun autoload-mode (name regex &optional file)
-  "Automatically loads a language mode
-when opening a file of the appropriate type.
-
-`name' is the name of the mode.
-E.g. for javascript-mode, `name' would be \"javascript\".
-
-`regex' is the regular expression matching filenames of the appropriate type.
-
-`file' is the name of the file
-from which the mode function should be loaded.
-By default, it's `name'-mode.el."
-  (let* ((name-mode (concat name "-mode"))
-         (name-sym (intern name-mode)))
-    (autoload name-sym (or file name-mode)
-      (format "Major mode for editing %s." name) t)
-    (add-to-list 'auto-mode-alist (cons regex name-sym))))
-
-(autoload-mode "tex" "\\.tex$" "auctex")
-(autoload-mode "d" "\\.d[i]?\\'$")
-(autoload-mode "textile" "\\.textile$")
-(autoload-mode "haml" "\\.haml$")
-(autoload-mode "sass" "\\.sass$")
-(autoload-mode "rhtml" "\\.\\(rhtml\\|erb\\)$")
-(autoload-mode "yaml" "\\.ya?ml$")
-(autoload-mode "ruby" "\\(\\.\\(rb\\|rake\\|rjs\\|gemspec\\|thor\\|rhtml\\)\\|Rakefile\\|Capfile\\|Thorfile\\|Gemfile\\|Guardfile\\)$")
-(autoload-mode "css" "\\.css$")
-(autoload-mode "arc" "\\.arc$" "arc")
-(autoload-mode "erlang" "\\.\\([he]rl\\|yaws\\)$" "erlang/erlang")
-(autoload-mode "treetop" "\\.treetop$")
-(autoload-mode "factor" "\\.factor$")
-(autoload-mode "actionscript" "\\.as$")
-(autoload-mode "xml" "\\.\\(swfml\\|xml\\)$")
-(autoload-mode "org" "\\.org$")
-(autoload-mode "haxe" "\\.hx$")
-
 (eval-after-load "ruby-mode"
   '(progn
      (define-key ruby-mode-map (kbd "C-M-l") 'ruby-forward-sexp)

              yasnippet
              diminish
              auto-complete
              clojure-mode
              clojure-test-mode
              cider
              markdown-mode
              haskell-mode

(add-hook 'emacs-lisp-mode-hook (lambda ()
                                  (paredit-mode +1)
                                  (rainbow-delimiters-mode +1)))

;;(autoload 'ghc-init "ghc" nil t)
;;(autoload 'ghc-debug "ghc" nil t)
