Installing CIDER for 1st time with emacs?


#1

Hello all,
I’m a noob with emacs and cider and having difficulty getting it set up but am determined to enjoy the sweetness and goodness of clojure and emacs/cider together.

I think I’m almost there but am stuck at a few spots. Specifically these two:

  1. Per this link the emacs/cider github it says

“The recommended way to install CIDER is via package.el - the built-in package manager in Emacs.”

I have NO idea where this package.el file is located as I installed emacs from this site: emacsformacosx(DOT) com

  1. Per this link:
    https://stable.melpa.org/#/cider

It says:

(add-to-list ‘package-archives
’(“melpa-stable” . “https://stable.melpa(DOT)org/packages/”) t)"

but per this other link:
https://cider.readthedocs.io/en/latest/installation/

it says “(unless (package-installed-p 'cider)
(package-install 'cider))”

Which one is correct? Totally confused…

Thanks in advance


#2

Hi @Synth_Slave,

Learning Emacs is difficult. I do want to do a course about it. But I also don’t know where to start! I learned Emacs 20 years ago.

However, package management is new in Emacs.

Let me see if I can clarify your three points.

package.el is the name for the package management system that is now built into Emacs. So no need to locate it.

(add-to-list ‘package-archives
  ’("melpa-stable" . "https://stable.melpa.org/packages/") t)

This adds the “MELPA” repository to the list of repos the package manager will download from.

(unless (package-installed-p 'cider)
   (package-install 'cider))

This checks if cider is already installed and installs it if it can’t find it.

In short, you need both of those lines. You want the melpa one first.

Let me know if this works.

Rock on!
Eric


#3

Hi @ericnormand ,

Thanks for reply and for trying to help.

It’s just a drag as I’ve really been enjoying your videos and concepts but this one aspect alone has been a major buzzkill and truthfully, had I known how much of a hassle it was in beginning, might’ve just passed on learning Clojure in lieu of another functional language such as Elixor.

Regarding emacs, at least from my perspective as a noob, I don’t think you need to have anything too deep. But just a bare bones basics tutorial to be able to have the same setup that you have in your videos to learn Clojure fundamentals which is why I’m even here. I could care less about what new features emacs has, but I do want to be able to practice Clojure TDD which I’ve been super excited to learn but unable to due to cider situation. An example of some basic emacs tips would be how esc x to type in commands or ctrl x ctrl s to save a file as those are NOT intuitive to me.

But without question, the biggest challenge for me has been installing Cider. The few tutorials on Youtube show you’ve got to search for hidden files ala ls -a to find the emacs.d file and then go into there to find the init.el file or create a new one. It’s like a whole bunch of clerical work just to use Clojure when almost any modern day editor like Atom is much more intuitive (from my noobs perspective)

lastly, I tried your tips and unfortunately, it still doesn’t work. when I try to do an

M-x package-refresh-contents

It says "Failed to download ‘gnu’ archive

I am trying to refresh an init.el file that’s located in the emacs.d file which is a hidden file in my home directory. This is the following code:

(require 'package)

(package-initialize)

(add-to-list 'package-pinned-packages '(cider . “melpa-stable”) t)

(unless (package-installed-p 'cider)
(package-install 'cider))

I then type:

esc x package-refresh-contents

Thanks,
Sy

EDIT: I just tried following every instruction per the Brave Clojure link:
https://www.braveclojure.com/basic-emacs/

and still no dice. I tried un-installing emacs and re-installing but when I try to list packages or refresh, it says “no match”


#4

Hi @Synth_Slave,

I totally sympathise, I found it hard to get comfortable with emacs learning on my own.

I started a new job, with lots of emac users and they found my cobbled together set up pretty laughable. Like you, I used the brave clojure guide to get me started, which was useful, but I think has a hard-coded old version of CIDER in it (I guess so the instructions in the printed book stay correct).

However, I also found that my new colleagues each have their own individual set up of emacs and would often give me conflicting advice about how to set things up, so there often isn’t really a right or wrong.

I’d have a go at using an emacs distribution with most things you need bundled in already.

Prelude Emacs is really good for Clojure (it’s maintained by the same guy that works on CIDER)

Spacemacs is another popular alternative:
http://spacemacs.org/

Susan


#5

Thank you for your reply Susan. I appreciate your time and help.

I’ll give those distros a try. I’m not sure but I think I might’ve tried ONE of the two but couldn’t find CIDER. Anyways, I’m taking a break from Clojure for a month (trying to focus on one language a month so Swift is my current one) but will give it another shot in a month as Eric’s vids sold me on the language.

Thanks,
Sy