A Working nrepl-ritz Setup?

1,014 views
Skip to first unread message

Timothy Washington

unread,
Dec 5, 2012, 12:49:49 AM12/5/12
to clo...@googlegroups.com
Hey all, 


I like the promise of nrepl-ritz. But I can't get a working setup. 


1) I start from an empty "~/.emacs.d/
2) I then populate init.el from the example in ritz/nrepl 
3) I open a lein project and run `M-x nrepl-ritz-jack-in`

**) The error I get back is: 
"error in process sentinel: Could not start nREPL server: 'ritz-nrepl' is not a task. See 'lein help'."

**) So emacs can't find the ritz-nrepl task. But i) my system definitely has "~/.emacs.d/elpa/nrepl-ritz-0.6.0/nrepl-ritz-pkg.el". And ii) I'm on the latest version of leinigen (2.0.0-preview10). 


Anyone have this working? 

Thanks 
Tim 

Timothy Washington

unread,
Dec 5, 2012, 10:33:44 AM12/5/12
to clo...@googlegroups.com
Yes, I updated "~/.emacs.d/init.el" and "~/.lein/profiles", as outlined on that page. But somehow nrepl server thinks 'ritz-nrepl' is not a task


Tim 



On Wed, Dec 5, 2012 at 7:59 AM, terjesb <ter...@gmail.com> wrote:
Did you update your ~/.lein/profiles?

Hugo Duncan

unread,
Dec 5, 2012, 12:24:20 PM12/5/12
to clo...@googlegroups.com
Timothy Washington <twas...@gmail.com> writes:

>
> 1) I start from an empty "*~/.emacs.d/*"
> 2) I then populate init.el from the example in
> ritz/nrepl<https://github.com/pallet/ritz/tree/develop/nrepl>
>
> 3) I open a lein project and run `*M-x nrepl-ritz-jack-in*`
>
> **) The error I get back is:
>
> "*error in process sentinel: Could not start nREPL server: 'ritz-nrepl' is
> not a task. See 'lein help'.*"

This is actually a lein message, and it is saying that the lein-ritz
plugin is not in the :plugins vector of a lein profile. There is an
example of setting this up in ~/.lein/profiles.clj on the page you
linked.

HTH,

Hugo

Hugo Duncan

unread,
Dec 5, 2012, 12:27:46 PM12/5/12
to clo...@googlegroups.com
Timothy Washington <twas...@gmail.com> writes:

> Yes, I updated "*~/.emacs.d/init.el*" and "*~/.lein/profiles*", as outlined
> on that page. But somehow nrepl server thinks *'ritz-nrepl' is not a task*.

Does running `lein ritz-nrepl` from a shell within your project
directory work?

Hugo

Timothy Washington

unread,
Dec 5, 2012, 10:09:46 PM12/5/12
to clo...@googlegroups.com
Ahh yes, `lein ritz-nrepl` wasn't working. I got it working by changing the file name to profiles.clj . So Hugo, in the ritz/nrepl page, you'll want to change the instruction text from A) to B)

A) Add this to your ~/.lein/profiles file (requires lein version 2):
B) Add this to your ~/.lein/profiles.clj file (requires lein version 2):

So with that, I get a little further. And running `M-x nrepl-ritz-jack-in` gets me an nrepl shell and server. But the result of the jack-in is an error (see below). I'm not sure if that has to do with ritz, but I'll play around with it: 

java.io.FileNotFoundException: Could not locate complete/core__init.class or complete/core.clj on classpath:                                                                                                                                                                                                                                                                                                                      
 at clojure.lang.RT.load (RT.java:432)                                                                                                                                                                                                                                                                                                                                                                                            
    clojure.lang.RT.load (RT.java:400)                                                                                                                                                                                                                                                                                                                                                                                            
    clojure.core$load$fn__4890.invoke (core.clj:5415)                                                                                                                                                                                                                                                                                                                                                                             
    clojure.core$load.doInvoke (core.clj:5414)                                                                                                                                                                                                                                                                                                                                                                                    
    clojure.lang.RestFn.invoke (RestFn.java:408) 


Thanks very much 
Tim 

Charles Comstock

unread,
Dec 8, 2012, 6:37:26 PM12/8/12
to clo...@googlegroups.com
I actually just encountered this error, and then intended to post how I fixed it as a reported issue and then forgot. So this is my current lein profile.clj

{:user {:plugins [[lein-vanity "0.1.0"]
                  [jonase/eastwood "0.0.2"]
                  [lein-ritz "0.6.0"]]
        :dependencies [[ritz/ritz-nrepl-middleware "0.6.0"]
                       [ritz/ritz-debugger "0.6.0"]
                       [ritz/ritz-repl-utils "0.6.0"]
                       [clojure-complete "0.2.2"]]
        :repl-options {:nrepl-middleware
                       [ritz.nrepl.middleware.javadoc/wrap-javadoc
                        ritz.nrepl.middleware.simple-complete/wrap-simple-complete]}}
 :hooks [ritz.add-sources]}

Note that unlike the docs listed at ritz/nrepl, I also needed to add an explicit dependency for clojure-complete 0.2.2. I also needed to use the MELPA version of nrepl, nrepl-ritz. I still encounter some sort of issue where it appears that the documentation querying functions, find-doc, and doc and the like are not being properly brought into the repl namespace, which breaks ctrl-d d until I manually bring that into the namespace. I'm not quite certain what was causing that problem and have yet to find a permanent fix.

The inclusion of clojure-complete should definitely fix the error you are getting, but I definitely found setting up the whole ritz setup to be error prone.

Charlie

Hugo Duncan

unread,
Dec 8, 2012, 7:09:58 PM12/8/12
to clo...@googlegroups.com
Charles Comstock <dgt...@gmail.com> writes:

> Note that unlike the docs listed at ritz/nrepl, I also needed to add an
> explicit dependency for clojure-complete 0.2.2. I also needed to use the
> MELPA version of nrepl, nrepl-ritz. I still encounter some sort of issue
> where it appears that the documentation querying functions, find-doc, and
> doc and the like are not being properly brought into the repl namespace,
> which breaks ctrl-d d until I manually bring that into the namespace. I'm
> not quite certain what was causing that problem and have yet to find
> a permanent fix.

Both these issues are probably caused by nrepl-ritz.el not being
loaded. Does a manual M-: (require 'nrepl-ritz) fix these?

Hugo

Timothy Washington

unread,
Dec 8, 2012, 7:20:54 PM12/8/12
to clo...@googlegroups.com
Oh nice. An explicit inclusion of "[clojure-complete "0.2.2"]" gets rid of the complete core stacktrace. 

I believe that "complete/core__init.class" bug ( ultimately just means that auto-completion and other facilities aren't available ) comes from how "nrepl-ritz-jack-in" sets up a lein repl (see: this issue). 

So it sounds like "nrepl-ritz-jack-in" ( or rather, the reply from "lein repl" ) "should check to see if the necessary namespaces are available immediately upon connecting; if not, load them and proceed.


Tim 


Tim Washington 


Today a young man on acid realized that all matter is merely energy condensed to a slow vibration, that we are all one consciousness experiencing itself subjectively, there is no such thing as death, life is only a dream, and we are the imagination of ourselves. Here's Tom with the Weather.” ― Bill Hicks

Timothy Washington

unread,
Dec 8, 2012, 7:28:05 PM12/8/12
to clo...@googlegroups.com
Both these issues are probably caused by nrepl-ritz.el not being
> loaded. Does a manual M-: (require 'nrepl-ritz) fix these?


Not for me. If I don't explicitly include "[clojure-complete "0.2.2"]"... 

... then doing `M-: (require 'nrepl-ritz)` before an `M-x nrepl-ritz-jack-in`, still gives me the complete/core stacktrace. 


Tim

Chas Emerick

unread,
Dec 10, 2012, 4:59:27 AM12/10/12
to clo...@googlegroups.com

On Dec 8, 2012, at 6:37 PM, Charles Comstock wrote:

I still encounter some sort of issue where it appears that the documentation querying functions, find-doc, and doc and the like are not being properly brought into the repl namespace, which breaks ctrl-d d until I manually bring that into the namespace. I'm not quite certain what was causing that problem and have yet to find a permanent fix.

Are you using a recent Clojure 1.5.0 beta build?  A change went in recently to fix some behaviour where nREPL would inadvertently refer all of the REPL utilities (doc, find-doc, pp, etc.) into *every* namespace.  When used with Clojure 1.5.0, nREPL now only refers those vars into the user ns, matching the default Clojure REPL defaults.

(I actually got used to the old behaviour myself, but it can cause serious problems, e.g.: http://code.google.com/p/counterclockwise/issues/detail?id=443)

This all said, it's definitely the case that some piece of the toolchain (probably clients like reply and nrepl.el, based on project.clj / profile config) should instigate global namespace refers so that these vars, or some subset, in addition to whatever vars you use most often in your workflow/project/application are always available.  Meditation on this topic continues. :-)

Cheers,

- Chas

Charles Comstock

unread,
Dec 10, 2012, 7:38:09 PM12/10/12
to clo...@googlegroups.com
No, that wasn't the problem, early on when I tried to use nrepl and ritz I experimented with clojure 1.5, but as far as I know all of these issues I encountered after switching back to 1.4. In response to someone elses question, I also was definitely using fresh copies of nrepl, presuming all the autoloads execute require in the correct order after executing nrepl-ritz-jack-in, as I would encounter the problem with missing the complete library even after a fresh emacs reboot. 

I'm happy to help diagnose this issue locally so as to get a permanent fix for all of us who may have been afflicted with these errors. I discovered the need to load in clojure-complete after diagnosing that was what was supposed to provide that namespace, but wasn't quite sure how it was intended to be added to the dependency list in the first place. Wasn't sure if nrepl-ritz was overriding that, or if it was a problem with core nrepl.

Charlie

Charles Comstock

unread,
Dec 10, 2012, 10:37:35 PM12/10/12
to clo...@googlegroups.com
Perhaps this discussion should move to the nrepl-el mailing list or the like, but I just discovered a bit more trying to figure this out. I noted that the .lein/profiles.clj documentation had been updated in the ritz/nrepl documentation. Namely that :hooks is scoped to the :user block and not at the same level as :user. Unfortunately, now when I run lein deps I get the following error message:

Error: cannot resolve ritz.add-sources/activate hook

This is from a revised .lein/profiles.clj of:

{:user {:plugins [[lein-ritz "0.6.0"]]
        :dependencies [[ritz/ritz-nrepl-middleware "0.6.0"]
                       [clojure-complete "0.2.2"]]
        :repl-options {:nrepl-middleware
                       [ritz.nrepl.middleware.javadoc/wrap-javadoc
                        ritz.nrepl.middleware.simple-complete/wrap-simple-complete]}
        :hooks [ritz.add-sources]}}

Am I running into some sort of issue by not using the snapshot version of lein-ritz? I am using leiningen 2.0.0-preview10, with clojure 1.4, and the rest of the dependencies are furnished by the  lein profile.clj. I did verify that without manually adding clojure-complete, I still get the error about missing complete's init. Note that the hooks error does not prevent nrepl-ritz-jack-in from bringing up an nrepl buffer. The same is true for missing clojure-complete, but the completion mechanism throws an exception every time I hit tab.

I also updated the corresponding portion of my init.el to require 'nrepl-ritz on using an nrepl, but I presume that is happening anyway due to nrepl-ritz-jack-in triggering the nrepl-ritz autoload.

Let me know if any other information would help in diagnosing what's different about my environment?

Thanks,
  Charlie

bruce li

unread,
Feb 23, 2013, 11:47:23 AM2/23/13
to clo...@googlegroups.com
Hello,

I managed to get nrepl-ritz going, but I'm experiencing the following annoying things:

1. When I switched on M-x nrepl-ritz-break-on-exception, I'm unable to disable it. When I called the command with a prefix(by default M--), it is still in action.  Is there a way to disable it? Otherwise, I'll need to spend another 20-30s to re-initialize the repl and reload the work I'm doing

2. This is not a serious problem but somehow a little annoying: I cannot enable ac-nrepl with ritz on. Otherwise, it will hang forever (unless I kill emacs). Is there a possible way to integrate it with ac-nrepl? Or is there any better alternatives? PS. I do miss slime fuzzy complete when I program common lisp though. Also, can nrepl by default make completions on Java methods? I can only find it possible in ac-nrepl.

Any help would be appreciated.

Bruce Li



2013/1/20 fb <friedric...@gmail.com>
On Windows, I had to put the profiles.clj in the Windows home directory C:\Users\%user name%\AppData\Roaming, where also .emacs.d reesides (see also https://github.com/pallet/ritz/issues/28#issuecomment-12460118).

-fb
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply all
Reply to author
Forward
0 new messages