Skip to content

mjwillson/nrepl.el

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

nrepl.el

An Emacs client for nREPL, the Clojure networked REPL server.

Installation

nrepl.el is available on the both Marmalade and MELPA repos.

If you're not already using Marmalade, add this to your ~/.emacs.d/init.el and load it with M-x eval-buffer.

(require 'package)
(add-to-list 'package-archives
             '("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)

For MELPA the code you need to add is:

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)

And then you can install:

M-x package-install [RET] nrepl [RET]

or

(when (not (package-installed-p 'nrepl))
  (package-install 'nrepl))

If installation doesn't work try refreshing package list first:

M-x package-refresh-contents [RET]

On Emacs 23 you will need to get package.el yourself or install manually by placing nrepl.el on your load-path and requireing it.

Configuration

You can certainly use nrepl.el without configuring it any further but here are some ways other folks are adjusting their nrepl.el experience.

Enable eldoc in clojure buffers:

(add-hook 'nrepl-interaction-mode-hook
  'nrepl-turn-on-eldoc-mode)

Stop the error buffer from popping up while working in the REPL buffer:

(setq nrepl-popup-stacktraces nil)

Make C-c C-z switch to the *nrepl* buffer in the current window:

(add-to-list 'same-window-buffer-names "*nrepl*") 

Keys

  • M-x nrepl-jack-in: Launch an nrepl server and a repl client. Prompts for a project root if given a prefix argument.
  • M-x nrepl: Connect to an already-running nrepl server.

Clojure buffer commands:

  • C-x C-e: Evalulate the form preceding point and display the result in the echo area. If invoked with a prefix argument, insert the result into the current buffer.
  • C-M-x: Evaluate the top level form under point and display the result in the echo area. If invoked with a prefix argument, insert the result into the current buffer.
  • C-c C-r: Evaluate the region and display the result in the echo area.
  • C-c C-b: Interrupt any pending evaluations.
  • C-c C-m: Invoke macroexpand-1 on the form preceding point and display result in a macroexpansion buffer. If invoked with a prefix argument, pprint the result.
  • C-c M-m: Invoke clojure.walk/macroexpand-all on the form preceding point and display result in a macroexpansion buffer. If invoked with a prefix argument, pprint the result.
  • C-c C-n: Eval the ns form.
  • C-c M-n: Switch the namespace of the repl buffer to the namespace of the current buffer.
  • C-c C-z: Select the repl buffer.
  • C-c C-k: Load the current buffer.
  • C-c C-l: Load a file.
  • C-c C-d: Display doc string for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol
  • M-.: Jump to the definition of a var. If invoked with a prefix argument, or no symbol is found at point, prompt for a var.
  • M-,: Return to your pre-jump location.
  • M-TAB: Complete the symbol at point.

REPL buffer commands:

  • RET: Evaluate the current input in Clojure if it is complete. If incomplete, open a new line and indent. If invoked with a prefix argument is given then the input is evaluated without checking for completeness.
  • C-RET: Close any unmatched parenthesis and then evaluate the current input in Clojure. Also bound to M-RET.
  • C-j: Open a new line and indent.
  • C-c M-o: Clear the entire REPL buffer, leaving only a prompt.
  • C-c C-o: Remove the output of the previous evaluation from the REPL buffer.
  • C-c C-b: Interrupt any pending evaluations.
  • M-p: Display previous input in history.
  • M-n: Dispaly next input in history.
  • TAB: Complete symbol at point.

Requirements:

Contributing

License

Copyright © 2012 Tim King, Phil Hagelberg and contributors.

Distributed under the GNU General Public License, version 3

About

An elisp nREPL client

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Emacs Lisp 100.0%