Error formatting macro: pagetree: java.lang.NullPointerException

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Link off to canonical documentation pages.

Install clojure-mode.

Open or create a Clojure .clj file, and you should find that clojure-mode enabled since built-in functions and forms are syntax-highlighted.

There are multiple approaches for interacting with a live Clojure process:

  • SLIME and Swank Clojure: a rich, complex mode that provides various commands to communicate with an external Clojure instance via a socket.
  • inferior-lisp: a simple mode that will start a Clojure instance as a subprocess and then communicates with its REPL via stdin/stdout.

In both cases, you need to launch a Clojure subprocess. This is most commonly done using a tool such as Leiningen.

SLIME and Swank Clojure

Once Leiningen is installed, run lein plugin install swank-clojure 1.3.4

Invoke M-x clojure-jack-in to begin a Slime session for the current project.

The most commonly-used key bindings are C-c C-k to compile the current file, M-. to jump to a definition, and C-c M-p to change the namespace of the repl session.

For more key bindings and other details see the swank-clojure readme.

inferior-lisp

The simplest way to interact with Clojure is to launch a subprocess by invoking M-x run-lisp (C-c C-z) from a clojure buffer.

Use C-x C-e at the end of an expression to evaluate it, showing the result in the inferior-lisp buffer. C-c C-l will load the current file. C-M-x can evaluate a whole def form.

If you don't use Leiningen you'll need to customize the command that launches a Clojure REPL. You can use an absolute path, or a relative path that will be interpreted relative to the current directory in emacs. M-x describe-variable inferior-lisp-program with one of the following:

  • java -cp path/to/clojure.jar clojure.main for a basic repl (no rlwrap/jline needed)
  • lein repl for a Leiningen project
  • cake repl for a Cake project
  • mvn clojure:repl for a Maven project
  • script/repl for the labrepl tutorial project

Automated VM Setup

...

Overview

An overview is available in the Clojure Mode repository.

Installing Emacs

Clojure Mode

Basic support comes from Clojure Mode, including syntax highlighting and indentation.

Inferior Lisp

Simple REPL interaction with a live process is done via Inferior Lisp.

Swank Clojure

A more enhanced REPL experience is offered by Swank Clojure and SLIME.