clojure-emacs-autocomplete

1. https://github.com/clojure-emacs/cider#keyboard-shortcuts

2. install emacs 24.5

3. http://clojure-doc.org/articles/tutorials/emacs.html

4. http://stackoverflow.com/questions/23233470/how-to-use-ciders-built-in-autocompletion-in-clojure/28249313#28249313

5. edit .lein project.clj

  

{:user
{
:java-cmd "C:\\Program Files\\Java\\jdk1.8.0\\bin\\java.exe"
:plugins [
[cider/cider-nrepl "0.9.0-SNAPSHOT"]
]
:dependencies [[org.clojure/tools.nrepl "0.2.7"]]
}
}

 

6. edit project's project.clj

    :profiles {:dev {:plugins [[cider/cider-nrepl "0.9.0"]]}}

 

7. the .emacs

 

 

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

(require 'cl)
(require 'package) 
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) 

(let ((default-directory "~/.emacs.d/elpa/"))  
(normal-top-level-add-to-load-path '("."))  
(normal-top-level-add-subdirs-to-load-path))  
  
(require 'color-theme)  
(color-theme-initialize)  
(color-theme-bharadwaj-slate)


(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/elpa/auto-complete-20150615.34/dict")

(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))


(package-initialize)

  

posted @ 2015-06-19 23:22  rezy  阅读(397)  评论(0编辑  收藏  举报