   (define-key tuareg-mode-map (kbd "M-p") 'tuareg-previous-phrase))
 
 ;; Load merlin-mode
-(require 'merlin)
-;; Start merlin on ocaml files
+(when (require 'merlin nil t)
+  ;; Start merlin on ocaml files
 (add-hook 'tuareg-mode-hook 'merlin-mode t)
-(add-hook 'caml-mode-hook 'merlin-mode t)
+(add-hook 'caml-mode-hook 'merlin-mode t))
 
 ;; Magit
-(global-set-key (kbd "C-x g") 'magit-status)
+(when (require 'magit nil t)
+  (global-set-key (kbd "C-x g") 'magit-status))
 
 ;; Helm
-(require 'helm)
-(require 'helm-config)
-(global-unset-key (kbd "C-x c"))
-(global-set-key (kbd "C-c h") 'helm-command-prefix)
-(global-set-key (kbd "C-x C-f") 'helm-find-files)
-(global-set-key (kbd "C-c h o") 'helm-occur)
-(define-key global-map [remap list-buffers] 'helm-buffers-list)
-(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebind tab to run persistent action
-(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB work in terminal
-(define-key helm-map (kbd "C-z")  'helm-select-action) ; list actions using C-z
-(global-set-key (kbd "M-x") 'helm-M-x)
-(unless (boundp 'completion-in-region-function)
-  (define-key lisp-interaction-mode-map [remap completion-at-point] 'helm-lisp-completion-at-point)
-  (define-key emacs-lisp-mode-map       [remap completion-at-point] 'helm-lisp-completion-at-point))
-(setq helm-M-x-fuzzy-match t)
-(helm-mode 1)
+(when (and (require 'helm nil t)
+           (require 'helm-config nil t))
+  (global-unset-key (kbd "C-x c"))
+  (global-set-key (kbd "C-c h") 'helm-command-prefix)
+  (global-set-key (kbd "C-x C-f") 'helm-find-files)
+  (global-set-key (kbd "C-c h o") 'helm-occur)
+  (define-key global-map [remap list-buffers] 'helm-buffers-list)
+  (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebind tab to run persistent action
+  (define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB work in terminal
+  (define-key helm-map (kbd "C-z")  'helm-select-action) ; list actions using C-z
+  (global-set-key (kbd "M-x") 'helm-M-x)
+  (unless (boundp 'completion-in-region-function)
+    (define-key lisp-interaction-mode-map [remap completion-at-point] 'helm-lisp-completion-at-point)
+    (define-key emacs-lisp-mode-map       [remap completion-at-point] 'helm-lisp-completion-at-point))
+  (setq helm-M-x-fuzzy-match t)
+  (helm-mode 1))
 
 ;; Helm Ag
-(setq helm-ag-insert-at-point (quote symbol))
+(when (require 'helm-ag nil t)
+  (setq helm-ag-insert-at-point (quote symbol)))
 
 ;; Projectile
-(projectile-global-mode)
-(setq projectile-completion-system 'helm)
-(setq projectile-use-git-grep t)
-(helm-projectile-on)
+(when (and (require 'projectile nil t)
+           (require 'helm-projectile nil t))
+  (projectile-global-mode)
+  (setq projectile-completion-system 'helm)
+  (setq projectile-use-git-grep t)
+  (helm-projectile-on))
 
 ;; GNU Global interface
-(add-hook 'c-mode-hook 'helm-gtags-mode)
-(add-hook 'c++-mode-hook 'helm-gtags-mode)
-(add-hook 'java-mode-hook 'helm-gtags-mode)
-(add-hook 'js-mode-hook 'helm-gtags-mode)
-(add-hook 'python-mode-hook 'helm-gtags-mode)
-(add-hook 'tuareg-mode-hook 'helm-gtags-mode)
-(custom-set-variables
- '(helm-gtags-prefix-key "\C-cg")
- '(helm-gtags-suggested-key-mapping t)
- '(helm-gtags-auto-update t)
- '(helm-gtags-use-input-at-cursor t)
- '(helm-gtags-pulse-at-cursor t))
-(with-eval-after-load 'helm-gtags
-  (define-key helm-gtags-mode-map (kbd "M-.") 'helm-gtags-dwim)
-  (define-key helm-gtags-mode-map (kbd "M-,") 'helm-gtags-pop-stack)
-  (define-key helm-gtags-mode-map (kbd "C-c g a") 'helm-gtags-tags-in-this-function)
-  (define-key helm-gtags-mode-map (kbd "C-c g c") 'helm-gtags-create-tags)
-  (define-key helm-gtags-mode-map (kbd "C-c g <") 'helm-gtags-previous-history)
-  (define-key helm-gtags-mode-map (kbd "C-c g >") 'helm-gtags-next-history))
+(when (require 'helm-gtags nil t)
+  (add-hook 'c-mode-hook 'helm-gtags-mode)
+  (add-hook 'c++-mode-hook 'helm-gtags-mode)
+  (add-hook 'java-mode-hook 'helm-gtags-mode)
+  (add-hook 'js-mode-hook 'helm-gtags-mode)
+  (add-hook 'python-mode-hook 'helm-gtags-mode)
+  (add-hook 'tuareg-mode-hook 'helm-gtags-mode)
+  (custom-set-variables
+   '(helm-gtags-prefix-key "\C-cg")
+   '(helm-gtags-suggested-key-mapping t)
+   '(helm-gtags-auto-update t)
+   '(helm-gtags-use-input-at-cursor t)
+   '(helm-gtags-pulse-at-cursor t))
+  (with-eval-after-load 'helm-gtags
+    (define-key helm-gtags-mode-map (kbd "M-.") 'helm-gtags-dwim)
+    (define-key helm-gtags-mode-map (kbd "M-,") 'helm-gtags-pop-stack)
+    (define-key helm-gtags-mode-map (kbd "C-c g a") 'helm-gtags-tags-in-this-function)
+    (define-key helm-gtags-mode-map (kbd "C-c g c") 'helm-gtags-create-tags)
+    (define-key helm-gtags-mode-map (kbd "C-c g <") 'helm-gtags-previous-history)
+    (define-key helm-gtags-mode-map (kbd "C-c g >") 'helm-gtags-next-history)))
 
 ;; Semantic
 (add-hook 'c-mode-hook 'semantic-mode)

(add-hook 'java-mode-hook 'semantic-mode)

;; Elm
(custom-set-variables '(elm-indent-offset 2))
(add-to-list 'company-backends 'company-elm)

       auto-mode-alist))

;; Powerline
(when (require 'powerline nil t)
  (powerline-center-evil-theme))

;; OCaml
;; Use the opam installed utop
