 ;; M-. elisp navigation.
 (use-package elisp-slime-nav
   :ensure elisp-slime-nav)
-(dolist (hook '(emacs-lisp-mode-hook ielm-mode-hook))
-  (add-hook hook 'turn-on-elisp-slime-nav-mode))
+
+(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."

        ("\\.m$" (".h"))
        ("\\.mm$" (".h"))
        ))
(add-hook 'c-mode-common-hook (lambda() (local-set-key (kbd "C-c o") 'ff-find-other-file)))
(use-package dummy-h-mode
  :ensure dummy-h-mode)
(add-to-list 'auto-mode-alist '("\\.h\\'" . dummy-h-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-function)

(defun ar/java-mode-hook-function ()
  "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-function)

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