 ;;              (local-set-key (kbd "RET") 'shm/newline-indent-proxy)))
 
 ;; Clojure mode
-(require 'clojure-mode)
-(add-hook 'clojure-mode-hook 'paredit-mode)
-(add-hook 'cider-mode-hook 'cider-turn-on-eldoc-mode)
-(add-hook 'nrepl-mode-hook 'paredit-mode)
-(require 'clojure-mode-extra-font-locking)
-(setq nrepl-log-messages t)
-(setq nrepl-hide-special-buffers t)
-(setq cider-show-error-buffer 'except-in-repl)
+(when (require 'clojure-mode nil t)
+  (add-hook 'clojure-mode-hook 'paredit-mode)
+  (add-hook 'cider-mode-hook 'cider-turn-on-eldoc-mode)
+  (add-hook 'nrepl-mode-hook 'paredit-mode))
+(when (require 'clojure-mode-extra-font-locking nil t)
+  (setq nrepl-log-messages t)
+  (setq nrepl-hide-special-buffers t)
+  (setq cider-show-error-buffer 'except-in-repl))
 
 ;; Ruby mode
-(push 'company-robe company-backends)
-(add-hook 'ruby-mode-hook 'robe-mode)
-(add-hook 'ruby-mode-hook 'eldoc-mode)
-(add-hook 'enh-ruby-mode-hook 'robe-mode)
-(add-hook 'enh-ruby-mode-hook 'eldoc-mode)
+(when (require 'robe nil t)
+  (push 'company-robe company-backends)
+  (add-hook 'ruby-mode-hook 'robe-mode)
+  (add-hook 'ruby-mode-hook 'eldoc-mode)
+  (add-hook 'enh-ruby-mode-hook 'robe-mode)
+  (add-hook 'enh-ruby-mode-hook 'eldoc-mode))
 
 ;; Octave
 (setq auto-mode-alist

       auto-mode-alist))

;; Powerline
(require 'powerline)
(powerline-center-evil-theme)

;; OCaml
;; Use the opam installed utop

          (t (self-insert-command (or arg 1))))))

;; Haskell mode
(when (require 'haskell-mode nil t)
  (autoload 'ghc-init "ghc" nil t)
  (autoload 'ghc-debug "ghc" nil t)
  (add-hook 'haskell-mode-hook (lambda () (ghc-init)))
  (add-hook 'haskell-mode-hook 'interactive-haskell-mode)
  (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
  (eval-after-load 'haskell-mode
    '(progn
       (define-key haskell-mode-map [f8] 'haskell-navigate-imports)
       (add-hook 'before-save-hook 'haskell-mode-stylish-buffer)))
  (custom-set-variables
   '(haskell-interactive-popup-errors nil)
   '(haskell-process-suggest-remove-import-lines t)
   '(haskell-process-auto-import-loaded-modules t)
   '(haskell-process-log t)
   '(haskell-process-type 'auto)
   '(haskell-tags-on-save t)
   '(haskell-font-lock-symbols t)))

(when (require 'hindent nil t)
  (add-hook 'haskell-mode-hook #'hindent-mode))

(when (require 'company-ghc nil t)
  (add-to-list 'company-backends 'company-ghc)
  (custom-set-variables '(company-ghc-show-info t)))

(require 'hs-lint nil t)

;; (require 'shm)
;; (add-hook 'haskell-mode-hook 'structured-haskell-mode)
