I have a class this semester that requires a lisp dialect so I'm trying to get started with Clojure but I'm running into a lot of problems setting up my environment.
I'm on a Windows machine and am following the tutorial at http://www.braveclojure.com/basic-emacs/ to set up emacs which from my research seems like the best IDE for working with lisp. I had Cygwin installed before starting which supposedly has a lot of support for emacs but I'm not sure if I need to do more than just have it installed.
My problems is when I try to start a REPL in emacs with M-x cider-jack-in I get the response Spawning child process: invalid argument. If I do the M-x load-path command I get a list of every subfolder in my .emacs.d folder but not the .d folder itself but the folder where my cider package is installed is clearly listed.
I installed lein before I decided to try setting up emacs and I could open a REPL just fine with it but emacs seems like a much better way of working than just using the terminal.
Any advice is greatly appreciated but if there is a better/easier way to get started with Clojure on Windows than what I'm currently doing I'd love to hear about it.
Thanks in advance for any replies.
Yes, emacs is great, but if you haven't worked with it before then you will have a very steep learning curve, exacerbated by the fact you are running Windows. I myself use emacs with CIDER a lot, and I also use emacs on Windows quite a bit, but I don't mix it - I use emacs/CIDER only on Linux. It doesn't mean at all that it can't be made to work on Windows, it's just it has a lot of complexity of its own, which you might not have time or inclination to deal with right now. (By the way, I wouldn't recommend using emacs under Cygwin [1] , use a good native build instead. And if you still decide to go with emacs, by all means try Prelude - it comes from the author of CIDER by the way.)
If you want an option that is definitely smoother under the circumstances, download IntelliJ IDEA Community Edition and install Cursive. That will have its own learning curve for sure, but give it a try and see what you prefer. I use both, nothing beats IntelliJ/Cursive in Java interop projects.
Both emacs/CIDER and IntelliJ/Cursive are terrific and will repay for deeper learning.
[1] I am not even sure a combination of emacs on Cygwin and lein/clojure on Win32 can work, but I have no environment to test.
unset the SHELL env variable - taken from: http://tb-nguyen.blogspot.com/2010/05/how-to-fix-emacs-windows-error-spawning.html
It worked for me
Related
I've used Emacs for all my coding projects so far. Soon I will start some python projects for the first time and would love to stick to Emacs for these as well.
I was looking into elpy which seems to provide already alot of desired functionality. The part I was not able to figure out completely is the following. I like to define virtual environments and python version to be used on a project basis. Let's say I start a project A, then I would use pyenv-virtualenv or pyenv-virtualenvwrapper to set it up
pyenv virtualenv 3.4.2 my-virtual-env-3.4.2
by doing this I've linked the python version 3.4.2 to that specific virtualenv / project. I have two questions regarding this in combination with elpy.
Question: This is a rather basic one. All the above can be achieved via the terminal. What is the advantage to emacs to support this? The workflow for me would be: Create project with associated virtualenv and python version. Activate virtualenv and start coding in emacs. If I need to install a package I will run pip in the terminal to ensure virtualenv is captured properly. There must be a reason why it's beneficial to support this in emacs. With my lack of knowledge I just don't see it :)
As pointed out there is for sure a good reason why we want emacs / elpy to support this. My second question would then be
**Question: How can I achieve this in emacs? Lokks like this blog has a solution. I was wondeirng if someone already tried this setup if it is a neat solution with makes sense conceptually. **
Well I strongly guess the goal is to use more features than just syntax highlighting: flycheck/flake8/linting, refactoring, elpy's test runner to use the right python version, install a pip package directly from emacs, stuff like this. You can carry on doing this in the terminal, but once you want an emacs feature, you'll need to set it up.
IĀ found two modes to do that (see wikemacs python page and doubled-checked on melpa): pyenv-mode (in melpa) and pyenv-mode-auto (change the version when there is a .python-version file).
I am new to Scheme, and using gosh running on emacs buffer, in MinGW on Windows. It seems that people use readline or rlwrap to use history and more, but I still cannot figure out to accomplish the setting. Though it may be easy to run one on Linux using virtual machine, I would stick to Windows for now. Any idea or alternative suggestion?
An Emacs buffer is not a real terminal, and rlwrap will not run in it. However, this is no tragedy: almost all of rlwraps goodness can be had directly from Emacs (you could use one of the existing scheme modes, or even Emacs-gosh-mode)
If you insist, Emacs can provide a terminal emulator for you (M-x term) in which rlwrap will feel right at home.
What is the correct workflow/pathway of usage of emacs/cider while developing
a compojure/ring-based clojure application?
I feel that I can "attach" to my running compojure/ring-process,
change its code, read/change its data, but I can't understand how do I do it right?
What is the correct way?
What I do?
lein new compojure my-project
cd my-project
lein ring server-headless
The development server runs now. If I change files in the projects they will be automatically reloaded. That is good. But what I'd like to have is that I attach
direct to the process and change its functions for example.
I understand that it is possible, but I can't understand how.
I don't know about correct but I'll throw in my 2 cents.
I start my ring project using immutant which starts a REPL at a specified port. I start cider with M-x cider and connect to the previously specified port. From there I can modify things from the REPL.
I've also seen other people start jetty from inside the REPL though I've never tried this.
There are two main ways of doing what you want. None of them are specific to ring servers, or even to webservers, they'll apply to any Clojure Project.
Both of the methods below should give you a fully functional REPL, with complete control to redefine the functions in your running server, and full CIDER functionality (like being able to debug web-requests to the server).
As usually with CIDER, you can reload changed files with C-c C-k, which will redefine any functions you've changed. There are plenty of other keys for more fine-tuned evaluations as well.
M-x cider-jack-in (or C-c M-j)
As documented on the manual this starts a process with your project and connects a REPL to it. This won't call any functions for you (CIDER doesn't do that), but you can easily start your webserver by calling the corresponding function in the REPL. If the function in question is the -main function, you can do M-x cider-run to call it (bind that to a key if you'd like).
M-x cider-connect
Also as documented on the manual, you can start your webserver from the terminal like you normally would, and then call M-x cider-connect to open a REPL in it. (This is what I used to do a while back).
A bit late to the party. But as I have just to deal with the same issue and found this unanswered question. The answer could be found at:
lein ring server with nrepl doesn't honour cider-nrepl
Basically, use the plugin version 0.9.2 of lein-ring and add to the :ring configuration on project.clj :nrepl {:start? true} and it works
I've been interested in learning lisp and rather than suck it up and trying emacs (I haven't figured that out yet), I've installed Dandelion for Eclipse.
I can't get my simple Lisp code to run
(* 2 3)
I get:
Error in background evaluation
java.net.ConnectException: Connection refused
From an older post in SuperUser I updated my chmod for the plugin to no avail. Does anyone know how to get this up and running?
Thanks.
Learning emacs will be the best thing since sliced bread unless you like having your editor eat 1 gig of ram. Here is some starter help I found useful.
http://www.emacswiki.org/emacs/ReferenceCards
Once you get around the emacs keyboard chords you should install slime it is worth all the eclipses in the world.
http://www.cliki.net/slime
Happy hacking !
I am aware of
A gentle tutorial to Emacs/Swank/Paredit for Clojure
I basically have the same question.
I noted that there is an EDIT saying that the instructions are outdated, and there will be an update (I don't see where the update is posted.)
Thus, my question:
What is the "right way" to setup Emacs w/ Clojure?
Context: I've been coding Clojure w/ VIM for the past few years; but Slime/Swank looks quite impressive.
Thanks!
See http://dev.clojure.org/display/doc/Getting+Started+with+Emacs or more directly, https://github.com/technomancy/clojure-mode/blob/master/README.md, for a pretty good overview of what you need to set up. Basically, install clojure-mode and the leiningen plugin for swank-clojure and you're pretty much good to go. Once those are installed, you just create a new leiningen project, open a clj file from within the project somewhere, and do a M-x clojure-jack-in.