   (whitespace-mode)
   (rainbow-delimiters-mode)
   (yas-minor-mode))
-(add-hook 'prog-mode-hook 'ar/prog-mode-hook)
-(add-hook 'markdown-mode-hook 'ar/prog-mode-hook)
+(add-hook 'prog-mode-hook 'ar/prog-mode-hook-function)
+(add-hook 'markdown-mode-hook 'ar/prog-mode-hook-function)
+
+(ar/add-functions-to-mode-hooks '(prog-mode-hook markdown-mode-hook)
+                                '(ar/prog-mode-hook-function))
 
 (use-package centered-cursor-mode
   :ensure centered-cursor-mode)

  (define-key objc-mode-map [f6] 'recompile)
  (define-key objc-mode-map [f7] 'ar/xc:build)
  (define-key objc-mode-map [f8] 'ar/xc:run))
(add-hook 'objc-mode-hook 'ar/objc-mode-hook)

(defun ar/java-mode-hook ()
  "Called when entering java-mode"
  ;; 100-column limit for java.
  (set-fill-column 100)
  ;; 2-char indent for java.
  (setq c-basic-offset 2))
(add-hook 'java-mode-hook 'ar/java-mode-hook)

(defun ar/prog-mode-hook ()
  "Called when entering all programming modes."
  (add-hook 'after-change-functions
            'ar/after-prog-mode-text-change

;; M-. elisp navigation.
(use-package elisp-slime-nav
  :ensure elisp-slime-nav)

(defun ar/add-functions-to-mode-hooks (hook-functions hooks)
  "Adds HOOK-FUNCTIONS to mode HOOKS."
  (dolist (hook hooks)
    (dolist (hook-function hook-functions)
      (add-hook hook hook-function))))

(ar/add-functions-to-mode-hooks '(turn-on-elisp-slime-nav-mode)
                                '(emacs-lisp-mode-hook ielm-mode-hook))

(defun ar/save-point ()
  "Saves point to register 9999."
