Setting up Uber development mode in Emacs for Clojure - emacs

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.

Related

Emacs OSX 10.13 configuration issue

Recently I pass to Emacs org because is really convenient to me to write note there.
So I installed all packages I needed (principally ORG and EVIL) but I didn't understand how to setup everything.
I installed emacs from brew without using cask, I linked it, and I'm sure that I'm using the version that I installed (26.1).
So in my ~/ folder I have a .emacs file in which I set up evil mode, and I have a /.emacs.d/ in which I have a lot of file. The problem is: whatever I wrote in a ~/.emacs.d/init.el seems doesn't effect emacs.
So I said "whatever, I'm going on github and I installed some complete configurations and then I customized them myself". I tried to install these two configurations.
https://github.com/hrs/dotfiles
https://github.com/larstvei/dot-emacs?files=1
But for some reason, after doing exactly what they say on README.org
nothing happens.
In particular the second link, after install and open emacs said I need to have ~/.cask/.cask.el but I don't have it.
Advice?

Elpy to allow pyenv to work on a project basis

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).

Spawning child processes returns invalid argument

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

Scala with VScode

I started to use vscode for python development. And I really like it, does anyone know how to extend VScode so I can write scala in it as well ?
At the bare minimum I need to get syntax highlighting working.
Scala works well in VS Code 2019.
There's official syntax highlighting, and a Language Server called Metals (which replaces Ensime which is mentioned in other answers).
There is one here:
https://github.com/IliyaTryapitsin/vscode-scala
You can add it by reading the readme there which is:
Run VSCode
code --enableExtensionGallery
Press F1 then input:
for scala installation
ext install scala
for sbt installation
ext install sbt
for snippets installation
ext install scalasnippets
If your NOT using Intellij or Eclipse and want to stick to VSCode, then I highly recommend Ensime & Ensime plugin below:
https://marketplace.visualstudio.com/items?itemName=dragos.scala-lsp
Also check out, www.ensime.org
It's a bit more involved to setup ensime env but still worth it.
Discussion of two is below here:
https://www.reddit.com/r/scala/comments/5eu9if/intellij_vs_ensime/
However, Intellij has improved a lot. So, the beauty contest is a matter of judgement call.
I have been switch back & forth between many variations (Emacs, Intellij, neovim, VSCode). It's a complicated language. So, I need all the help I can get!
If you dig into the applications path it looks to me to be extensible in .js, take a look at the javascript and typescript folders for example(though I haven't tried it yet)
Visual Studio Code does not have a language extensible story yet, but it could be coming soon.
https://code.visualstudio.com/Docs/languages#_common-questions
scala has official vs code scala extension

How to download and install Emacs for OCaml?

I feel retarded asking this question, but I've been banging my head against the wall for a while now...
This directory is linked to by the website for obtaining emacs: http://ftp.gnu.org/pub/gnu/emacs/. Which file do I want? I downloaded emacs-23.1.tar.gz and unpacked it, but I don't know what to do now. I can't find any files to execute.
(I'm running Vista.)
And then I want to use tuareg mode with OCaml. Help?
I believe you've downloaded the source code, which probably isn't what you want. It might be easier for you to go to download site and download the binaries.
Getting Tuareg to work is as easy as downloading it and following the installation instructions. Some options that I like for Tuareg (but YMMV!):
(setq tuareg-default-indent 4)
(setq tuareg-with-indent 2)
(setq tuareg-|-extra-unindent 2)
Incidentally, set up and whatnot is much easier using Virtualbox + Linux VM; if you're just wanting to play around with Ocaml/Emacs then it might be easier to do that.
You downloaded the linux version - you should instead download http://ftp.gnu.org/pub/gnu/emacs/windows/emacs-23.1-bin-i386.zip
Once you have it, emacs can be started from bin/runemacs
Have a look at EmacsW32 -- it is GNU Emacs with a few tweaks to make it more comfortable for Windows users: http://ourcomments.org/Emacs/EmacsW32.html