I have installed Emacs24,and installed clojure-mode nrepl.
I opened a emacs window, and M-x nrepl-jack-in, it shows:
; nrepl.el 0.2.0 (Cljoure 1.6.0, nREPL 0.2.3)
I open a clj buffer in another window, I want to compile the buffer file by using C-c,C-K, but I get C-c, C-k is undefined.
How can I get it work to compile the clj file. Thank you.
First make sure you're up to date; CIDER has replaced NREPL.el for a while now, and has just had a major update. See https://github.com/clojure-emacs/cider
Related
I have successfully installed hy-mode from https://github.com/hylang/hy-mode. I now can open a .hy file in emacs and have syntax highlighting, and editing with paredit is a joy.
I however, don't know how to start a REPL. At the bottom of the github readme, it says:
When in hy-mode, you can launch a Hy REPL by launching a Lisp inferior
process
M-x lisp-inferior-process
That function, however, is not defined for me. What else do I need to install or check to be able to use the repl for Hy?
I am currently using:
GNU Emacs 24.3.1.
Have you tried to set inferior-lisp-program to "hy" and then doing M-x run-lisp?
This is the standard way (or maybe just the "way I know about") of having an inferior lisp process.
As of version 1.0.4 of hy-mode, you can start a hy repl buffer in Emacs using M-x run-hy or use the default key binding of C-c C-z.
In any Emacs mode, including hy-mode, you can use M-x describe-mode or the default key binding of C-h m to show key bindings for the current mode.
I created a new project with lein. I open core.clj in emacs. I make sure to run M-x clojure-mode, and M-x nrepl-enable-on-existing-clojure-buffers.
Then I run M-x nrepl-jack-in and in the mini-buffer I get
Starting nREPL server...
followed by a message such as:
Connected. You're bound to be unhappy if you optimize everything.
-Donald Knuth
I see that the buffer name is *nrepl*, but the buffer does not contain a Clojure Repl and instead is completely blank.
If I type anything (meaning anything at all,) I get:
Wrong type argument: integer-or-marker-p, nil
If I switch back to my core.clj buffer, and hit C-c C-l,I get the namespaced name of the last function in my buffer in the minibuffer as a result. And if I put my cursor at the end of a function definition and hit C-x C-e, I get:
CompilerException java.lang.RuntimeException: Unable to resolve
symbol: x in this context, compiling:(NO_SOURCE_PATH:1:1)
I tried making a new lein directory with no dependencies using lein new project-name and tried the same steps as above and got the same results.
What else can I check and/or what am I doing wrong?
EDIT: Additional Information
When I type something into the empty *nrepl* buffer and try to press C-x C-e on what I typed, in the mini buffer I get the message:
No Lisp subprocess; see variable `inferior-lisp-buffer'
Also, I am running:
GNU Emacs 24.3.1
Leiningen 2.1.2 on Java 1.6.0_27 OpenJDK 64-Bit Server VM
I just fixed this exact issue on my own setup. Move your .emacs.d to a backup location, and make a backup copy of your .emacs. Make a new .emacs with only the following lines:
(require 'package)
(add-to-list 'package-archives
'("marmalade" .
"http://marmalade-repo.org/packages/"))
(package-initialize)
(require 'clojure-mode)
(require 'nrepl)
Once you install nrepl and clojure-mode via running M-x package-list-packages and installing their respective entries, you will be able to use nrepl.
Add your custom .emacs back in one logical unit at a time, and you should be able to figure out where the conflict was and eliminate it. Be suspicious of anything related to slime / swank.
I just installed the emacs package dired-details from inside emacs via
M-x package-list-packages
clicked on the package name and then install in the newly opened buffer.
Then I put those lines into my .emacs:
(require 'dired-details)
(setq-default dired-details-hidden-string ">---< ")
(dired-details-install)
When I restart emacs, I get the following error:
File error: Cannot open load file, dired-details
The interesting thing is, that when I mark the code region above and apply
M-x eval-region
everything works as expected.
emacs --version
>> GNU Emacs 24.3.1
package version:
dired-details-20130328.1119
Packages you installed with package.el need to be initialized if you want to access them during emacs initialization.
Add the line
(package-initialize)
to the very beginning of your .emacs .
Also follow phil's recommendation and see the variable
package-enable-at-startup
Newbie Clojure programmer here. NREPL in Emacs isn't working for me.
Aquamacs 2.5 (Emacs 23.4.1)
nrepl.el 0.1.8
Leiningen 2.2.0 on Java 1.6.0_51 Java HotSpot(TM) 64-Bit Server VM
My project is just the lein-generated Hello World.
Running "lein repl" in a shell works, but nrepl.el doesn't work.
Rather than winding up in the project's namespace in the repl,
I just get the default toplevel in the "user" namespace.
Should see something like:
my$ lein repl
nREPL server started on port 57347
REPL-y 0.2.0
Clojure 1.5.1
Hello Project
my.core=>
But instead see:
; nREPL 0.1.8-preview
user> (in-ns my.core)
CompilerException java.lang.ClassNotFoundException: my.core, compiling:(NO_SOURCE_PATH:1:1)
user>
In a clean nrepl.el scenario, I see two java processes going and they look plausible. One has my project on the -classpath and is implementing the actual repl (server), while the other is the client side java (-D MyProjectPath -m leiningen.core.main repl :headless).
I get the same lossage whether I get there by m-x nrepl-jack-in or starting in the shell and then m-x nrepl. I get a repl that doesn't know my project.
I wonder if this stuff works for anyone, or if I have something installed or set up wrong? Lots of "0.xxx" versions of things going on here...
Looks like you are missing a quote before your namespace, try the following:
(in-ns 'my.core)
Note the ' before my.
NRepl always starts in the top-level user namespace. Use M-x nrepl-set-ns, or C-c M-n in a Clojure buffer, to set the namespace of NRepl to the one of the buffer.
In your specific case,
visit src/my/core.clj, press C-c M-j to start NRepl,
switch back to the src/my/core.clj buffer,
press C-u C-c C-z to set the NRepl namespace to my.core and switch back to the NRepl buffer.
C-u C-c C-z is a shortcut for C-c M-n followed by C-c C-z to switch to the NRepl buffer.
I have installed the nrepl, clojure-mode and starter-kit-lisp packages. I am able to start the nrepl by opening my .clj file and then M-x nrepl-jack-in.
However when I evaluate any form in my .clj file by C-x C-e, I get the following message:
inferior-lisp-proc: No Lisp subprocess; see variable `inferior-lisp-buffer'
How do I get it right?
I have had this problem a number of times. In all cases, it has been because while nrepl has started, the nrepl minor mode has not been enabled in the clj buffer. As a result, any evaluation attempts fail with this error.
There should be a "nrepl" menu item. If there isn't, this may be your problem. M-x nrepl-enable-on-existing-buffers should fix it.
I had this problem for a while, and now it appears to have gone away; you might want to try installing clojure-mode and nrepl afresh.
Are you sure M-x nrepl-jack-in worked? If it did, you should be prompted with a repl in emacs, like so:
nrepl requires leiningen 2, so make sure that you use the right version in your project and that the nrepl plugin is properly installed.
Also make sure that the major mode when editing your .clj file is clojure-mode.
You might want to post a screenshot to make it easier to spot the problem.