   :disabled
 
   :config
-  (progn
-    ;; the ac plugin will be activated in each buffer using irony-mode
-    (irony-enable 'ac)             ; hit C-RET to trigger completion
-
-    ;; avoid enabling irony-mode in other modes that inherit from c-mode,
-    ;; e.g: php-mode
-    (defun irony-mode-if-safe ()
-      (interactive)
-      (when (member major-mode irony-known-modes)
-	(irony-mode 1)))
-    (add-hook 'c++-mode-hook 'irony-mode-if-safe)
-    (add-hook 'c-mode-hook 'irony-mode-if-safe)
-
-    ;; Kill C-c keys
-    (define-key irony-mode-map (kbd "C-c") nil)
-
-    ))
+  ;; the ac plugin will be activated in each buffer using irony-mode
+  (irony-enable 'ac)             ; hit C-RET to trigger completion
+
+  ;; avoid enabling irony-mode in other modes that inherit from c-mode,
+  ;; e.g: php-mode
+  (defun irony-mode-if-safe ()
+    (interactive)
+    (when (member major-mode irony-known-modes)
+      (irony-mode 1)))
+  (add-hook 'c++-mode-hook 'irony-mode-if-safe)
+  (add-hook 'c-mode-hook 'irony-mode-if-safe)
+
+  ;; Kill C-c keys
+  (define-key irony-mode-map (kbd "C-c") nil)
+
+  )
 
 
 (defun external-shell-in-dir ()

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

(use-package ess
  :config (progn
            (define-key ess-mode-map (kbd "C-c") nil)
	    (define-key ess-mode-map (kbd "C-x") nil)

            ;; ess-mode tries to do some stupid stuff with '_' and ',',
            ;; disable this.
            (define-key ess-mode-map (kbd "_") nil)
            (define-key ess-mode-map (kbd ",") nil)

	    (add-hook 'ess-roxy-mode-hook
		      (lambda () (define-key ess-roxy-mode-map (kbd "C-c") nil)))

            (add-hook 'ess-mode-hook
                      (lambda() (ess-set-style 'C++ 'quiet)
                        (set 'ess-arg-function-offset t)))

            ;; auto newline after '{'
            (add-hook 'ess-mode-hook
                      (lambda()
                        (add-to-list 'electric-layout-rules '( ?\{ .  after))
                        (add-to-list 'electric-layout-rules '( ?\} .  before))
                        ))

            ;; Use rtags to make the tags file
            (add-hook 'ess-mode-hook
                      (lambda()
                        (make-local-variable 'projectile-tags-command)
                        (set 'projectile-tags-command
                             "R -e 'rtags(recursive=TRUE,ofile=\"%s\")'")))
            )
  :ensure t)


(use-package discover

(add-to-list 'load-path "~/.emacs.d/aggressive-fill-paragraph-mode")
(load-library "aggressive-fill-paragraph")
(use-package aggressive-fill-paragraph
  :config
  ;; Enable in modes where it works nicely
  (mapcar (lambda (hook) (add-hook hook #'aggressive-fill-paragraph-mode))
          (list 'c-mode-hook
                'c++-mode-hook
                'emacs-lisp-mode-hook
                'java-mode-hook
                'sh-mode-hook
                'python-mode-hook
                'org-mode-hook
                'ess-mode-hook))
  )


;; For some stupid reason ess doesn't define this autoload, or this
