DEV Community

Ivan Guerreschi
Ivan Guerreschi

Posted on

Configure Emacs for Clojure

Basic configuration to start using Clojure with Emacs

Create the init.el configuration file

Open a terminal and create a directory: mkdir ~/emacs.d
Enter the newly created directory: cd emacs.d
Create file: touch init.el

Install MELPA repository

Editing file: emacs init.el

(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                    (not (gnutls-available-p))))
       (proto (if no-ssl "http" "https")))
  (when no-ssl (warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
(add-to-list 'package-archives (cons "melpa" (concat proto ://melpa.org/packages/")) t)
  ;; Comment/uncomment this line to enable MELPA Stable if  desired.  See `package-archive-priorities`
  ;; and `package-pinned-packages`. Most users will not need or want to do this.
  ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
  )
(package-initialize)

With this code we have installed the MELPA repository, this repository contains many packages for expanding Emacs

Install CIDER

CIDER is the Clojure(Script) Interactive Development Environment that Rocks!

(use-package cider
  :ensure t)

Save the file C-x C-s close C-x C-c and restart Emacs

This is a basic configuration for using Clojure with Emacs

Top comments (0)