Last year, I decided to use Emacs for Clojure development. It is the most common, mature and the richest development environment for this task. After downloading and installation, I got a clean setup.
I read documents, followed the tutorials. I started to understand the terminology and the shortcuts. Window, frame, buffer, modes… Nothing was working according to my intuitions, but I didn’t step back and kept practicing on.
I watched videos, read the guide at braveclojure.com, read more documents and started customizations. However, things were not easy, configuration was hard. I was obsessed to build the dream environment for Clojure development, but I was fighting against the editor. Anyway, I believe the motto “No pain, No gain” in heart.
While I was reading about the configurations, I saw references to some distributions. Spacemacs and Prelude were the ready made configurations that I was trying do. Please have a look at them if you’re new to Emacs. I choose Spacemacs, it was more popular and it looked really cool.
After reading Spacemacs documentation, I began to customize it. It wasn’t hard but you need to be ready for surprises. For example, if you wan’t to change the font-size, you just edit the configuration file and reload it. (with a key combination) Oops… nothing happened. Why? Because the default font isn’t supported at 16px. I’m using a Mac and I didn’t expect this. Anyway, I changed the font to Menlo and it worked.
I was very serious to grasp the best practices. Every documentation or tutorial was referencing to Org mode. It seemed worthy to learn, I read a lot, I really tried to use it while taking notes, planning or even generating a static website, but I didn’t like it. Maybe it was my fault to get busy with irrelevant things. I should have focused to Cider and Clojure things.
Yes Pain, No Gain
Keybindings were nightmare. I could never configured them in a right way. I couldn’t use slurp and barf shortcuts of Paredit. Maybe this wasn’t so important, but I was obsessed.
Switching between windows wasn’t easy. I lost the REPL window many times. Any wrong command was ruining current setup heavily. I couldn’t figure out how to take back my faulty commands. I was hiding something forever or falling in a hopeless situation.
I’m very used to see the project folder at the left side of the window. So, I searched for a package and found NeoTree. After many attempts of getting used to shortcuts, I was happy to see my files at the left sidebar, until opening a new project. NeoTree was working only for one frame, it was a single instance. It wasn’t possible to work at more than one project at the same time.
All these experiments took several evenings and several weekends. I wasn’t learning Clojure, I was struggling with Emacs all the time, and I stopped.
One More Time
Today, I decided to try one more time. This time I’m experienced and I’m focused to write a single Clojure function. I installed the latest version of Emacs, renamed my .emacs.d folder and .spacemacs file. I started from scratch to build a new setup. I cloned the Spacemacs repo, add Clojure to modes and barely open a Clojure project. I started editing the file and wrote my first
defn Oops…, I couldn’t type square brackets with the usual key combination Alt+8. I received “No window numbered 8”. I need to resolve this issue before starting to code. Huh… very disappointing.
Okay, many people are comfortable at using Emacs. This means it’s my problem but I really don’t know what is the wrong with me :) I don’t get how it works for others.
I use Proto REPL now. It has some problems but it’s easy. Also Cursive is an option too, but I think it should be simplified and work as an independent IDE.