about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <vincent@Vincents-MacBook-Pro.local>2013-08-18T22·53+0200
committerVincent Ambo <vincent@Vincents-MacBook-Pro.local>2013-08-18T22·53+0200
commitb007f3d0ff15c8e0c7b1fbf752386791ee69b7ae (patch)
tree6390e697b29b7fda8fb60e434b5d1969f8690061
parentb23609fb69c558f3e6092c5938852a71987f0e3e (diff)
Setup ac-nrepl
-rw-r--r--init-modes.el25
1 files changed, 22 insertions, 3 deletions
diff --git a/init-modes.el b/init-modes.el
index fc4923c200e4..84b985ba2c5e 100644
--- a/init-modes.el
+++ b/init-modes.el
@@ -1,4 +1,4 @@
-(mapc 'require '(projectile hi2))
+(mapc 'require '(projectile hi2 ac-nrepl))
 ;; Initializes modes I use.
 
 (add-hook 'prog-mode-hook 'esk-pretty-lambdas)
@@ -16,14 +16,33 @@
 (define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left)
 (define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right)
 
+;; Use auto-complete as completion at point
+(defun set-auto-complete-as-completion-at-point-function ()
+  (setq completion-at-point-functions '(auto-complete)))
+(add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)
+
+
 ;; Configure nrepl (Clojure REPL) and clojure-mode
-;; Paredit in clojure
 
+;; Use ac-nrepl for completion
+(add-hook 'nrepl-mode-hook 'ac-nrep-setup)
+(add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup)
+(eval-after-load "auto-complete"
+   '(add-to-list 'ac-modes 'nrepl-mode))
+
+(add-hook 'nrepl-mode-hook 'set-auto-complete-as-completion-at-point-function)
+(add-hook 'nrepl-interaction-mode-hook 'set-auto-complete-as-completion-at-point-function)
+(define-key nrepl-interaction-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc)
+
+;; Paredit in clojure
 (add-hook 'clojure-mode-hook 'paredit-mode)
 
 ;; eldoc in clojure
 (add-hook 'nrepl-interaction-mode-hook
-  'nrepl-turn-on-eldoc-mode)
+          'nrepl-turn-on-eldoc-mode)
+
+(add-hook 'nrepl-interaction-mode-hook
+          'paredit-mode)
 
 ;; Don't annoy me
 (setq nrepl-hide-special-buffers t)