(require 'auto-complete-config)
(require 'clojure-mode)
(require 'cider-mode)
(require 'ac-cider)
(ac-config-default)
;(add-hook 'cider-repl-mode-hook 'ac-cider-setup)
(add-hook 'cider-mode-hook 'ac-cider-setup)
(eval-after-load "auto-complete"
'(add-to-list 'ac-modes 'cider-repl-mode))
(add-hook 'clojure-mode-hook 'paredit-mode)
;(add-hook 'clojurescript-mode-hook 'paredit-mode)
(add-hook 'clojure-mode-hook 'rainbow-delimiters-mode)
(setq cider-repl-pop-to-buffer-on-connect nil)
(require 'highlight-parentheses)
(add-hook 'clojure-mode-hook
(lambda ()
(highlight-parentheses-mode t)))
(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)
;(add-hook 'cider-repl-mode-hook 'set-auto-complete-as-completion-at-point-function)
(add-hook 'cider-mode-hook 'set-auto-complete-as-completion-at-point-function)
(eval-after-load "cider"
'(define-key cider-mode-map (kbd "C-c C-d") 'ac-cider-popup-doc))
My packages are:
ac-cider
auto-complete
auto-indent
cider
clojure-mode
highlight-parentheses
parendit
popup
rainbow-delimiters
I do not want to use auto-completion for repl and script so I commented them.
You may not need them all but they are all useful. If you do not want to change the init.el file, you would better go with all packages listed.
Once you're done, make a project with Lein, then add
:plugins [[cider/cider-nrepl "0.8.2"]]
to project.clj file.
Now, it is almost done.
Open a sourcefile with Emacs, then run
M-x cider-jack-in
Then you must be able to use auto-completion feature for code!