I am trying to properly configure emacs to write my Clojure code. I based my Emacs configurations on this good blog post.
However, I did change a few settings like the theme he is using etc. I have been checking to get Auto-Complete (Eldoc? I am not sure) to display the docstring of the functions in Clojure, and from my own code.
I want to see the documentation like in that screenshot:
However, I cannot get the "yellow" documentation box to appear. I am not sure if this is due to a misconfiguration in my .emacs
file, or if it is a command I have to use or...
Here is my .emacs
file:
(add-to-list 'custom-theme-load-path "~/.emacs.d/lib/noctilux-theme")
(require 'package):
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/")
'("melpa" . "http://melpa.milkbox.net/packages/"))
;; Initialize all the ELPA packages (what is installed using the packages commands)
(package-initialize)
;; Set bigger fonts
(set-default-font "Courier New-13")
;; Setup to have a french keyboard layout working
(require 'iso-transl)
;; Show parenthesis mode
(show-paren-mode 1)
;; rainbow delimiters
(global-rainbow-delimiters-mode)
;; paredit
(add-hook 'clojure-mode-hook 'paredit-mode)
(add-hook 'nrepl-mode-hook 'paredit-mode)
(global-set-key [f7] 'paredit-mode)
;; theme
(load-theme 'noctilux t)
;; clojure-mode
(global-set-key [f9] 'cider-jack-in)
(add-hook 'clojure-mode-hook 'turn-on-eldoc-mode)
;; nrepl
(add-hook 'nrepl-interaction-mode-hook 'nrepl-turn-on-eldoc-mode)
(setq nrepl-popup-stacktraces nil)
(add-to-list 'same-window-buffer-names "*nrepl*")
(add-hook 'nrepl-mode-hook 'paredit-mode)
;; Auto complete
(require 'auto-complete-config)
;(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(setq ac-delay 0.0)
;(setq ac-use-quick-help t)
(setq ac-quick-help-delay 0.0)
;(setq ac-use-fuzzy 1)
;(setq ac-auto-start 1)
;(setq ac-auto-show-menu 1)
(ac-config-default)
;; ac-nrepl
(require 'ac-nrepl)
(add-hook 'nrepl-mode-hook 'ac-nrepl-setup)
(add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup)
(eval-after-load "auto-complete" '(add-to-list 'ac-modes 'nrepl-mode))
(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)
;; scroll one line at a time (less "jumpy" than defaults)
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(setq scroll-step 1) ;; keyboard scroll one line at a time
Here is what I see in my CLJ buffers:
In the NREPL, I do see a "v" instead of a "d" (by the way, what does these letters means?). As I said in my comment, in NREPL, I do see the yellow box appearing, then when the popup appears, then the doc yellow box disapear. In the CLJ code buffers, the yellow box never open.
After some more testing, everything is working as expected. When the popup first shows, the yellow box disapear. However, when I start selecting different choices, then it reappears, at the right place.
Also, it started working in the CLJ buffers, and I see the letter "v" instead of "d" as seen in the sreenshot above. Maybe I forgot to start the NREPL, would have to re-test.
In any case, everything is working as expected.
nrepl-mode-hook
, nrepl-interaction-mode-hook
, nrepl-mode
are obsoleted. You should use cider-mode-hook
, cider-repl-mode-hook
, cider-mode
instead of them respectively.
And you should set ac-quick-help-delay
to value more than 0
(for example 0.5
).
Patch is below.
--- nconf-orig.el 2014-05-21 16:51:40.056185465 +0900
+++ conf-new.el 2014-05-21 16:53:11.936182181 +0900
@@ -43,7 +43,7 @@
;(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(setq ac-delay 0.0)
;(setq ac-use-quick-help t)
-(setq ac-quick-help-delay 0.0)
+(setq ac-quick-help-delay 0.5)
;(setq ac-use-fuzzy 1)
;(setq ac-auto-start 1)
;(setq ac-auto-show-menu 1)
@@ -51,9 +51,10 @@
;; ac-nrepl
(require 'ac-nrepl)
-(add-hook 'nrepl-mode-hook 'ac-nrepl-setup)
-(add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup)
-(eval-after-load "auto-complete" '(add-to-list 'ac-modes 'nrepl-mode))
+(add-hook 'cider-mode-hook 'ac-nrepl-setup)
+(add-hook 'cider-repl-mode-hook 'ac-nrepl-setup)
+(add-to-list 'ac-modes 'cider-mode)
+(add-to-list 'ac-modes 'cider-repl-mode)
(defun set-auto-complete-as-completion-at-point-function ()