cider-doc: There is no ElDoc support in this buffer

Created on 27 May 2015  ·  12Comments  ·  Source: clojure-emacs/cider

Whenever I do C-c C-d C-d in a clojure buffer where cider is jacked in, I get the message There is no ElDoc support in this buffer. A second later, I can see the prompt which is correct, i.e., Doc for: <symbol-at-point>. When I hit return, the docs are successfully shown.

Also, eldoc is enabled in the buffer and I do get eldoc signature messages when point is on some function.

My clojure-mode/cider versions are:

  cider              20150519.451  installed             Clojure Interactive Development Environment that Rocks
  clojure-mode       20150517.6    installed             Major mode for Clojure code

In a new repl, I get the following initial message:

; CIDER 0.9.0snapshot (package: 20150519.451) (Java 1.8.0_45, Clojure 1.7.0-RC1, nREPL 0.2.10)

I use a current Emacs 25 from git.

I only have very few cider configs which should be harmless:

(require 'cider)
(setq nrepl-hide-special-buffers t)
(setq cider-macroexpansion-print-metadata t)

(define-key cider-mode-map (kbd "<f11>") 'cider-switch-to-repl-buffer)
(define-key cider-repl-mode-map (kbd "<f11>") 'delete-window)

(defun th/cider-repl-mode-init ()
  (paredit-mode)
  (eldoc-mode))

(add-hook 'cider-repl-mode-hook 'th/cider-repl-mode-init)

(defun th/cider-mode-init ()
  (eldoc-mode))

(add-hook 'cider-mode-hook 'th/cider-mode-init)

The problem is there for a while (say, some months) so it's not that it has been introduced with some recent commit or ELPA version upgrade.

All 12 comments

Is eldoc-mode really active in those buffers? Can't think of a reason why something like this would be happening, unless eldoc-mode is inactive.

Yes, it is. But now I found the culprit.

cider-read-from-minibuffer runs the hooks in eval-expression-minibuffer-setup-hook. Apparently, that hook contains eldoc-mode, and since no eldoc-documentation-function is defined in the minibuffer, the message is displayed by eldoc-mode which won't be activated in this case.

Having eldoc-mode active in the minibuffer is a pretty new and cool Emacs feature. In this case, the docs are shown in the mode-line.

So the right fix is to set the eldoc documentation function before running the hook functions.

diff -u --label /home/horn/.emacs.d/elpa/cider-20150519.451/cider-interaction.el --label \#\<buffer\ cider-interaction.el\> /home/horn/.emacs.d/elpa/cider-20150519.451/cider-interaction.el /tmp/buffer-content-12979CxT
--- /home/horn/.emacs.d/elpa/cider-20150519.451/cider-interaction.el
+++ #<buffer cider-interaction.el>
@@ -519,6 +519,7 @@
         (set-syntax-table clojure-mode-syntax-table)
         (add-hook 'completion-at-point-functions
                   #'cider-complete-at-point nil t)
+   (setq-local eldoc-documentation-function #'cider-eldoc)
         (run-hooks 'eval-expression-minibuffer-setup-hook))
     (read-from-minibuffer prompt initial-value
                           cider-minibuffer-map nil

Feel free to fire a PR regarding this. I glimpsed over this functionality in the changelog, but I have yet to see it in action.

I have this problem with:

CIDER 0.16.0snapshot (package: 20171001.112)
Aquamacs 3.3 GNU Emacs 25.1.1 (x86_64-apple-darwin14.1.0, NS appkit-1344.72 Version 10.10.2 (Build 14C109)) of 2016-09-19 on 24a02dbf6b34ae061ef4df89f15bfbc5d3ed497e

What's the fix?

Hmm, the problem goes away once I use M-x cider-jack-in to start up a REPL -- the REPL gets ElDoc mode, and an existing .clj buffer for the project gets it, as does a newly opened .clj.

@jcburley if i understand you correctly, you're not seeing el-doc when not jacked in, and you are seeing el-doc when you jack in. This is expected. The information that eldoc uses comes from the middleware in cider-nrepl and not from a textual search of the code. Without being jacked in there can be no eldoc information (in the current implementation). If this is not what you mean then my apologies.

@dpsutton I think you have it right, though I'm still new to most of this tech (except Emacs itself, which I've used for several decades).

I think maybe my use of clojure-mode is the culprit here -- it can't support eldoc-mode without the REPL, but I think I'm telling it to do that via a hook (in my init.el).

Will look into fixing that. Thanks!

:+1: Feel free to come chat on the clojure slack in #cider if you have any questions

Yeah, deleting that line fixes the problem: no complaint when finding-file a .clj without the REPL up, and if I then cider-jack-in, both the REPL _and_ the already-open .clj file get ElDoc mode!

Will do re the Slack chat, thanks again!

Hmm, I installed Slack, but don't have a clojure.org login to use on the clojure.slack.com workspace. (I've had access to a client's workspace for several months, but I guess that isn't a generic Slack login?)

@jcburley try this: http://clojurians.net/

Ha, yes, I'd just found it about 30 seconds earlier, thanks! Dunno why I didn't JFGI in the 1st place....

Was this page helpful?
0 / 5 - 0 ratings