summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2019-01-10 08:50:33 -0700
committerSean Whitton <spwhitton@spwhitton.name>2019-01-10 08:50:33 -0700
commit9fa91217c2582736e929bab41cb58f506d4d0b7f (patch)
tree6932cef398345f25acba2737d8f9b696ee040b88
parentb17a12b301a82f1e1ab9b19674aeb7fff3c25b40 (diff)
parentcd71f5cc12c93355cdf5698ac0aee9606480176a (diff)
Merge tag 'v0.19.0+dfsg'
DFSG-clean upstream version 0.19.0
-rw-r--r--.dir-locals.el2
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md4
-rw-r--r--CHANGELOG.md37
-rw-r--r--Makefile60
-rw-r--r--README.md32
-rw-r--r--cider-apropos.el2
-rw-r--r--cider-browse-ns.el2
-rw-r--r--cider-cheatsheet.el2
-rw-r--r--cider-classpath.el2
-rw-r--r--cider-client.el10
-rw-r--r--cider-common.el82
-rw-r--r--cider-compat.el2
-rw-r--r--cider-completion.el2
-rw-r--r--cider-connection.el172
-rw-r--r--cider-debug.el9
-rw-r--r--cider-doc.el2
-rw-r--r--cider-eldoc.el2
-rw-r--r--cider-eval.el8
-rw-r--r--cider-find.el2
-rw-r--r--cider-format.el8
-rw-r--r--cider-grimoire.el2
-rw-r--r--cider-inspector.el27
-rw-r--r--cider-macroexpansion.el2
-rw-r--r--cider-mode.el47
-rw-r--r--cider-ns.el2
-rw-r--r--cider-overlays.el2
-rw-r--r--cider-popup.el2
-rw-r--r--cider-profile.el2
-rw-r--r--cider-repl.el39
-rw-r--r--cider-resolve.el4
-rw-r--r--cider-scratch.el2
-rw-r--r--cider-selector.el2
-rw-r--r--cider-stacktrace.el2
-rw-r--r--cider-test.el4
-rw-r--r--cider-tracing.el2
-rw-r--r--cider-util.el4
-rw-r--r--cider.el118
-rw-r--r--doc/about/support.md7
-rw-r--r--doc/additional_resources.md1
-rw-r--r--doc/caveats.md2
-rw-r--r--doc/clojurescript.md179
-rw-r--r--doc/code_completion.md41
-rw-r--r--doc/configuration.md113
-rw-r--r--doc/debugging.md171
-rw-r--r--doc/faq.md4
-rw-r--r--doc/hacking_on_cider.md5
-rw-r--r--doc/images/cider_architecture.pngbin55320 -> 62187 bytes
-rw-r--r--doc/indent_spec.md12
-rw-r--r--doc/index.md5
-rw-r--r--doc/installation.md61
-rw-r--r--doc/interactive_programming.md80
-rw-r--r--doc/managing_connections.md29
-rw-r--r--doc/miscellaneous_features.md246
-rw-r--r--doc/navigating_stacktraces.md86
-rw-r--r--doc/running_tests.md170
-rw-r--r--doc/troubleshooting.md6
-rw-r--r--doc/up_and_running.md157
-rw-r--r--doc/using_the_repl.md260
-rw-r--r--mkdocs.yml2
-rw-r--r--nrepl-client.el27
-rw-r--r--nrepl-dict.el2
-rw-r--r--test/cider-apropos-tests.el2
-rw-r--r--test/cider-browse-ns-tests.el2
-rw-r--r--test/cider-classpath-tests.el2
-rw-r--r--test/cider-client-tests.el16
-rw-r--r--test/cider-common-tests.el2
-rw-r--r--test/cider-connection-tests.el118
-rw-r--r--test/cider-debug-tests.el2
-rw-r--r--test/cider-eldoc-tests.el2
-rw-r--r--test/cider-error-parsing-tests.el2
-rw-r--r--test/cider-find-tests.el2
-rw-r--r--test/cider-font-lock-tests.el14
-rw-r--r--test/cider-grimoire-tests.el2
-rw-r--r--test/cider-interaction-tests.el6
-rw-r--r--test/cider-ns-tests.el2
-rw-r--r--test/cider-overlay-tests.el2
-rw-r--r--test/cider-repl-tests.el2
-rw-r--r--test/cider-selector-tests.el4
-rw-r--r--test/cider-stacktrace-tests.el2
-rw-r--r--test/cider-tests--no-auto.el2
-rw-r--r--test/cider-tests.el2
-rw-r--r--test/cider-util-tests.el6
-rw-r--r--test/nrepl-bencode-tests.el2
-rw-r--r--test/nrepl-client-tests.el6
-rw-r--r--test/nrepl-dict-tests.el2
-rw-r--r--test/utils/cider-connection-test-utils.el2
86 files changed, 1531 insertions, 1046 deletions
diff --git a/.dir-locals.el b/.dir-locals.el
index fe7dacd..605e2ce 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -4,7 +4,7 @@
((emacs-lisp-mode
(bug-reference-url-format . "https://github.com/clojure-emacs/cider/issues/%s")
(bug-reference-bug-regexp . "#\\(?2:[[:digit:]]+\\)")
- (indent-tabs-mode)
+ (indent-tabs-mode . nil)
(fill-column . 80)
(sentence-end-double-space . t)
(emacs-lisp-docstring-fill-column . 75)
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index dbdef4b..913f9c3 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -12,11 +12,11 @@ by checking the relevant checkboxes):
- [ ] All code passes the linter (`make lint`) which is based on [`elisp-lint`](https://github.com/gonewest818/elisp-lint) and includes
- [byte-compilation](https://www.gnu.org/software/emacs/manual/html_node/elisp/Byte-Compilation.html), [`checkdoc`](https://www.gnu.org/software/emacs/manual/html_node/elisp/Tips.html), [check-declare](https://www.gnu.org/software/emacs/manual/html_node/elisp/Declaring-Functions.html), packaging metadata, indentation, and trailing whitespace checks.
- [ ] You've updated the [changelog](../blob/master/CHANGELOG.md) (if adding/changing user-visible functionality)
-- [ ] You've updated the [user manual](../blog/master/doc) (if adding/changing user-visible functionality)
+- [ ] You've updated the [user manual](../blob/master/doc) (if adding/changing user-visible functionality)
Thanks!
*If you're just starting out to hack on CIDER you might find this [section of its
manual][1] extremely useful.*
-[1]: https://cider.readthedocs.io/en/latest/hacking_on_cider/
+[1]: https://docs.cider.mx/en/latest/hacking_on_cider/
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 50d974c..da625d0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,38 @@
## master (unreleased)
+## 0.19.0 (2019-01-01)
+
+### New features
+
+* [#2430](https://github.com/clojure-emacs/cider/issues/2375): `cider-find-var` opens archive files inside [AVFS](http://avf.sourceforge.net) folders if AVFS is detected.
+* [#2446](https://github.com/clojure-emacs/cider/issues/2446): Implement Sesman friendly sessions to allow for on-the-fly association with sessions from dependency projects and jars.
+* [#2253](https://github.com/clojure-emacs/cider/issues/2253): Split `continue` debug command into "continue till next breakpoint" (`c`) and "continue non stop" (`C`) commands.
+
+### Bug fixes
+
+* [#2474](https://github.com/clojure-emacs/cider/issues/2474): Fix incorrect detection of output and out-of-order printing.
+* [#2514](https://github.com/clojure-emacs/cider/issues/2514): Don't auto-jump to warnings when `cider-auto-jump-to-error` is set to 'errors-only.
+* [#2453](https://github.com/clojure-emacs/cider/issues/2453): Make it possible to debug deftype methods by direct insertion of #dbg and #break readers into the deftype methods.
+* [#1869](https://github.com/clojure-emacs/cider/issues/1869),[cider-nrepl#460](https://github.com/clojure-emacs/cider-nrepl/issues/460): Fix `continue` debugger command which was stopping entering debugger on repeated invocations.
+* [#2444](https://github.com/clojure-emacs/cider/issues/2444): Reuse dead REPL buffers on new connections.
+* [#2441](https://github.com/clojure-emacs/cider/issues/2441): Make it possible to use `C-c C-x` keys without loading cider first (autoload `cider-start-map`).
+* [#2440](https://github.com/clojure-emacs/cider/issues/2440): Make `cider-check-cljs-repl-requirements` take effect again.
+* [#2439](https://github.com/clojure-emacs/cider/issues/2439): Remove mentions of `cider-toggle-connection-buffer` from the docs.
+* [#2435](https://github.com/clojure-emacs/cider/issues/2435): Remove killed REPLs from sessions in client sentinel.
+* Fix jack-in from inside of remote buffers.
+* [#2454](https://github.com/clojure-emacs/cider/pull/2454): Fix erratic inspector behavior when multiple REPLs are connected
+* [#2467](https://github.com/clojure-emacs/cider/pull/2467): Make generic CIDER ops use any available nREPL connection.
+* [#2105](https://github.com/clojure-emacs/cider/issues/2105): Fix no comment syntax defined message when loading buffer after running a failing test.
+* [#2115](https://github.com/clojure-emacs/cider/issues/2515): Reset the current buffer after `display-buffer`.
+
+### Changes
+
+* [#2482](https://github.com/clojure-emacs/cider/issues/2482): Don't bind nREPL server started by `cider-jack-in` to `::` (use `localhost` instead).
+* [#2484](https://github.com/clojure-emacs/cider/pull/2484): Fix issues where some functionality in REPL buffers (like eldoc) was broken.
+* [#2484](https://github.com/clojure-emacs/cider/pull/2484): REPL types are now symbols instead of strings.
+* [#1544](https://github.com/clojure-emacs/cider/issues/1544): Add a new defcustom `cider-infer-remote-nrepl-ports` to control whether we use tramp/ssh to infer remote ports. Now defaulting to `nil` (previously it always tried to infer).
+
## 0.18.0 (2018-09-02)
### New features
@@ -21,7 +53,7 @@
* [#2373](https://github.com/clojure-emacs/cider/issues/2373): Make it possible to configure the welcome message displayed in scratch buffers via `cider-scratch-initial-message`.
* Add the ability to jump to the profiler buffer using `cider-selector`.
* [#1980](https://github.com/clojure-emacs/cider/issues/1980): Echo back missing namespace name on interactive eval (requires nREPL 0.4.3+).
-* [#2397](https://github.com/clojure-emacs/cider/pull/2397): Add shadow-select CLJS REPL type.
+* [#2397](https://github.com/clojure-emacs/cider/pull/2397): Add shadow-select ClojureScript REPL type.
* [#2314](https://github.com/clojure-emacs/cider/pull/2314): Add `cider-ns-reload` and `cider-ns-reload-all` interactive commands.
### Bugs fixed
@@ -43,12 +75,13 @@
* **(Breaking)** Bump the minimum required Emacs version to 25.1.
* **(Breaking)** Drop support for Java 7 and Clojure(Script) 1.7.
* **(Breaking)** Use session name as part of CIDER buffers names (REPL, server, messages), and obsolete `nrepl-buffer-name-separator` and `nrepl-buffer-name-show-port`. See `cider-session-name-template` and `cider-format-connection-params` for how to customize CIDER buffer names.
+* **(Breaking)** Use a custom task (`cider.tasks/nrepl-server`) for `cider-jack-in` with Boot (that's done to provide access to newer nREPL features to users of older versions of Boot).
* Rename `cider-eval-defun-to-point` to `cider-eval-defun-up-to-point`.
* Add support for printing to the current buffer to `cider-eval-defun-up-to-point`.
* Remove `cider-ping` command.
* Remove `cider-visit-error-buffer` in favour of using `cider-selector`.
* Rename `cider-refresh` to `cider-ns-refresh` (and all the related defcustoms).
-* **(Breaking)** Rewrote connection management (see http://docs.cider.mx/en/latest/managing_connections/ for details).
+* **(Breaking)** Rewrote connection management (see https://docs.cider.mx/en/latest/managing_connections/ for details).
* **(Breaking)** `cider-jack-in-clojurescript` now creates only a ClojureScript REPL (use `cider-jack-in-clj&cljs` to create both REPLs).
* [#2357](https://github.com/clojure-emacs/cider/issues/2357): Support both keywords and strings as test selectors (previously it was only strings).
* [#2378](https://github.com/clojure-emacs/cider/pull/2378): Add autoloads target to Makefile.
diff --git a/Makefile b/Makefile
index 507103d..401239b 100644
--- a/Makefile
+++ b/Makefile
@@ -2,13 +2,15 @@ export EMACS ?= emacs
EMACSFLAGS = -L .
CASK = cask
VERSION = $(shell git describe --tags --abbrev=0 | sed 's/^v//')
-PACKAGE_NAME = cider-$(VERSION)
+PKG = cider
-ELS = $(wildcard *.el)
-LINTELS = $(filter-out cider-autoloads.el,$(ELS))
+ELS_ALL = $(wildcard *.el)
+ELS = $(filter-out $(PKG)-autoloads.el,$(ELS_ALL))
OBJECTS = $(ELS:.el=.elc)
-.PHONY: elpa build version test lint clean elpaclean run-cider
+.PHONY: elpa build version test lint clean elpaclean autoloads run-$(PKG)
+
+all: build
.depend: $(ELS)
@echo Compute dependencies
@@ -26,7 +28,21 @@ elpa-$(EMACS):
elpa: elpa-$(EMACS)
-build: version elpa
+autoloads: $(PKG)-autoloads.el
+
+$(PKG)-autoloads.el: $(ELS)
+ @printf "Generating $@\n"
+ @printf "%s" "$$LOADDEFS_TMPL" > $@
+ @$(CASK) exec $(EMACS) -Q --batch -l autoload.el --eval "(progn\
+ (fset 'message (lambda (&rest _)))\
+ (setq make-backup-files nil)\
+ (setq vc-handled-backends nil)\
+ (setq default-directory (file-truename default-directory))\
+ (setq generated-autoload-file (expand-file-name \"$@\"))\
+ (setq find-file-visit-truename t)\
+ (update-directory-autoloads default-directory))"
+
+build: version elpa autoloads
$(CASK) build
version:
@@ -35,31 +51,45 @@ version:
test: version build
$(CASK) exec buttercup -L . -L ./test/utils/
-autoloads:
- $(CASK) exec $(EMACS) -Q --batch \
- -l autoload.el \
- --eval "(let ((generated-autoload-file (expand-file-name \"cider-autoloads.el\"))) \
- (update-directory-autoloads (expand-file-name \".\")))"
-
lint: version elpa
$(CASK) exec $(EMACS) -Q --batch \
--eval "(setq enable-local-variables :safe)" \
-l elisp-lint.el -f elisp-lint-files-batch \
--no-package-format \
--no-fill-column \
- $(LINTELS)
+ $(ELS)
test-all: lint test
clean:
- rm -f .depend $(OBJECTS) cider-autoloads.el
+ rm -f .depend $(OBJECTS) $(PKG)-autoloads.el
elpaclean: clean
rm -f elpa*
rm -rf .cask # Clean packages installed for development
-run-cider: elpa
- cask exec $(EMACS) -Q -L . --eval "(require 'cider)"
+run-$(PKG): elpa
+ cask exec $(EMACS) -Q -L . --eval "(require '$(PKG))"
html:
mkdocs build
+
+## Templates #########################################################
+
+define LOADDEFS_TMPL
+;;; $(PKG)-autoloads.el --- automatically extracted autoloads
+;;
+;;; Code:
+(add-to-list 'load-path (directory-file-name \
+(or (file-name-directory #$$) (car load-path))))
+
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; End:
+;;; $(PKG)-autoloads.el ends here
+
+endef
+export LOADDEFS_TMPL
+#'
diff --git a/README.md b/README.md
index 36e7f9d..0b8173e 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,12 @@
+<p align="center">
+ <img src="https://raw.github.com/clojure-emacs/cider/master/logo/cider-logo-w640.png" alt="CIDER Logo"/>
+</p>
+
+-----------
[![License GPL 3][badge-license]](http://www.gnu.org/licenses/gpl-3.0.txt)
[![MELPA](http://melpa.org/packages/cider-badge.svg)](http://melpa.org/#/cider)
[![MELPA Stable](http://stable.melpa.org/packages/cider-badge.svg)](http://stable.melpa.org/#/cider)
[![Build Status](https://travis-ci.org/clojure-emacs/cider.png?branch=master)](https://travis-ci.org/clojure-emacs/cider)
-[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/clojure-emacs/cider?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-
-[![Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/bbatsov/donate)
-[![OpenCollective](https://opencollective.com/cider/backers/badge.svg)](#open-collective-backers)
-[![OpenCollective](https://opencollective.com/cider/sponsors/badge.svg)](#open-collective-sponsors)
-[![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
-[![Paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GRQKNBM6P8VRQ)
-
-<p align="center">
- <img src="https://raw.github.com/clojure-emacs/cider/master/logo/cider-logo-w640.png" alt="CIDER Logo"/>
-</p>
CIDER is the **C**lojure(Script) **I**nteractive **D**evelopment **E**nvironment
that **R**ocks!
@@ -24,13 +18,20 @@ features are centered around `cider-mode`, an Emacs minor-mode that complements
compilation, debugging, definition and documentation lookup, running tests and
so on.
+----------
+[![Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/bbatsov/donate)
+[![OpenCollective](https://opencollective.com/cider/backers/badge.svg)](#open-collective-backers)
+[![OpenCollective](https://opencollective.com/cider/sponsors/badge.svg)](#open-collective-sponsors)
+[![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
+[![Paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GRQKNBM6P8VRQ)
+
**Please consider [supporting financially its ongoing development](#funding).**
## Quickstart
The instructions that follow are meant to get you from zero to a running CIDER
REPL in under 5 minutes. See the
-[official manual](http://docs.cider.mx) for (way) more
+[official manual](https://docs.cider.mx) for (way) more
details.
### Installation
@@ -82,14 +83,15 @@ After you get your nREPL server running go back to Emacs. Typing there <kbd>M-x
`cider-connect` will allow you to connect to the running nREPL server.
In Clojure(Script) buffers the command `cider-connect` is bound to
-<kbd>C-c C-x (C-)c (C-)c</kbd>.
+<kbd>C-c C-x (C-)c (C-)j</kbd> and the command `cider-connect-cljs` is bound to
+<kbd>C-c C-x (C-)c (C-)s</kbd>.
## Diving Deeper
CIDER packs a ton of functionality and you really want to be familiar with it,
so you can fully empower your workflow. The best way to get acquainted with all
available features is to go over the entire
-[CIDER manual](http://docs.cider.mx/).
+[CIDER manual](https://docs.cider.mx/).
If you're into video lessons, you might also check out
this [intro to CIDER demo](https://www.youtube.com/watch?v=aYA4AAjLfT0) as well.
@@ -243,7 +245,7 @@ site. [[Become a sponsor](https://opencollective.com/cider#sponsor)]
## License
-Copyright © 2012-2018 Tim King, Phil Hagelberg, Bozhidar Batsov, Artur Malabarba and
+Copyright © 2012-2019 Tim King, Phil Hagelberg, Bozhidar Batsov, Artur Malabarba and
[contributors](https://github.com/clojure-emacs/cider/contributors).
Distributed under the GNU General Public License, version 3
diff --git a/cider-apropos.el b/cider-apropos.el
index 97be9aa..6c0ca5d 100644
--- a/cider-apropos.el
+++ b/cider-apropos.el
@@ -1,6 +1,6 @@
;;; cider-apropos.el --- Apropos functionality for Clojure -*- lexical-binding: t -*-
-;; Copyright © 2014-2018 Jeff Valk, Bozhidar Batsov and CIDER contributors
+;; Copyright © 2014-2019 Jeff Valk, Bozhidar Batsov and CIDER contributors
;;
;; Author: Jeff Valk <jv@jeffvalk.com>
diff --git a/cider-browse-ns.el b/cider-browse-ns.el
index 6f73535..8b983ab 100644
--- a/cider-browse-ns.el
+++ b/cider-browse-ns.el
@@ -1,6 +1,6 @@
;;; cider-browse-ns.el --- CIDER namespace browser
-;; Copyright © 2014-2018 John Andrews, Bozhidar Batsov and CIDER contributors
+;; Copyright © 2014-2019 John Andrews, Bozhidar Batsov and CIDER contributors
;; Author: John Andrews <john.m.andrews@gmail.com>
diff --git a/cider-cheatsheet.el b/cider-cheatsheet.el
index d870c5a..20c61e7 100644
--- a/cider-cheatsheet.el
+++ b/cider-cheatsheet.el
@@ -1,6 +1,6 @@
;;; cider-cheatsheet.el --- Quick reference for Clojure -*- lexical-binding: t -*-
-;; Copyright © 2018 Kris Jenkins, Bozhidar Batsov and CIDER contributors
+;; Copyright © 2019 Kris Jenkins, Bozhidar Batsov and CIDER contributors
;;
;; Author: Kris Jenkins <krisajenkins@gmail.com>
diff --git a/cider-classpath.el b/cider-classpath.el
index 1014137..b40a3ce 100644
--- a/cider-classpath.el
+++ b/cider-classpath.el
@@ -1,6 +1,6 @@
;;; cider-classpath.el --- Basic Java classpath browser
-;; Copyright © 2014-2018 Bozhidar Batsov and CIDER contributors
+;; Copyright © 2014-2019 Bozhidar Batsov and CIDER contributors
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
diff --git a/cider-client.el b/cider-client.el
index 1e09bae..9912ac2 100644
--- a/cider-client.el
+++ b/cider-client.el
@@ -1,6 +1,6 @@
;;; cider-client.el --- A layer of abstraction above low-level nREPL client code. -*- lexical-binding: t -*-
-;; Copyright © 2013-2018 Bozhidar Batsov
+;; Copyright © 2013-2019 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
@@ -145,7 +145,7 @@ to the file backing the current buffer. The command falls back to
"Check for support of middleware op OP.
Signal an error if it is not supported."
(unless (cider-nrepl-op-supported-p op)
- (user-error "`%s' requires the nREPL op \"%s\". Please, install (or update) cider-nrepl %s and restart CIDER" this-command op (upcase cider-version))))
+ (user-error "`%s' requires the nREPL op \"%s\" (provided by cider-nrepl)" this-command op)))
(defun cider-nrepl-send-request (request callback &optional connection)
"Send REQUEST and register response handler CALLBACK.
@@ -153,7 +153,7 @@ REQUEST is a pair list of the form (\"op\" \"operation\" \"par1-name\"
\"par1\" ... ).
If CONNECTION is provided dispatch to that connection instead of
the current connection. Return the id of the sent message."
- (nrepl-send-request request callback (or connection (cider-current-repl))))
+ (nrepl-send-request request callback (or connection (cider-current-repl 'any))))
(defun cider-nrepl-send-sync-request (request &optional connection abort-on-input)
"Send REQUEST to the nREPL server synchronously using CONNECTION.
@@ -163,13 +163,13 @@ If ABORT-ON-INPUT is non-nil, the function will return nil
at the first sign of user input, so as not to hang the
interface."
(nrepl-send-sync-request request
- (or connection (cider-current-repl))
+ (or connection (cider-current-repl 'any))
abort-on-input))
(defun cider-nrepl-send-unhandled-request (request &optional connection)
"Send REQUEST to the nREPL CONNECTION and ignore any responses.
Immediately mark the REQUEST as done. Return the id of the sent message."
- (let* ((conn (or connection (cider-current-repl)))
+ (let* ((conn (or connection (cider-current-repl 'any)))
(id (nrepl-send-request request #'ignore conn)))
(with-current-buffer conn
(nrepl--mark-id-completed id))
diff --git a/cider-common.el b/cider-common.el
index 3bae267..e17ac7a 100644
--- a/cider-common.el
+++ b/cider-common.el
@@ -1,6 +1,6 @@
;;; cider-common.el --- Common use functions -*- lexical-binding: t; -*-
-;; Copyright © 2015-2018 Artur Malabarba
+;; Copyright © 2015-2019 Artur Malabarba
;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
@@ -286,10 +286,13 @@ If no local or remote file exists, return nil."
(defun cider-find-file (url)
"Return a buffer visiting the file URL if it exists, or nil otherwise.
If URL has a scheme prefix, it must represent a fully-qualified file path
-or an entry within a zip/jar archive. If URL doesn't contain a scheme
-prefix and is an absolute path, it is treated as such. Finally, if URL is
-relative, it is expanded within each of the open Clojure buffers till an
-existing file ending with URL has been found."
+or an entry within a zip/jar archive. If AVFS (archive virtual file
+system; see online docs) is mounted the archive entry is opened inside the
+AVFS directory, otherwise the entry is archived into a temporary read-only
+buffer. If URL doesn't contain a scheme prefix and is an absolute path, it
+is treated as such. Finally, if URL is relative, it is expanded within each
+of the open Clojure buffers till an existing file ending with URL has been
+found."
(require 'arc-mode)
(cond ((string-match "^file:\\(.+\\)" url)
(when-let* ((file (cider--url-to-file (match-string 1 url)))
@@ -297,42 +300,39 @@ existing file ending with URL has been found."
(find-file-noselect path)))
((string-match "^\\(jar\\|zip\\):\\(file:.+\\)!/\\(.+\\)" url)
(when-let* ((entry (match-string 3 url))
- (file (cider--url-to-file (match-string 2 url)))
- (path (cider--file-path file))
- ;; It is used for targeting useless intermediate buffer.
- ;; That buffer is made by (find-file path) below.
- ;; It has the name which is the last part of the path.
- (trash (replace-regexp-in-string "^/.+/" "" path))
- (name (format "%s:%s" path entry)))
- (or (find-buffer-visiting name)
- (if (tramp-tramp-file-p path)
- (progn
- ;; Use emacs built in archiving.
- ;; This makes a list of files in archived Zip or Jar.
- ;; That list buffer is useless after jumping to the
- ;; buffer which has the real definition.
- ;; It'll be removed by (kill-buffer trash) below.
- (find-file path)
- (goto-char (point-min))
- ;; Make sure the file path is followed by a newline to
- ;; prevent eg. clj matching cljs.
- (search-forward (concat entry "\n"))
- ;; moves up to matching line
- (forward-line -1)
- (archive-extract)
- ;; Remove useless buffer made by (find-file path) above.
- (kill-buffer trash)
- (current-buffer))
- ;; Use external zip program to just extract the single file
- (with-current-buffer (generate-new-buffer
- (file-name-nondirectory entry))
- (archive-zip-extract path entry)
- (set-visited-file-name name)
- (setq-local default-directory (file-name-directory path))
- (setq-local buffer-read-only t)
- (set-buffer-modified-p nil)
- (set-auto-mode)
- (current-buffer))))))
+ (file (cider--url-to-file (match-string 2 url)))
+ (path (cider--file-path file))
+ (name (format "%s:%s" path entry))
+ (avfs (format "%s%s#uzip/%s"
+ (expand-file-name (or (getenv "AVFSBASE") "~/.avfs/"))
+ path entry)))
+ (cond
+ ;; 1) use avfs
+ ((file-exists-p avfs)
+ (find-file-noselect avfs))
+ ;; 2) already uncompressed
+ ((find-buffer-visiting name))
+ ;; 3) on remotes use Emacs built-in archiving
+ ((tramp-tramp-file-p path)
+ (find-file path)
+ (goto-char (point-min))
+ ;; anchor to eol to prevent eg. clj matching cljs.
+ (re-search-forward (concat entry "$"))
+ (let ((archive-buffer (current-buffer)))
+ (archive-extract)
+ (kill-buffer archive-buffer))
+ (current-buffer))
+ ;; 4) Use external zip program to extract a single file
+ (t
+ (with-current-buffer (generate-new-buffer
+ (file-name-nondirectory entry))
+ (archive-zip-extract path entry)
+ (set-visited-file-name name)
+ (setq-local default-directory (file-name-directory path))
+ (setq-local buffer-read-only t)
+ (set-buffer-modified-p nil)
+ (set-auto-mode)
+ (current-buffer))))))
(t (if-let* ((path (cider--file-path url)))
(find-file-noselect path)
(unless (file-name-absolute-p url)
diff --git a/cider-compat.el b/cider-compat.el
index e6b64b2..dfd2561 100644
--- a/cider-compat.el
+++ b/cider-compat.el
@@ -1,7 +1,7 @@
;;; cider-compat.el --- Functions from newer Emacs versions for compatibility -*- lexical-binding: t -*-
;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; This program is free software: you can redistribute it and/or modify
diff --git a/cider-completion.el b/cider-completion.el
index c52769e..d4be0a7 100644
--- a/cider-completion.el
+++ b/cider-completion.el
@@ -1,6 +1,6 @@
;;; cider-completion.el --- Smart REPL-powered code completion -*- lexical-binding: t -*-
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; Artur Malabarba <bruce.connor.am@gmail.com>
diff --git a/cider-connection.el b/cider-connection.el
index 959b78e..0a727fd 100644
--- a/cider-connection.el
+++ b/cider-connection.el
@@ -1,6 +1,6 @@
;;; cider-connection.el --- Connection and session life-cycle management for CIDER -*- lexical-binding: t -*-
;;
-;; Copyright © 2018 Artur Malabarba, Bozhidar Batsov, Vitalie Spinu and CIDER contributors
+;; Copyright © 2019 Artur Malabarba, Bozhidar Batsov, Vitalie Spinu and CIDER contributors
;;
;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
@@ -156,7 +156,7 @@ buffer."
;; inform sentinel not to kill the server, if any
(thread-first (get-buffer-process repl)
(process-plist)
- (plist-put :no-server-kill t))))
+ (plist-put :keep-server t))))
(let ((proc (get-buffer-process repl)))
(when (and (process-live-p proc)
(or (not nrepl-server-buffer)
@@ -167,11 +167,7 @@ buffer."
(when-let* ((messages-buffer (and nrepl-log-messages
(nrepl-messages-buffer repl))))
(kill-buffer messages-buffer))
- (if no-kill
- (with-current-buffer repl
- (goto-char (point-max))
- (cider-repl-emit-interactive-stderr
- (format "*** Closed on %s ***\n" (current-time-string))))
+ (unless no-kill
(kill-buffer repl)))
(when repl
(sesman-remove-object 'CIDER nil repl (not no-kill) t)))
@@ -328,7 +324,7 @@ Clojure version. When GENERICP is non-nil, don't provide specific info
about this buffer (like variable `cider-repl-type')."
(with-current-buffer connection-buffer
(format "%s%s@%s:%s (Java %s, Clojure %s, nREPL %s)"
- (if genericp "" (upcase (concat cider-repl-type " ")))
+ (if genericp "" (upcase (concat (symbol-name cider-repl-type) " ")))
(or (cider--project-name nrepl-project-dir) "<no project>")
(plist-get nrepl-endpoint :host)
(plist-get nrepl-endpoint :port)
@@ -421,6 +417,32 @@ REPL defaults to the current REPL."
(cl-defmethod sesman-more-relevant-p ((_system (eql CIDER)) session1 session2)
(sesman-more-recent-p (cdr session1) (cdr session2)))
+(cl-defmethod sesman-friendly-session-p ((_system (eql CIDER)) session)
+ (setcdr session (seq-filter #'buffer-live-p (cdr session)))
+ (when-let* ((repl (cadr session))
+ (proc (get-buffer-process repl))
+ (file (file-truename (or (buffer-file-name) default-directory))))
+ ;; With avfs paths look like /path/to/.avfs/path/to/some.jar#uzip/path/to/file.clj
+ (when (string-match-p "#uzip" file)
+ (let ((avfs-path (directory-file-name (expand-file-name (or (getenv "AVFSBASE") "~/.avfs/")))))
+ (setq file (replace-regexp-in-string avfs-path "" file t t))))
+ (when (process-live-p proc)
+ (let* ((classpath (or (process-get proc :cached-classpath)
+ (let ((cp (with-current-buffer repl
+ (cider-sync-request:classpath))))
+ (process-put proc :cached-classpath cp)
+ cp)))
+ (classpath-roots (or (process-get proc :cached-classpath-roots)
+ (let ((cp (thread-last classpath
+ (seq-filter (lambda (path) (not (string-match-p "\\.jar$" path))))
+ (mapcar #'file-name-directory))))
+ (process-put proc :cached-classpath-roots cp)
+ cp))))
+ (or (seq-find (lambda (path) (string-prefix-p path file))
+ classpath)
+ (seq-find (lambda (path) (string-prefix-p path file))
+ classpath-roots))))))
+
(defvar cider-sesman-browser-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "j q") #'cider-quit)
@@ -532,7 +554,7 @@ removed."
""
host))
(repl-type (or (plist-get params :repl-type) "unknown"))
- (cljs-repl-type (or (and (equal repl-type "cljs")
+ (cljs-repl-type (or (and (eq repl-type 'cljs)
(plist-get params :cljs-repl-type))
""))
(specs `((?h . ,host)
@@ -567,10 +589,10 @@ Session name can be customized with `cider-session-name-template'."
;;; REPL Buffer Init
(defvar-local cider-cljs-repl-type nil
- "The type of the CLJS runtime (Nashorn, Node etc.)")
+ "The type of the ClojureScript runtime (Nashorn, Node etc.)")
(defvar-local cider-repl-type nil
- "The type of this REPL buffer, usually either \"clj\" or \"cljs\".")
+ "The type of this REPL buffer, usually either clj or cljs.")
(defun cider-repl-type (repl-buffer)
"Get REPL-BUFFER's type."
@@ -579,23 +601,23 @@ Session name can be customized with `cider-session-name-template'."
(defun cider-repl-type-for-buffer (&optional buffer)
"Return the matching connection type (clj or cljs) for BUFFER.
BUFFER defaults to the `current-buffer'. In cljc buffers return
-\"multi\". This function infers connection type based on the major mode.
+multi. This function infers connection type based on the major mode.
For the REPL type use the function `cider-repl-type'."
(with-current-buffer (or buffer (current-buffer))
(cond
- ((derived-mode-p 'clojurescript-mode) "cljs")
- ((derived-mode-p 'clojurec-mode) "multi")
- ((derived-mode-p 'clojure-mode) "clj")
+ ((derived-mode-p 'clojurescript-mode) 'cljs)
+ ((derived-mode-p 'clojurec-mode) 'multi)
+ ((derived-mode-p 'clojure-mode) 'clj)
(cider-repl-type))))
(defun cider-set-repl-type (&optional type)
- "Set REPL TYPE to \"clj\" or \"cljs\".
+ "Set REPL TYPE to clj or cljs.
Assume that the current buffer is a REPL."
(interactive)
- (let ((type (or type (completing-read
- (format "Set REPL type (currently `%s') to: "
- cider-repl-type)
- '("clj" "cljs")))))
+ (let ((type (cider-maybe-intern (or type (completing-read
+ (format "Set REPL type (currently `%s') to: "
+ cider-repl-type)
+ '(clj cljs))))))
(when (or (not (equal cider-repl-type type))
(null mode-name))
(setq cider-repl-type type)
@@ -609,6 +631,41 @@ Assume that the current buffer is a REPL."
(with-current-buffer nrepl-messages-buffer
(rename-buffer (nrepl-messages-buffer-name params))))))))
+(defun cider--choose-reusable-repl-buffer (params)
+ "Find connection-less REPL buffer and ask the user for confirmation.
+Return nil if no such buffers exists or the user has chosen not to reuse
+the buffer. If multiple dead REPLs exist, ask the user to choose one.
+PARAMS is a plist as received by `cider-repl-create'."
+ (when-let* ((repls (seq-filter (lambda (b)
+ (with-current-buffer b
+ (and (derived-mode-p 'cider-repl-mode)
+ (not (process-live-p (get-buffer-process b))))))
+ (buffer-list))))
+ (let* ((proj-dir (plist-get params :project-dir))
+ (host (plist-get params :host))
+ (port (plist-get params :port))
+ (cljsp (member (plist-get params :repl-type) '(cljs pending-cljs)))
+ (scored-repls
+ (delq nil
+ (mapcar (lambda (b)
+ (let ((bparams (cider--gather-connect-params nil b)))
+ (when (eq cljsp (member (plist-get bparams :repl-type)
+ '(cljs pending-cljs)))
+ (cons (buffer-name b)
+ (+
+ (if (equal proj-dir (plist-get bparams :project-dir)) 8 0)
+ (if (equal host (plist-get bparams :host)) 4 0)
+ (if (equal port (plist-get bparams :port)) 2 0))))))
+ repls))))
+ (when scored-repls
+ (if (> (length scored-repls) 1)
+ (when (y-or-n-p "Dead REPLs exist. Reuse? ")
+ (let ((sorted-repls (seq-sort (lambda (a b) (> (cdr a) (cdr b))) scored-repls)))
+ (get-buffer (completing-read "REPL to reuse: "
+ (mapcar #'car sorted-repls) nil t nil nil (caar sorted-repls)))))
+ (when (y-or-n-p (format "A dead REPL %s exists. Reuse? " (caar scored-repls)))
+ (get-buffer (caar scored-repls))))))))
+
(declare-function cider-default-err-handler "cider-eval")
(declare-function cider-repl-mode "cider-repl")
(declare-function cider-repl--state-handler "cider-repl")
@@ -624,6 +681,7 @@ function with the repl buffer set as current."
;; Connection might not have been set as yet. Please don't send requests in
;; this function, but use cider--connected-handler instead.
(let ((buffer (or (plist-get params :repl-buffer)
+ (cider--choose-reusable-repl-buffer params)
(get-buffer-create (generate-new-buffer-name "*cider-uninitialized-repl*"))))
(ses-name (or (plist-get params :session-name)
(cider-make-session-name params))))
@@ -645,8 +703,8 @@ function with the repl buffer set as current."
cider-repl-init-function (plist-get params :repl-init-function))
(cider-repl-reset-markers)
(add-hook 'nrepl-response-handler-functions #'cider-repl--state-handler nil 'local)
- (add-hook 'nrepl-connected-hook 'cider--connected-handler nil 'local)
- (add-hook 'nrepl-disconnected-hook 'cider--disconnected-handler nil 'local)
+ (add-hook 'nrepl-connected-hook #'cider--connected-handler nil 'local)
+ (add-hook 'nrepl-disconnected-hook #'cider--disconnected-handler nil 'local)
(current-buffer))))
@@ -655,7 +713,7 @@ function with the repl buffer set as current."
(defun cider--no-repls-user-error (type)
"Throw \"No REPL\" user error customized for TYPE."
(let ((type (cond
- ((equal type "multi")
+ ((or (eq type 'multi) (eq type 'any))
"clj or cljs")
((listp type)
(mapconcat #'identity type " or "))
@@ -665,41 +723,47 @@ function with the repl buffer set as current."
(defun cider-current-repl (&optional type ensure)
"Get the most recent REPL of TYPE from the current session.
-TYPE is either \"clj\", \"cljs\" or \"multi\". When nil, infer the type
-from the current buffer. If ENSURE is non-nil, throw an error if either
-there is no linked session or there is no REPL of TYPE within the current
-session."
- (if (and (derived-mode-p 'cider-repl-mode)
- (or (null type)
- (string= cider-repl-type type)))
- ;; shortcut when in REPL buffer
- (current-buffer)
- (let* ((type (or type (cider-repl-type-for-buffer)))
- (repls (cider-repls type ensure))
- (repl (if (<= (length repls) 1)
- (car repls)
- ;; pick the most recent one
- (seq-find (lambda (b)
- (member b repls))
- (buffer-list)))))
- (if (and ensure (null repl))
- (cider--no-repls-user-error type)
- repl))))
+TYPE is either clj, cljs, multi or any.
+When nil, infer the type from the current buffer.
+If ENSURE is non-nil, throw an error if either there is
+no linked session or there is no REPL of TYPE within the current session."
+ (let ((type (cider-maybe-intern type)))
+ (if (and (derived-mode-p 'cider-repl-mode)
+ (or (null type)
+ (eq 'any type)
+ (eq cider-repl-type type)))
+ ;; shortcut when in REPL buffer
+ (current-buffer)
+ (let* ((type (or type (cider-repl-type-for-buffer)))
+ (repls (cider-repls type ensure))
+ (repl (if (<= (length repls) 1)
+ (car repls)
+ ;; pick the most recent one
+ (seq-find (lambda (b)
+ (member b repls))
+ (buffer-list)))))
+ (if (and ensure (null repl))
+ (cider--no-repls-user-error type)
+ repl)))))
(defun cider--match-repl-type (type buffer)
"Return non-nil if TYPE matches BUFFER's REPL type."
(let ((buffer-repl-type (cider-repl-type buffer)))
(cond ((null buffer-repl-type) nil)
- ((or (null type) (equal type "multi")) t)
+ ((or (null type) (eq type 'multi) (eq type 'any)) t)
((listp type) (member buffer-repl-type type))
(t (string= type buffer-repl-type)))))
(defun cider-repls (&optional type ensure)
"Return cider REPLs of TYPE from the current session.
-If TYPE is nil or \"multi\", return all repls. If TYPE is a list of types,
+If TYPE is nil or multi, return all repls. If TYPE is a list of types,
return only REPLs of type contained in the list. If ENSURE is non-nil,
throw an error if no linked session exists."
- (let ((repls (cdr (if ensure
+ (let ((type (cond
+ ((listp type)
+ (mapcar #'cider-maybe-intern type))
+ ((cider-maybe-intern type))))
+ (repls (cdr (if ensure
(sesman-ensure-session 'CIDER)
(sesman-current-session 'CIDER)))))
(or (seq-filter (lambda (b)
@@ -724,15 +788,15 @@ session."
(declare (indent 1))
(let ((cur-type (cider-repl-type-for-buffer)))
(cl-case which
- (:clj-strict (when (equal cur-type "cljs")
+ (:clj-strict (when (eq cur-type 'cljs)
(user-error "Clojure-only operation requested in a ClojureScript buffer")))
- (:cljs-strict (when (equal cur-type "clj")
+ (:cljs-strict (when (eq cur-type 'clj)
(user-error "ClojureScript-only operation requested in a Clojure buffer"))))
(let* ((type (cl-case which
- ((:clj :clj-strict) "clj")
- ((:cljs :cljs-strict) "cljs")
- (:auto (if (equal cur-type "multi")
- '("clj" "cljs")
+ ((:clj :clj-strict) 'clj)
+ ((:cljs :cljs-strict) 'cljs)
+ (:auto (if (eq cur-type 'multi)
+ '(clj cljs)
cur-type))))
(repls (cider-repls type 'ensure)))
(mapcar function repls))))
@@ -764,11 +828,11 @@ session."
(make-obsolete 'cider-current-messages-buffer nil "0.18")
(make-obsolete 'cider-default-connection "see sesman." "0.18")
(make-obsolete 'cider-extract-designation-from-current-repl-buffer nil "0.18")
-(make-obsolete 'cider-find-connection-buffer-for-project-directory 'sesman-linked-sessions "0.18")
+(make-obsolete 'cider-find-connection-buffer-for-project-directory 'sesman-current-sessions "0.18")
(make-obsolete 'cider-find-reusable-repl-buffer nil "0.18")
(make-obsolete 'cider-make-connection-default "see sesman." "0.18")
(make-obsolete 'cider-other-connection nil "0.18")
-(make-obsolete 'cider-project-connections 'sesman-linked-sessions "0.18")
+(make-obsolete 'cider-project-connections 'sesman-current-sessions "0.18")
(make-obsolete 'cider-project-connections-types nil "0.18")
(make-obsolete 'cider-prompt-for-project-on-connect nil "0.18")
(make-obsolete 'cider-read-connection `sesman-ask-for-session "0.18")
diff --git a/cider-debug.el b/cider-debug.el
index 7ea5b87..6d34056 100644
--- a/cider-debug.el
+++ b/cider-debug.el
@@ -1,6 +1,6 @@
;;; cider-debug.el --- CIDER interaction with the cider.debug nREPL middleware -*- lexical-binding: t; -*-
-;; Copyright © 2015-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2015-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
@@ -292,7 +292,7 @@ of `cider-interactive-eval' in debug sessions."
(defvar cider--debug-mode-tool-bar-map
(let ((tool-bar-map (make-sparse-keymap)))
(tool-bar-add-item "right-arrow" #'cider-debug-mode-send-reply :next :label "Next step")
- (tool-bar-add-item "next-node" #'cider-debug-mode-send-reply :continue :label "Continue non-stop")
+ (tool-bar-add-item "next-node" #'cider-debug-mode-send-reply :continue :label "Continue")
(tool-bar-add-item "jump-to" #'cider-debug-mode-send-reply :out :label "Out of sexp")
(tool-bar-add-item "exit" #'cider-debug-mode-send-reply :quit :label "Quit")
tool-bar-map))
@@ -377,7 +377,8 @@ In order to work properly, this mode must be activated by
"Menu for CIDER debug mode"
`("CIDER Debugger"
["Next step" (cider-debug-mode-send-reply ":next") :keys "n"]
- ["Continue non-stop" (cider-debug-mode-send-reply ":continue") :keys "c"]
+ ["Continue" (cider-debug-mode-send-reply ":continue") :keys "c"]
+ ["Continue non-stop" (cider-debug-mode-send-reply ":Continue") :keys "C"]
["Move out of sexp" (cider-debug-mode-send-reply ":out") :keys "o"]
["Quit" (cider-debug-mode-send-reply ":quit") :keys "q"]
"--"
@@ -411,7 +412,7 @@ message."
(symbol-name last-command-event)
(ignore-errors
(concat ":" (nrepl-dict-get cider--debug-mode-commands-dict
- (downcase (string last-command-event))))))
+ (string last-command-event)))))
nil
(cider--uppercase-command-p)))
(when (and (string-prefix-p ":" command) force)
diff --git a/cider-doc.el b/cider-doc.el
index 5cca050..df3e97d 100644
--- a/cider-doc.el
+++ b/cider-doc.el
@@ -1,6 +1,6 @@
;;; cider-doc.el --- CIDER documentation functionality -*- lexical-binding: t -*-
-;; Copyright © 2014-2018 Bozhidar Batsov, Jeff Valk and CIDER contributors
+;; Copyright © 2014-2019 Bozhidar Batsov, Jeff Valk and CIDER contributors
;; Author: Jeff Valk <jv@jeffvalk.com>
diff --git a/cider-eldoc.el b/cider-eldoc.el
index b055824..c8c0e96 100644
--- a/cider-eldoc.el
+++ b/cider-eldoc.el
@@ -1,7 +1,7 @@
;;; cider-eldoc.el --- eldoc support for Clojure -*- lexical-binding: t -*-
;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
diff --git a/cider-eval.el b/cider-eval.el
index 67f2706..946d55e 100644
--- a/cider-eval.el
+++ b/cider-eval.el
@@ -1,7 +1,7 @@
;;; cider-eval.el --- Interactive evaluation (compilation) functionality -*- lexical-binding: t -*-
;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
@@ -168,7 +168,8 @@ When invoked with a prefix ARG the command doesn't prompt for confirmation."
(defun cider--quit-error-window ()
"Buries the `cider-error-buffer' and quits its containing window."
(when-let* ((error-win (get-buffer-window cider-error-buffer)))
- (quit-window nil error-win)))
+ (save-excursion
+ (quit-window nil error-win))))
;;; Dealing with compilation (evaluation) errors and warnings
@@ -377,7 +378,8 @@ evaluation command. Honor `cider-auto-jump-to-error'."
(let* ((face (nth 3 info))
(note (nth 4 info))
(auto-jump (if (eq cider-auto-jump-to-error 'errors-only)
- (not (eq face 'cider-warning-highlight-face))
+ (not (or (eq face 'cider-warning-highlight-face)
+ (string-match-p "warning" note)))
cider-auto-jump-to-error)))
(overlay-put overlay 'cider-note-p t)
(overlay-put overlay 'font-lock-face face)
diff --git a/cider-find.el b/cider-find.el
index dc49dda..e1a90cd 100644
--- a/cider-find.el
+++ b/cider-find.el
@@ -1,6 +1,6 @@
;;; cider-find.el --- Functionality for finding things -*- lexical-binding: t -*-
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; Artur Malabarba <bruce.connor.am@gmail.com>
diff --git a/cider-format.el b/cider-format.el
index 0aa9e8f..2cf9d09 100644
--- a/cider-format.el
+++ b/cider-format.el
@@ -1,6 +1,6 @@
;;; cider-format.el --- Code and EDN formatting functionality -*- lexical-binding: t -*-
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; Artur Malabarba <bruce.connor.am@gmail.com>
@@ -68,6 +68,7 @@ Uses the following heuristic to try to maintain point position:
(endp (> (+ pos l) pos-max))
(snippet (thread-last (buffer-substring-no-properties
pos (min (+ pos l) pos-max))
+ (regexp-quote)
(replace-regexp-in-string "[[:space:]\t\n\r]+" "[[:space:]\t\n\r]*"))))
(delete-region start end)
(insert indented)
@@ -92,9 +93,8 @@ START and END represent the region's boundaries."
"Format the code in the current defun."
(interactive)
(cider-ensure-connected)
- (save-excursion
- (mark-defun)
- (cider-format-region (region-beginning) (region-end))))
+ (let ((defun-bounds (cider-defun-at-point 't)))
+ (cider-format-region (car defun-bounds) (cadr defun-bounds))))
;;; Format buffer
diff --git a/cider-grimoire.el b/cider-grimoire.el
index c07614b..9342488 100644
--- a/cider-grimoire.el
+++ b/cider-grimoire.el
@@ -1,6 +1,6 @@
;;; cider-grimoire.el --- Grimoire integration -*- lexical-binding: t -*-
-;; Copyright © 2014-2018 Bozhidar Batsov and CIDER contributors
+;; Copyright © 2014-2019 Bozhidar Batsov and CIDER contributors
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/cider-inspector.el b/cider-inspector.el
index 61d5007..b1eddff 100644
--- a/cider-inspector.el
+++ b/cider-inspector.el
@@ -1,7 +1,7 @@
;;; cider-inspector.el --- Object inspector -*- lexical-binding: t -*-
-;; Copyright © 2013-2018 Vital Reactor, LLC
-;; Copyright © 2014-2018 Bozhidar Batsov and CIDER contributors
+;; Copyright © 2013-2019 Vital Reactor, LLC
+;; Copyright © 2014-2019 Bozhidar Batsov and CIDER contributors
;; Author: Ian Eslick <ian@vitalreactor.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
@@ -85,8 +85,7 @@ The page size can be also changed interactively within the inspector."
(set-syntax-table clojure-mode-syntax-table)
(setq-local electric-indent-chars nil)
(setq-local sesman-system 'CIDER)
- (when cider-special-mode-truncate-lines
- (setq-local truncate-lines t)))
+ (visual-line-mode 1))
;;;###autoload
(defun cider-inspect-last-sexp ()
@@ -134,6 +133,11 @@ This is used as an alternative to the built-in `last-command'. Whenever we
invoke any command through \\[execute-extended-command] and its variants,
the value of `last-command' is not set to the command it invokes.")
+(defvar cider-inspector--current-repl nil
+ "Contains the reference to the REPL where inspector was last invoked from.
+This is needed for internal inspector buffer operations (push,
+pop) to execute against the correct REPL session.")
+
;; Operations
;;;###autoload
(defun cider-inspect-expr (expr ns)
@@ -142,6 +146,7 @@ Interactively, EXPR is read from the minibuffer, and NS the
current buffer's namespace."
(interactive (list (cider-read-from-minibuffer "Inspect expression: " (cider-sexp-at-point))
(cider-current-ns)))
+ (setq cider-inspector--current-repl (cider-current-repl))
(when-let* ((value (cider-sync-request:inspect-expr expr ns (or cider-inspector-page-size 32))))
(cider-inspector--render-value value)))
@@ -197,39 +202,39 @@ Current page will be reset to zero."
(defun cider-sync-request:inspect-pop ()
"Move one level up in the inspector stack."
(thread-first '("op" "inspect-pop")
- (cider-nrepl-send-sync-request)
+ (cider-nrepl-send-sync-request cider-inspector--current-repl)
(nrepl-dict-get "value")))
(defun cider-sync-request:inspect-push (idx)
"Inspect the inside value specified by IDX."
(thread-first `("op" "inspect-push"
"idx" ,idx)
- (cider-nrepl-send-sync-request)
+ (cider-nrepl-send-sync-request cider-inspector--current-repl)
(nrepl-dict-get "value")))
(defun cider-sync-request:inspect-refresh ()
"Re-render the currently inspected value."
(thread-first '("op" "inspect-refresh")
- (cider-nrepl-send-sync-request)
+ (cider-nrepl-send-sync-request cider-inspector--current-repl)
(nrepl-dict-get "value")))
(defun cider-sync-request:inspect-next-page ()
"Jump to the next page in paginated collection view."
(thread-first '("op" "inspect-next-page")
- (cider-nrepl-send-sync-request)
+ (cider-nrepl-send-sync-request cider-inspector--current-repl)
(nrepl-dict-get "value")))
(defun cider-sync-request:inspect-prev-page ()
"Jump to the previous page in paginated collection view."
(thread-first '("op" "inspect-prev-page")
- (cider-nrepl-send-sync-request)
+ (cider-nrepl-send-sync-request cider-inspector--current-repl)
(nrepl-dict-get "value")))
(defun cider-sync-request:inspect-set-page-size (page-size)
"Set the page size in paginated view to PAGE-SIZE."
(thread-first `("op" "inspect-set-page-size"
"page-size" ,page-size)
- (cider-nrepl-send-sync-request)
+ (cider-nrepl-send-sync-request cider-inspector--current-repl)
(nrepl-dict-get "value")))
(defun cider-sync-request:inspect-expr (expr ns page-size)
@@ -238,7 +243,7 @@ Set the page size in paginated view to PAGE-SIZE."
(thread-first (append (nrepl--eval-request expr ns)
`("inspect" "true"
"page-size" ,page-size))
- (cider-nrepl-send-sync-request)
+ (cider-nrepl-send-sync-request cider-inspector--current-repl)
(nrepl-dict-get "value")))
;; Render Inspector from Structured Values
diff --git a/cider-macroexpansion.el b/cider-macroexpansion.el
index 8123932..7efe1c0 100644
--- a/cider-macroexpansion.el
+++ b/cider-macroexpansion.el
@@ -1,7 +1,7 @@
;;; cider-macroexpansion.el --- Macro expansion support -*- lexical-binding: t -*-
;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
diff --git a/cider-mode.el b/cider-mode.el
index 8258f05..8c5c4dd 100644
--- a/cider-mode.el
+++ b/cider-mode.el
@@ -1,7 +1,7 @@
;;; cider-mode.el --- Minor mode for REPL interactions -*- lexical-binding: t -*-
;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
@@ -54,7 +54,7 @@ Info contains the connection type, project name and host:port endpoint."
(if-let* ((current-connection (ignore-errors (cider-current-repl))))
(with-current-buffer current-connection
(concat
- cider-repl-type
+ (symbol-name cider-repl-type)
(when cider-mode-line-show-connection
(format ":%s@%s:%s"
(or (cider--project-name nrepl-project-dir) "<no project>")
@@ -133,8 +133,8 @@ Clojure buffer and the REPL buffer."
(when-let* ((type (cider-repl-type-for-buffer b)))
(unless a-buf
(setq a-buf b))
- (or (equal type "multi")
- (equal type repl-type)))))
+ (or (eq type 'multi)
+ (eq type repl-type)))))
(buffer-list)))))
(if-let* ((buf (or the-buf a-buf)))
(if cider-repl-display-in-current-window
@@ -512,21 +512,23 @@ As it stands Emacs fires these events on <mouse-8> and <mouse-9> on 'x' and
;; loaded yet, this will be shown in Clojure buffers next to the "Clojure"
;; menu.
;;;###autoload
-(eval-after-load 'clojure-mode
- '(easy-menu-define cider-clojure-mode-menu-open clojure-mode-map
- "Menu for Clojure mode.
+(with-eval-after-load 'clojure-mode
+ (easy-menu-define cider-clojure-mode-menu-open clojure-mode-map
+ "Menu for Clojure mode.
This is displayed in `clojure-mode' buffers, if `cider-mode' is not active."
- `("CIDER" :visible (not cider-mode)
- ["Start a Clojure REPL" cider-jack-in
- :help "Starts an nREPL server (with Leiningen, Boot, or Gradle) and connects a REPL to it."]
- ["Connect to a Clojure REPL" cider-connect
- :help "Connects to a REPL that's already running."]
- ["Connect to a ClojureScript REPL" cider-connect-clojurescript
- :help "Connects to a ClojureScript REPL that's already running."]
- ["Start a Clojure REPL, and a ClojureScript REPL" cider-jack-in-cljs
- :help "Starts an nREPL server, connects a Clojure REPL to it, and then a ClojureScript REPL."]
- "--"
- ["View manual online" cider-view-manual])))
+ `("CIDER" :visible (not cider-mode)
+ ["Start a Clojure REPL" cider-jack-in-clj
+ :help "Starts an nREPL server and connects a Clojure REPL to it."]
+ ["Connect to a Clojure REPL" cider-connect-clj
+ :help "Connects to a REPL that's already running."]
+ ["Start a ClojureScript REPL" cider-jack-in-cljs
+ :help "Starts an nREPL server and connects a ClojureScript REPL to it."]
+ ["Connect to a ClojureScript REPL" cider-connect-cljs
+ :help "Connects to a ClojureScript REPL that's already running."]
+ ["Start a Clojure REPL, and a ClojureScript REPL" cider-jack-in-clj&cljs
+ :help "Starts an nREPL server, connects a Clojure REPL to it, and then a ClojureScript REPL."]
+ "--"
+ ["View manual online" cider-view-manual])))
;;; Dynamic indentation
(defcustom cider-dynamic-indentation t
@@ -571,9 +573,9 @@ variable to nil you'll still see basic syntax highlighting.
The value is a list of symbols, each one indicates a different type of var
that should be font-locked:
- `macro' (default): Any defined macro gets the `font-lock-builtin-face'.
+ `macro' (default): Any defined macro gets the `font-lock-keyword-face'.
`function': Any defined function gets the `font-lock-function-face'.
- `var': Any non-local var gets the `font-lock-variable-face'.
+ `var': Any non-local var gets the `font-lock-variable-name-face'.
`deprecated' (default): Any deprecated var gets the `cider-deprecated-face'
face.
`core' (default): Any symbol from clojure.core (face depends on type).
@@ -672,7 +674,10 @@ the LIMIT in `cider--anchored-search-suppressed-forms`"
An unused reader conditional expression is an expression for a platform
that does not match the CIDER connection for the buffer. Search is done
with the given LIMIT."
- (let ((repl-types (seq-uniq (seq-map #'cider-repl-type (cider-repls))))
+ (let ((repl-types (seq-uniq (seq-map
+ (lambda (repl)
+ (symbol-name (cider-repl-type repl)))
+ (cider-repls))))
(result 'retry))
(while (and (eq result 'retry) (<= (point) limit))
(condition-case condition
diff --git a/cider-ns.el b/cider-ns.el
index bcb843e..e89ed07 100644
--- a/cider-ns.el
+++ b/cider-ns.el
@@ -1,6 +1,6 @@
;;; cider-ns.el --- Namespace manipulation functionality -*- lexical-binding: t -*-
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; Artur Malabarba <bruce.connor.am@gmail.com>
diff --git a/cider-overlays.el b/cider-overlays.el
index 1a92b35..5be7f00 100644
--- a/cider-overlays.el
+++ b/cider-overlays.el
@@ -1,6 +1,6 @@
;;; cider-overlays.el --- Managing CIDER overlays -*- lexical-binding: t; -*-
-;; Copyright © 2015-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2015-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
diff --git a/cider-popup.el b/cider-popup.el
index 274a066..4f8fae4 100644
--- a/cider-popup.el
+++ b/cider-popup.el
@@ -1,6 +1,6 @@
;;; cider-popup.el --- Creating and quitting popup buffers -*- lexical-binding: t; -*-
-;; Copyright © 2015-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2015-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
diff --git a/cider-profile.el b/cider-profile.el
index 7957791..d4e9b40 100644
--- a/cider-profile.el
+++ b/cider-profile.el
@@ -1,6 +1,6 @@
;;; cider-profile.el --- CIDER support for profiling -*- lexical-binding: t; -*-
-;; Copyright © 2014-2018 Edwin Watkeys and CIDER contributors
+;; Copyright © 2014-2019 Edwin Watkeys and CIDER contributors
;; Author: Edwin Watkeys <edw@poseur.com>
;; Juan E. Maya <jmayaalv@gmail.com>
diff --git a/cider-repl.el b/cider-repl.el
index 14eaeb8..3adfb1d 100644
--- a/cider-repl.el
+++ b/cider-repl.el
@@ -1,7 +1,7 @@
;;; cider-repl.el --- CIDER REPL mode interactions -*- lexical-binding: t -*-
;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
@@ -315,22 +315,31 @@ client process connection. Unless NO-BANNER is non-nil, insert a banner."
(when cider-repl-display-in-current-window
(add-to-list 'same-window-buffer-names (buffer-name buffer)))
(pcase cider-repl-pop-to-buffer-on-connect
- (`display-only (display-buffer buffer))
+ (`display-only
+ (let ((orig-buffer (current-buffer)))
+ (display-buffer buffer)
+ ;; User popup-rules (specifically `:select nil') can cause the call to
+ ;; `display-buffer' to reset the current Emacs buffer to the clj/cljs
+ ;; buffer that the user ran `jack-in' from - we need the current-buffer
+ ;; to be the repl to initialize, so reset it back here to be resilient
+ ;; against user config
+ (set-buffer orig-buffer)))
((pred identity) (pop-to-buffer buffer)))
(cider-repl-set-initial-ns buffer)
(cider-repl-require-repl-utils)
(cider-repl-set-config)
(unless no-banner
(cider-repl--insert-banner-and-prompt buffer))
+ (with-current-buffer buffer
+ (set-window-point (get-buffer-window) (point-max)))
buffer)
(defun cider-repl--insert-banner-and-prompt (buffer)
"Insert REPL banner and REPL prompt in BUFFER."
(with-current-buffer buffer
- (when (zerop (buffer-size))
- (insert (propertize (cider-repl--banner) 'font-lock-face 'font-lock-comment-face))
- (when cider-repl-display-help-banner
- (insert (propertize (cider-repl--help-banner) 'font-lock-face 'font-lock-comment-face))))
+ (insert (propertize (cider-repl--banner) 'font-lock-face 'font-lock-comment-face))
+ (when cider-repl-display-help-banner
+ (insert (propertize (cider-repl--help-banner) 'font-lock-face 'font-lock-comment-face)))
(goto-char (point-max))
(cider-repl--mark-output-start)
(cider-repl--mark-input-start)
@@ -678,8 +687,7 @@ If BOL is non-nil insert at the beginning of line. Run
(defun cider-repl--emit-interactive-output (string face)
"Emit STRING as interactive output using FACE."
(with-current-buffer (cider-current-repl)
- (let ((pos (cider-repl--end-of-line-before-input-start))
- (string (replace-regexp-in-string "\n\\'" "" string)))
+ (let ((pos (cider-repl--end-of-output)))
(cider-repl--emit-output-at-pos (current-buffer) string face pos t))))
(defun cider-repl-emit-interactive-stdout (string)
@@ -1056,10 +1064,15 @@ See also the related commands `cider-repl-clear-output' and
(recenter t))
(run-hooks 'cider-repl-clear-buffer-hook))
-(defun cider-repl--end-of-line-before-input-start ()
- "Return the position of the end of the line preceding the beginning of input."
- (1- (previous-single-property-change cider-repl-input-start-mark 'field nil
- (1+ (point-min)))))
+(defun cider-repl--end-of-output ()
+ "Return the position at the end of the previous REPL output."
+ (if (eq (get-text-property (1- cider-repl-input-start-mark) 'field)
+ 'cider-repl-prompt)
+ ;; if after prompt, return eol before prompt
+ (previous-single-property-change cider-repl-input-start-mark
+ 'field nil (point-min))
+ ;; else, input mark because there is no prompt (yet)
+ cider-repl-input-start-mark))
(defun cider-repl-clear-output (&optional clear-repl)
"Delete the output inserted since the last input.
@@ -1072,7 +1085,7 @@ With a prefix argument CLEAR-REPL it will clear the entire REPL buffer instead."
(ignore-errors (forward-sexp))
(forward-line)
(point)))
- (end (cider-repl--end-of-line-before-input-start)))
+ (end (cider-repl--end-of-output)))
(when (< start end)
(let ((inhibit-read-only t))
(cider-repl--clear-region start end)
diff --git a/cider-resolve.el b/cider-resolve.el
index 3c2dc6f..7963c89 100644
--- a/cider-resolve.el
+++ b/cider-resolve.el
@@ -1,6 +1,6 @@
;;; cider-resolve.el --- Resolve clojure symbols according to current nREPL connection
-;; Copyright © 2015-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2015-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
@@ -107,7 +107,7 @@ This will be clojure.core or cljs.core depending on the return value of the
function `cider-repl-type'."
(when-let* ((repl (cider-current-repl)))
(with-current-buffer repl
- (cider-resolve--get-in (if (equal cider-repl-type "cljs")
+ (cider-resolve--get-in (if (eq cider-repl-type 'cljs)
"cljs.core"
"clojure.core")))))
diff --git a/cider-scratch.el b/cider-scratch.el
index f1c3e93..883f276 100644
--- a/cider-scratch.el
+++ b/cider-scratch.el
@@ -1,6 +1,6 @@
;;; cider-scratch.el --- *scratch* buffer for Clojure -*- lexical-binding: t -*-
-;; Copyright © 2014-2018 Bozhidar Batsov and CIDER contributors
+;; Copyright © 2014-2019 Bozhidar Batsov and CIDER contributors
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
diff --git a/cider-selector.el b/cider-selector.el
index a21032d..61d7aed 100644
--- a/cider-selector.el
+++ b/cider-selector.el
@@ -1,7 +1,7 @@
;;; cider-selector.el --- Buffer selection command inspired by SLIME's selector -*- lexical-binding: t -*-
;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
diff --git a/cider-stacktrace.el b/cider-stacktrace.el
index 321d4bb..813746e 100644
--- a/cider-stacktrace.el
+++ b/cider-stacktrace.el
@@ -1,6 +1,6 @@
;;; cider-stacktrace.el --- Stacktrace navigator -*- lexical-binding: t -*-
-;; Copyright © 2014-2018 Jeff Valk, Bozhidar Batsov and CIDER contributors
+;; Copyright © 2014-2019 Jeff Valk, Bozhidar Batsov and CIDER contributors
;; Author: Jeff Valk <jv@jeffvalk.com>
diff --git a/cider-test.el b/cider-test.el
index bce6b4c..5182b57 100644
--- a/cider-test.el
+++ b/cider-test.el
@@ -1,6 +1,6 @@
;;; cider-test.el --- Test result viewer -*- lexical-binding: t -*-
-;; Copyright © 2014-2018 Jeff Valk, Bozhidar Batsov and CIDER contributors
+;; Copyright © 2014-2019 Jeff Valk, Bozhidar Batsov and CIDER contributors
;; Author: Jeff Valk <jv@jeffvalk.com>
@@ -417,7 +417,7 @@ With the actual value, the outermost '(not ...)' s-expression is removed."
(cider-insert (capitalize type) type-face nil " in ")
(cider-insert var 'font-lock-function-name-face t)
(when context (cider-insert context 'font-lock-doc-face t))
- (when message (cider-insert message 'font-lock-doc-string-face t))
+ (when message (cider-insert message 'font-lock-string-face t))
(when expected
(insert-label "expected")
(insert-rect expected)
diff --git a/cider-tracing.el b/cider-tracing.el
index c00e7b7..c9821a2 100644
--- a/cider-tracing.el
+++ b/cider-tracing.el
@@ -1,6 +1,6 @@
;;; cider-tracing.el --- Executing tracing functionality -*- lexical-binding: t -*-
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; Artur Malabarba <bruce.connor.am@gmail.com>
diff --git a/cider-util.el b/cider-util.el
index f09fb9a..629e67f 100644
--- a/cider-util.el
+++ b/cider-util.el
@@ -1,7 +1,7 @@
;; cider-util.el --- Common utility functions that don't belong anywhere else -*- lexical-binding: t -*-
;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
@@ -655,6 +655,8 @@ through a stack of help buffers. Variables `help-back-label' and
"The only thing worse than a rebel without a cause is a REPL without a clause."
"In the absence of parentheses, chaos prevails."
"One REPL to rule them all, One REPL to find them, One REPL to bring them all, and in parentheses bind them!"
+ "A blank REPL promotes creativity."
+ "A blank REPL is infinitely better than a blank cheque."
,(format "%s, I've a feeling we're not in Kansas anymore."
(cider-user-first-name))
,(format "%s, this could be the start of a beautiful program."
diff --git a/cider.el b/cider.el
index 2129767..75014b5 100644
--- a/cider.el
+++ b/cider.el
@@ -1,7 +1,7 @@
;;; cider.el --- Clojure Interactive Development Environment that Rocks -*- lexical-binding: t -*-
;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
@@ -11,8 +11,8 @@
;; Steve Purcell <steve@sanityinc.com>
;; Maintainer: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: http://www.github.com/clojure-emacs/cider
-;; Version: 0.18.0
-;; Package-Requires: ((emacs "25") (clojure-mode "5.9") (pkg-info "0.4") (queue "0.2") (spinner "1.7") (seq "2.16") (sesman "0.3"))
+;; Version: 0.19.0
+;; Package-Requires: ((emacs "25") (clojure-mode "5.9") (pkg-info "0.4") (queue "0.2") (spinner "1.7") (seq "2.16") (sesman "0.3.2"))
;; Keywords: languages, clojure, cider
;; This program is free software: you can redistribute it and/or modify
@@ -67,7 +67,7 @@
:prefix "cider-"
:group 'applications
:link '(url-link :tag "GitHub" "https://github.com/clojure-emacs/cider")
- :link '(url-link :tag "Online Manual" "http://docs.cider.mx")
+ :link '(url-link :tag "Online Manual" "https://docs.cider.mx")
:link '(emacs-commentary-link :tag "Commentary" "cider"))
(require 'cider-client)
@@ -86,12 +86,12 @@
(require 'seq)
(require 'sesman)
-(defconst cider-version "0.18.0"
+(defconst cider-version "0.19.0"
"Fallback version used when it cannot be extracted automatically.
Normally it won't be used, unless `pkg-info' fails to extract the
version from the CIDER package or library.")
-(defconst cider-codename "Saigon"
+(defconst cider-codename "Raleigh"
"Codename used to denote stable releases.")
(defcustom cider-lein-command
@@ -108,7 +108,7 @@ version from the CIDER package or library.")
:safe #'stringp)
(defcustom cider-lein-parameters
- "repl :headless :host ::"
+ "repl :headless :host localhost"
"Params passed to Leiningen to start an nREPL server via `cider-jack-in'."
:type 'string
:group 'cider
@@ -130,7 +130,7 @@ version from the CIDER package or library.")
:package-version '(cider . "0.14.0"))
(defcustom cider-boot-parameters
- "cider.tasks/nrepl-server -b :: wait"
+ "cider.tasks/nrepl-server -b localhost wait"
"Params passed to boot to start an nREPL server via `cider-jack-in'."
:type 'string
:group 'cider
@@ -156,7 +156,7 @@ it using rlwrap."
:package-version '(cider . "0.17.0"))
(defcustom cider-clojure-cli-parameters
- "-e '(require (quote cider-nrepl.main)) (cider-nrepl.main/init %s)'"
+ "-m nrepl.cmdline --middleware '%s'"
"Params passed to clojure to start an nREPL server via `cider-jack-in'.
This is evaluated using `format', with the first argument being the Clojure
vector of middleware variables as a string."
@@ -374,14 +374,16 @@ Throws an error if PROJECT-TYPE is unknown."
(defvar cider-jack-in-dependencies nil
"List of dependencies where elements are lists of artifact name and version.")
(put 'cider-jack-in-dependencies 'risky-local-variable t)
+;; We inject the newest known version of nREPL just in case
+;; your version of Boot or Leiningen is bundling an older one.
(cider-add-to-alist 'cider-jack-in-dependencies
- "org.clojure/tools.nrepl" "0.2.13")
+ "nrepl" "0.5.3")
(defvar cider-jack-in-cljs-dependencies nil
"List of dependencies where elements are lists of artifact name and version.
Added to `cider-jack-in-dependencies' when doing `cider-jack-in-cljs'.")
(put 'cider-jack-in-cljs-dependencies 'risky-local-variable t)
-(cider-add-to-alist 'cider-jack-in-cljs-dependencies "cider/piggieback" "0.3.9")
+(cider-add-to-alist 'cider-jack-in-cljs-dependencies "cider/piggieback" "0.3.10")
(defvar cider-jack-in-dependencies-exclusions nil
"List of exclusions for jack in dependencies.
@@ -402,7 +404,7 @@ Elements of the list are artifact name and list of exclusions to apply for the a
(defconst cider-required-middleware-version "0.18.0"
"The minimum CIDER nREPL version that's known to work properly with CIDER.")
-(defconst cider-latest-middleware-version "0.18.0"
+(defconst cider-latest-middleware-version "0.19.0"
"The latest CIDER nREPL version that's known to work properly with CIDER.")
(defcustom cider-jack-in-auto-inject-clojure nil
@@ -650,12 +652,12 @@ Generally you should not disable this unless you run into some faulty check."
(defun cider-verify-clojurescript-is-present ()
"Check whether ClojureScript is present."
(unless (cider-library-present-p "clojure/clojurescript")
- (user-error "ClojureScript is not available. See http://docs.cider.mx/en/latest/clojurescript for details")))
+ (user-error "ClojureScript is not available. See https://docs.cider.mx/en/latest/clojurescript for details")))
(defun cider-verify-piggieback-is-present ()
"Check whether the piggieback middleware is present."
(unless (cider-library-present-p "cider/piggieback")
- (user-error "Piggieback is not available. See http://docs.cider.mx/en/latest/clojurescript for details")))
+ (user-error "Piggieback 0.3.x (aka cider/piggieback) is not available. See https://docs.cider.mx/en/latest/clojurescript for details")))
(defun cider-check-nashorn-requirements ()
"Check whether we can start a Nashorn ClojureScript REPL."
@@ -671,19 +673,19 @@ Generally you should not disable this unless you run into some faulty check."
"Check whether we can start a Figwheel ClojureScript REPL."
(cider-verify-piggieback-is-present)
(unless (cider-library-present-p "figwheel-sidecar/figwheel-sidecar")
- (user-error "Figwheel-sidecar is not available. Please check http://docs.cider.mx/en/latest/clojurescript")))
+ (user-error "Figwheel-sidecar is not available. Please check https://docs.cider.mx/en/latest/clojurescript")))
(defun cider-check-figwheel-main-requirements ()
"Check whether we can start a Figwheel ClojureScript REPL."
(cider-verify-piggieback-is-present)
(unless (cider-library-present-p "bhauman/figwheel-main")
- (user-error "Figwheel-main is not available. Please check http://docs.cider.mx/en/latest/clojurescript")))
+ (user-error "Figwheel-main is not available. Please check https://docs.cider.mx/en/latest/clojurescript")))
(defun cider-check-weasel-requirements ()
"Check whether we can start a Weasel ClojureScript REPL."
(cider-verify-piggieback-is-present)
(unless (cider-library-present-p "weasel/weasel")
- (user-error "Weasel in not available. Please check http://docs.cider.mx/en/latest/clojurescript/#browser-connected-clojurescript-repl")))
+ (user-error "Weasel in not available. Please check https://docs.cider.mx/en/latest/clojurescript/#browser-connected-clojurescript-repl")))
(defun cider-check-boot-requirements ()
"Check whether we can start a Boot ClojureScript REPL."
@@ -697,7 +699,7 @@ Generally you should not disable this unless you run into some faulty check."
(user-error "The shadow-cljs ClojureScript REPL is not available")))
(defun cider-normalize-cljs-init-options (options)
- "Normalize the OPTIONS string used for initializing a CLJS REPL."
+ "Normalize the OPTIONS string used for initializing a ClojureScript REPL."
(if (or (string-prefix-p "{" options)
(string-prefix-p "(" options)
(string-prefix-p "[" options)
@@ -807,10 +809,12 @@ relatively unlikely you'd like to use the same type of REPL in each project
you're working on."
:type '(choice (const :tag "Nashorn" nashorn)
(const :tag "Figwheel" figwheel)
+ (const :tag "Figwheel Main" figwheel-main)
(const :tag "Node" node)
(const :tag "Weasel" weasel)
(const :tag "Boot" boot)
(const :tag "Shadow" shadow)
+ (const :tag "Shadow w/o Server" shadow-select)
(const :tag "Custom" custom))
:group 'cider
:safe #'symbolp
@@ -823,7 +827,7 @@ you're working on."
(defvar cider--select-cljs-repl-history nil)
(defun cider-select-cljs-repl (&optional default)
"Select the ClojureScript REPL to use with `cider-jack-in-cljs'.
-DEFAULT is the default CLJS REPL to offer in completion."
+DEFAULT is the default ClojureScript REPL to offer in completion."
(let ((repl-types (mapcar #'car cider-cljs-repl-types)))
(intern (completing-read "Select ClojureScript REPL type: " repl-types
nil nil nil 'cider--select-cljs-repl-history
@@ -847,11 +851,12 @@ Return REPL-TYPE if requirements are met."
(let ((repl-type (or repl-type
cider-default-cljs-repl
(cider-select-cljs-repl))))
- (when-let* ((fun (nth 2 (seq-find
- (lambda (entry)
- (eq (car entry) repl-type))
- cider-cljs-repl-types))))
- (funcall fun))
+ (when cider-check-cljs-repl-requirements
+ (when-let* ((fun (nth 2 (seq-find
+ (lambda (entry)
+ (eq (car entry) repl-type))
+ cider-cljs-repl-types))))
+ (funcall fun)))
repl-type))
(defun cider--check-cljs (&optional cljs-type no-error)
@@ -865,7 +870,7 @@ nil."
(cider-verify-clojurescript-is-present)
(cider-verify-cljs-repl-requirements cljs-type))
(error
- (message "Invalid CLJS dependency: %S" ex)
+ (message "Invalid ClojureScript dependency: %S" ex)
nil))
(cider-verify-clojurescript-is-present)
(cider-verify-cljs-repl-requirements cljs-type)))
@@ -884,6 +889,7 @@ nil."
;;; User Level Connectors
+;;;###autoload (autoload 'cider-start-map "cider" "CIDER jack-in and connect keymap." t 'keymap)
(defvar cider-start-map
(let ((map (define-prefix-command 'cider-start-map)))
(define-key map (kbd "x") #'cider)
@@ -1002,7 +1008,7 @@ server is created."
(cider--update-do-prompt)
(append other-params)
(plist-put :repl-init-function nil)
- (plist-put :repl-type "clj")
+ (plist-put :repl-type 'clj)
(plist-put :session-name ses-name)))))
;;;###autoload
@@ -1024,11 +1030,11 @@ server buffer, in which case a new session for that server is created."
(cider--update-cljs-type)
(cider--update-cljs-init-function)
(plist-put :session-name ses-name)
- (plist-put :repl-type "pending-cljs")))))
+ (plist-put :repl-type 'pending-cljs)))))
;;;###autoload
(defun cider-connect-clj (&optional params)
- "Initialize a CLJ connection to an nREPL server.
+ "Initialize a Clojure connection to an nREPL server.
PARAMS is a plist optionally containing :host, :port and :project-dir. On
prefix argument, prompt for all the parameters."
(interactive "P")
@@ -1039,11 +1045,11 @@ prefix argument, prompt for all the parameters."
(cider--check-existing-session)
(plist-put :repl-init-function nil)
(plist-put :session-name nil)
- (plist-put :repl-type "clj"))))
+ (plist-put :repl-type 'clj))))
;;;###autoload
(defun cider-connect-cljs (&optional params)
- "Initialize a CLJS connection to an nREPL server.
+ "Initialize a ClojureScript connection to an nREPL server.
PARAMS is a plist optionally containing :host, :port, :project-dir and
:cljs-repl-type (e.g. Node, Figwheel, etc). On prefix, prompt for all the
parameters regardless of their supplied or default values."
@@ -1056,11 +1062,11 @@ parameters regardless of their supplied or default values."
(cider--update-cljs-type)
(cider--update-cljs-init-function)
(plist-put :session-name nil)
- (plist-put :repl-type "pending-cljs"))))
+ (plist-put :repl-type 'pending-cljs))))
;;;###autoload
(defun cider-connect-clj&cljs (params &optional soft-cljs-start)
- "Initialize a CLJ and CLJS connection to an nREPL server..
+ "Initialize a Clojure and ClojureScript connection to an nREPL server.
PARAMS is a plist optionally containing :host, :port, :project-dir and
:cljs-repl-type (e.g. Node, Figwheel, etc). When SOFT-CLJS-START is
non-nil, don't start if ClojureScript requirements are not met."
@@ -1229,7 +1235,7 @@ canceled the action, signal quit."
(equal port (plist-get ses-params :port)))
(or (null host)
(equal host (plist-get ses-params :host))))))
- (sesman-linked-sessions 'CIDER '(project)))))
+ (sesman-current-sessions 'CIDER '(project)))))
(when session
(unless (y-or-n-p
(concat
@@ -1321,6 +1327,12 @@ Tramp version starting 26.1 is using a `cl-defstruct' rather than vanilla VEC."
(make-tramp-file-name :method (elt vec 0)
:host (elt vec 2)))))
+(defcustom cider-infer-remote-nrepl-ports nil
+ "When true, cider will use ssh to try to infer nREPL ports on remote hosts."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(cider . "0.19.0"))
+
(defun cider--infer-ports (host ssh-hosts)
"Infer nREPL ports on HOST.
Return a list of elements of the form (directory port). SSH-HOSTS is a list
@@ -1332,14 +1344,15 @@ of remote SSH hosts."
(let* ((change-dir-p (file-remote-p default-directory))
(default-directory (if change-dir-p "~/" default-directory)))
(cider-locate-running-nrepl-ports (unless change-dir-p default-directory)))
- (let ((vec (vector "sshx" nil host "" nil))
- ;; change dir: user might want to connect to a different remote
- (dir (when (file-remote-p default-directory)
- (with-parsed-tramp-file-name default-directory cur
- (when (string= cur-host host) default-directory)))))
- (tramp-maybe-open-connection (cider--tramp-file-name vec))
- (with-current-buffer (tramp-get-connection-buffer (cider--tramp-file-name vec))
- (cider-locate-running-nrepl-ports dir))))))
+ (when cider-infer-remote-nrepl-ports
+ (let ((vec (vector "sshx" nil host "" nil))
+ ;; change dir: user might want to connect to a different remote
+ (dir (when (file-remote-p default-directory)
+ (with-parsed-tramp-file-name default-directory cur
+ (when (string= cur-host host) default-directory)))))
+ (tramp-maybe-open-connection (cider--tramp-file-name vec))
+ (with-current-buffer (tramp-get-connection-buffer (cider--tramp-file-name vec))
+ (cider-locate-running-nrepl-ports dir)))))))
(defun cider--completing-read-port (host ports)
"Interactively select port for HOST from PORTS."
@@ -1429,18 +1442,17 @@ assume the command is available."
(shell-quote-argument command)))
;;;###autoload
-(eval-after-load 'clojure-mode
- '(progn
- (define-key clojure-mode-map (kbd "C-c M-x") #'cider)
- (define-key clojure-mode-map (kbd "C-c M-j") #'cider-jack-in-clj)
- (define-key clojure-mode-map (kbd "C-c M-J") #'cider-jack-in-cljs)
- (define-key clojure-mode-map (kbd "C-c M-c") #'cider-connect-clj)
- (define-key clojure-mode-map (kbd "C-c M-C") #'cider-connect-cljs)
- (define-key clojure-mode-map (kbd "C-c C-x") 'cider-start-map)
- (define-key clojure-mode-map (kbd "C-c C-s") 'sesman-map)
- (require 'sesman)
- (sesman-install-menu clojure-mode-map)
- (add-hook 'clojure-mode-hook (lambda () (setq-local sesman-system 'CIDER)))))
+(with-eval-after-load 'clojure-mode
+ (define-key clojure-mode-map (kbd "C-c M-x") #'cider)
+ (define-key clojure-mode-map (kbd "C-c M-j") #'cider-jack-in-clj)
+ (define-key clojure-mode-map (kbd "C-c M-J") #'cider-jack-in-cljs)
+ (define-key clojure-mode-map (kbd "C-c M-c") #'cider-connect-clj)
+ (define-key clojure-mode-map (kbd "C-c M-C") #'cider-connect-cljs)
+ (define-key clojure-mode-map (kbd "C-c C-x") 'cider-start-map)
+ (define-key clojure-mode-map (kbd "C-c C-s") 'sesman-map)
+ (require 'sesman)
+ (sesman-install-menu clojure-mode-map)
+ (add-hook 'clojure-mode-hook (lambda () (setq-local sesman-system 'CIDER))))
(provide 'cider)
diff --git a/doc/about/support.md b/doc/about/support.md
index f06af4d..b18dafd 100644
--- a/doc/about/support.md
+++ b/doc/about/support.md
@@ -22,13 +22,6 @@ and interact with other CIDER users. The channel is very active!
There's also another channel named `#emacs` for generic Emacs discussions.
-## Gitter
-
-Most internal discussions about the development of CIDER happen on its
-[gitter channel](https://gitter.im/clojure-emacs/cider). You can often find
-CIDER's maintainers there and get some interesting news from the project's
-kitchen.
-
## Stackoverflow
We're also encouraging users to ask CIDER-related questions on StackOverflow.
diff --git a/doc/additional_resources.md b/doc/additional_resources.md
index fe91677..5a077c9 100644
--- a/doc/additional_resources.md
+++ b/doc/additional_resources.md
@@ -25,3 +25,4 @@ dedicated to CIDER 0.12.
## Podcasts
* [Cognicast's episode on CIDER](http://blog.cognitect.com/cognicast/080)
+* [defn's episode on CIDER](https://soundcloud.com/defn-771544745/36-a-long-glass-of-cider-with-bozhidar-batsov-aka-bbatsov)
diff --git a/doc/caveats.md b/doc/caveats.md
index 64a87cf..acf91a3 100644
--- a/doc/caveats.md
+++ b/doc/caveats.md
@@ -21,7 +21,7 @@ ClojureScript source code (file, line & column) is set only when evaluating the
entire source buffer (<kbd>C-c C-k</kbd>). All other interactive code evaluation
commands (e.g. <kbd>C-c C-e</kbd>) don't set this metadata and you won't be able
to use commands like `find-var` on such vars. This is a limitation of nREPL and
-piggieback, that's beyond CIDER. You can find some discussions on the subject
+Piggieback, that's beyond CIDER. You can find some discussions on the subject
[here](http://dev.clojure.org/jira/browse/NREPL-59) and
[here](https://github.com/clojure-emacs/cider/issues/830).
diff --git a/doc/clojurescript.md b/doc/clojurescript.md
index ade0222..06d2f36 100644
--- a/doc/clojurescript.md
+++ b/doc/clojurescript.md
@@ -1,35 +1,39 @@
## ClojureScript
-CIDER works with ClojureScript, but you should keep in mind that not all
-the functionality available with Clojure exists for ClojureScript (at least
-not yet). To give you a concrete example - things like running tests and
-the debugger are currently Clojure-only features.
+CIDER works well with ClojureScript, but not all CIDER features are
+available in ClojureScript (yet). For instance, the test runner and
+debugger are currently Clojure-only features. Unlike the Clojure
+ecosystem that is dominated by Leiningen and Boot, the ClojureScript
+ecosystem has a number of different choices for REPLs. You'll have to
+decide which one you want to run and how you want CIDER to interact
+with it. This chapter describes some of the more common choices
+and the configurations required to get them working.
### Piggieback
ClojureScript support relies on the [piggieback][] nREPL middleware
being present in your REPL session. There's one exception to this,
-though - [shadow-cljs][]. It has its own nREPL middleware and doesn't rely
+though: [shadow-cljs][]. It has its own nREPL middleware and doesn't rely
on piggieback at all.
-If `cider-inject-dependencies-at-jack-in` is enabled (which is the default) then
-piggieback will be automatically added and configured for your project when
-doing `cider-jack-in-cljs`.
+If `cider-inject-dependencies-at-jack-in` is enabled, which it is by
+default, then piggieback will be automatically added and configured
+for your project when doing `cider-jack-in-cljs`.
-If this configuration option is disabled or you're going to connect to
-an already running nREPL server using `cider-connect-cljs` - continue
-reading ahead.
+If `cider-inject-dependencies-at-jack-in` is disabled or you're going
+to connect to an already running nREPL server using
+`cider-connect-cljs`, use the configuration in the following section.
#### Manual Piggieback Setup
-To setup piggieback add the following dependencies to your project
-(`project.clj` in Leiningen based project or `build.boot` in Boot
+To setup piggieback, add the following dependencies to your project
+(`project.clj` in a Leiningen based project or `build.boot` in a Boot
project):
```clojure
;; use whatever are the most recent versions here
-[cider/piggieback "0.3.9"]
+[cider/piggieback "0.3.10"]
[org.clojure/clojure "1.9.0"]
```
@@ -50,14 +54,17 @@ or in `build.boot`:
### Starting a ClojureScript REPL
-There are many ClojureScript REPLs out there and it's often hard to wrap your
-head around them and the differences between them. You'd do well to read [this
-awesome article](https://lambdaisland.com/guides/clojure-repls/clojurescript-repls)
-before proceeding with the rest of the instructions listed here.
+!!! Tip
-Open a file in your project and issue <kbd>M-x</kbd>
+ There are many ClojureScript REPLs available, each offering a
+ different set of capabilities and features. As background for this
+ section, you might want to read [this awesome
+ article](https://lambdaisland.com/guides/clojure-repls/clojurescript-repls)
+ before proceeding.
+
+Open a file in your project and type <kbd>M-x</kbd>
`cider-jack-in-cljs` <kbd>RET</kbd>. This will start up the nREPL
-server, and then create a ClojureScript REPL buffer for you, one.
+server and create a ClojureScript REPL buffer.
!!! Note
@@ -65,17 +72,19 @@ server, and then create a ClojureScript REPL buffer for you, one.
a ClojureScript REPL. In CIDER 0.18+ if you want to create both REPLs
you'll have to use `cider-jack-in-clj&cljs` instead.
-When you have a combination of Clojure and ClojureScript REPLs all
-usual CIDER commands will be automatically directed to the appropriate
-REPL, depending on whether you're visiting a `.clj` or a `.cljs` file.
+When you have a combination of Clojure and ClojureScript REPLs, CIDER
+will automatically direct all the usual CIDER commands to the
+appropriate REPL based on whether you're currently visitng a `.clj` or
+`.cljs` file.
-`cider-jack-in-cljs` will prompt you about the type of
-ClojureScript to start. Keep in mind that some of the REPLs will
-require some additional setup, before you can make use of them (e.g. you'll
-need to have Node.js installed to be able to start a node REPL).
+`cider-jack-in-cljs` will prompt you for the type of ClojureScript
+REPL you want to start. Keep in mind that some of the REPLs will
+require you to configure additional setup. For example, you'll need to
+have Node.js installed to be able to start a Node REPL.
-You can suppress the prompt the REPL to use by setting `cider-default-cljs-repl`.
-Here's an example that will make Nashorn the default:
+If you frequently use the same ClojureScript REPL, you can set
+`cider-default-cljs-repl` and CIDER will skip the prompt and use this
+instead. For example, the following will make Nashorn the default:
```el
(setq cider-default-cljs-repl 'nashorn)
@@ -106,20 +115,20 @@ You can also modify the known ClojureScript REPLs on a per-project basis using
(cider-default-cljs-repl . super-cljs)))
```
-You can also create a ClojureScript REPL with the command
-`cider-jack-in-sibling-clojurescript` in cases where you already have a
-Clojure REPL running.
+If you already have a Clojure REPL running and want to add a
+ClojureScript REPL, you can invoke
+`cider-jack-in-sibling-clojurescript` to add it.
-Continue reading for the additional setup needed for the various ClojureScript
-REPLs out there.
+The following sections describe the configurations for several common
+CloudScript REPL use cases.
-### Browser-connected ClojureScript REPL
+### Browser-Connected ClojureScript REPL
Using Weasel, you can also have a browser-connected REPL.
1. Add `[weasel "0.7.0"]` to your project's `:dependencies`.
-2. Issue <kbd>M-x</kbd> `cider-jack-in-cljs` <kbd>RET</kbd> and choose
+2. Type <kbd>M-x</kbd> `cider-jack-in-cljs` <kbd>RET</kbd> and choose
the `Weasel` option when prompted about the ClojureScript REPL type you want
to use.
@@ -131,7 +140,7 @@ Using Weasel, you can also have a browser-connected REPL.
(repl/connect "ws://localhost:9001")
```
-4. Open a file in your project and issue <kbd>M-x</kbd> `cider-jack-in-cljs`.
+4. Open a file in your project and type <kbd>M-x</kbd> `cider-jack-in-cljs`.
Provided that a Piggieback-enabled ClojureScript environment is active in your
REPL session, code loading and evaluation will work seamlessly regardless of the
@@ -139,7 +148,7 @@ presence of the `cider-nrepl` middleware. If the middleware is present then most
other features of CIDER will also be enabled (including code completion,
documentation lookup, the namespace browser, and macroexpansion).
-### Browser-connected ClojureScript REPL in Boot project
+### Browser-Connected ClojureScript REPL in Boot Projects
1. Add this to your dependencies in `build.boot`:
@@ -148,7 +157,7 @@ documentation lookup, the namespace browser, and macroexpansion).
[adzerk/boot-cljs-repl "X.Y.Z" :scope "test"]
[pandeiro/boot-http "X.Y.Z" :scope "test"]
[weasel "0.7.0" :scope "test"]
-[cider/piggieback "0.3.9" :scope "test"] ; not needed for cider-jack-in-cljs
+[cider/piggieback "0.3.10" :scope "test"] ; not needed for cider-jack-in-cljs
```
and this at the end of `build.boot`:
@@ -166,10 +175,10 @@ and this at the end of `build.boot`:
(cljs)))
```
-2. Issue <kbd>M-x</kbd> `customize-variable` <kbd>RET</kbd> `cider-boot-parameters`
+2. Type <kbd>M-x</kbd> `customize-variable` <kbd>RET</kbd> `cider-boot-parameters`
and insert `dev`.
-3. Open a file in your project and issue <kbd>M-x</kbd> `cider-jack-in-cljs`.
+3. Open a file in your project and type <kbd>M-x</kbd> `cider-jack-in-cljs`.
5. Connect to the running server with your browser. The address is printed on the terminal, but it's probably `http://localhost:3000`.
@@ -189,23 +198,23 @@ You can also use [Figwheel](https://github.com/bhauman/lein-figwheel) with CIDER
2. Add these to your dev `:dependencies`:
- ```clojure
- [cider/piggieback "0.3.9"] ; not needed for cider-jack-in-cljs
- [figwheel-sidecar "0.5.16"] ; use here whatever the current version of figwheel is
- ```
+```clojure
+[cider/piggieback "0.3.10"] ; not needed for cider-jack-in-cljs
+[figwheel-sidecar "0.5.16"] ; use here whatever the current version of figwheel is
+```
Keep in mind that figwheel 0.5.16 is the first to support piggieback
-0.3. If you're using an older figwheel you should stick to piggieback
+0.3. If you're using an older figwheel, you should stick to piggieback
0.2.2 (which uses the old `com.cemerick/piggieback` package coordinates).
3. Add this to your dev `:repl-options` (not needed for `cider-jack-in-cljs`):
- ```clojure
- :nrepl-middleware [cider.piggieback/wrap-cljs-repl]
- ```
+```clojure
+:nrepl-middleware [cider.piggieback/wrap-cljs-repl]
+```
4. Start the REPL with `cider-jack-in-cljs` (<kbd>C-c C-x (C-)j (C-)s</kbd>). Select
-`figwheel` when prompted about the ClojureScript REPL type.
+`figwheel` when prompted for the ClojureScript REPL type.
5. Open a browser to the Figwheel URL so that it can connect to your application.
@@ -221,42 +230,43 @@ You should also check out
You can also use [Figwheel-main](https://github.com/bhauman/figwheel-main) with CIDER.
-1. Add this to your dev `:dependencies`:
+1. Add this to your dev `:dependencies` (not needed for `cider-jack-in-cljs`):
- ```clojure
- [cider/piggieback "0.3.9"] ; not needed for cider-jack-in-cljs
- ```
+```clojure
+[cider/piggieback "0.3.10"]
+```
2. Add this to your dev `:repl-options` (not needed for `cider-jack-in-cljs`):
- ```clojure
- :nrepl-middleware [cider.piggieback/wrap-cljs-repl]
- ```
+```clojure
+:nrepl-middleware [cider.piggieback/wrap-cljs-repl]
+```
-3. Start the REPL with `cider-jack-in-cljs` (<kbd>C-c C-x (C-)j (C-)s</kbd>). Select
-`figwheel-main` when prompted about the ClojureScript REPL type.
+3. Start the REPL with `cider-jack-in-cljs` (<kbd>C-c C-x (C-)j
+(C-)s</kbd>). When CIDER prompts about the ClojureScript REPL type,
+type `figwheel-main`.
4. Select the Figwheel build to run when prompted for it. (e.g. `:dev`).
### Using shadow-cljs
-Provided you've configured your project correctly you can simply use
-`cider-jack-in-cljs` to use `shadow-cljs`.
+Provided you've configured your project correctly, you can simply use
+`cider-jack-in-cljs` for `shadow-cljs`.
-This will automatically start the shadow-cljs server and connect to it. You'll also
-be prompted for the build to use.
+This will automatically start the shadow-cljs server and connect to
+it. You'll also be prompted for the build to use.
Alternatively you can start the server manually with something like:
-```
-npx shadow-cljs server
+```sh
+$ npx shadow-cljs server
```
And connect to it with `cider-connect`.
-Lastly, if you already have a running server watching a build, for instance you
-have already run `npx shadow-cljs watch :dev`, you can use the `shadow-select`
-CLJS REPL and specify `:dev` when prompted.
+If you already have a running server watching a build (for instance
+you have already run `npx shadow-cljs watch :dev`), you can use the
+`shadow-select` CLJS REPL and specify `:dev` when prompted.
[leiningen]: http://leiningen.org/
[boot]: http://boot-clj.com/
@@ -265,23 +275,16 @@ CLJS REPL and specify `:dev` when prompted.
## Working with `.cljc` files
-Ordinarily, CIDER dispatches code from `clj` files to Clojure REPLs and `cljs`
-files to ClojureScript REPLs. However, `cljc` files have two possible connection
-targets. By default, CIDER tries to evaluate `cljc` files in all matching
-connection buffers, both `clj` and `cljs` (if present).
-
-Simply put - if you're evaluating the code `(+ 2 2)` in a `cljc` file and you
-have an active Clojure and and active ClojureScript REPL, then the code is going
-to be evaluated 2 times - once for each of them. This behavior might be a bit
-confusing, but that's what we came up with, when ruminating what was the most
-logical thing to do out-of-the-box.
-
-This can be modified with <kbd>M-x</kbd> `cider-toggle-connection-buffer`
-<kbd>RET</kbd>. Toggling this once will choose one of the connections as the
-primary, and successive calls to <kbd>M-x</kbd> `cider-toggle-connection-buffer`
-<kbd>RET</kbd> will alternate which connection to use. To restore evaluation to
-both connections, invoke `cider-toggle-connection-buffer` with a prefix argument
-(<kbd>C-u M-x</kbd> `cider-toggle-connection-buffer` <kbd>RET</kbd>).
-
-If there is only a Clojure connection, no toggling will happen and a message
-will inform you that there are no other connections to switch to.
+Ordinarily, CIDER dispatches code from `clj` files to Clojure REPLs
+and `cljs` files to ClojureScript REPLs. But`cljc` files have two
+possible connection targets, both of which are valid. So, by default,
+CIDER tries to evaluate `cljc` files in all matching connection
+buffers, both `clj` and `cljs`, if present.
+
+Thus, if you're evaluating the code `(+ 2 2)` in a `cljc` file and you
+have both an active Clojure and ClojureScript REPL then the code is
+going to be evaluated twice, once in each of the REPLs. In fact, you
+can create multiple clj and cljs sibling connections (<kbd>C-c C-x C-s
+C-s/j</kbd>) within a CIDER session and evaluation will be directed
+into all REPLs simultaneously. See [Managing
+Connections](managing_connections.md) for more details.
diff --git a/doc/code_completion.md b/doc/code_completion.md
index 243a8ac..f1c82b9 100644
--- a/doc/code_completion.md
+++ b/doc/code_completion.md
@@ -18,29 +18,31 @@ dedicated buffer.
## Auto-completion
-CIDER users are advised to use [`company-mode`](http://company-mode.github.io/)
-to enable auto-completion inside of source code and REPL buffers. To install
-`company-mode` do:
+While the standard Emacs tooling works just fine, we suggest that
+CIDER users consider using
+[`company-mode`](http://company-mode.github.io/) instead. Company mode
+can be used for auto-completion for both source code and REPL buffers.
+To install `company-mode`:
<kbd>M-x</kbd> `package-install` <kbd>RET</kbd> `company` <kbd>RET</kbd>
-After installation, company can be turned on globally, like so --
+After installation, you can turn on `company-mode` globally:
```el
(global-company-mode)
```
--- or through mode-specific hooks:
+or through mode-specific hooks:
```el
(add-hook 'cider-repl-mode-hook #'company-mode)
(add-hook 'cider-mode-hook #'company-mode)
```
-When `company-mode` is thus enabled, it will receive completion information
-from `cider-complete-at-point`, and requires no additional setup or plugins.
+When `company-mode` is enabled, it will receive completion information
+from `cider-complete-at-point` and requires no additional setup or plugins.
-If you'd prefer to trigger completions manually you can add this to you config:
+If you'd prefer to trigger completions manually you can add this to your config:
```el
(setq company-idle-delay nil) ; never start completions automatically
@@ -56,22 +58,25 @@ you can add this to your config:
### Fuzzy candidate matching
-By default `company-mode` will provide completion candidates with the assumption
-that whatever you've typed so far (e.g. `map-`) is a completion prefix (meaning
-you'd get only candidates that have `map-` in the beginnings of their names).
-You can get enhanced fuzzy completion with the CIDER-specific completion style
-by adding:
+By default `company-mode` will provide completion candidates with the
+assumption that whatever you've typed so far is a prefix of what
+you're really trying to type. For example, if you type `map-` then
+you'll only get completion candidates that have `map-` as the
+beginning of their names. Sometimes, you don't know the exact prefix
+for the item you want to type. In this case, you can get
+CIDER-specific "fuzzy completion" by adding:
```el
(add-hook 'cider-repl-mode-hook #'cider-company-enable-fuzzy-completion)
(add-hook 'cider-mode-hook #'cider-company-enable-fuzzy-completion)
```
-Now `company-mode` will accept certain fuzziness when matching candidates
-against the prefix. For example, typing `mp` will show you `map-indexed` as one
-of the possible completion candidates, `cji` will complete to `clojure.java.io`,
-etc. Different completion examples are
-listed [here](https://github.com/alexander-yakushev/compliment/wiki/Examples).
+Now, `company-mode` will accept certain fuzziness when matching
+candidates against the prefix. For example, typing `mp` will show you
+`map-indexed` as one of the possible completion candidates and `cji`
+will complete to `clojure.java.io`. Different completion examples are
+shown
+[here](https://github.com/alexander-yakushev/compliment/wiki/Examples).
### Completion annotations
diff --git a/doc/configuration.md b/doc/configuration.md
index 62ffcac..30dc2fd 100644
--- a/doc/configuration.md
+++ b/doc/configuration.md
@@ -1,98 +1,113 @@
-In the spirit of Emacs almost every aspect of CIDER's behaviour
-is configurable. We've tried to come up with some reasonable
-defaults, but we've also tried to account for different people's
-preferences, so everyone could make CIDER as comfortable as
-possible for them.
+Like Emacs itself, almost every part of CIDER is configurable. The
+CIDER developers have tried to implement some reasonable defaults that
+should work for a large portion of the Clojure community, but we know
+that there is nothing approaching a "one size fits all" development
+environment and we've tried to create points of customization that can
+account for many different peoples' preferences. In this way, you
+should be able to make CIDER as comfortable as possible for **you**.
You can see every single customizable configuration option with the command
<kbd>M-x customize-group RET cider</kbd>.
-You can certainly use CIDER without configuring it any further,
-but here are some ways other folks are adjusting their CIDER
-experience.
+This section doesn't describe every possible customization that CIDER
+offers, but here are some of the most popular.
-## Basic configuration
+## Basic Configuration
-### Auto-enabling cider-mode in clojure-mode buffers
+### Disable Automatic cider-mode in clojure-mode Buffers
-By default CIDER will enable `cider-mode` in all `clojure-mode` buffers when the
-first CIDER connection is established. It will also add a `clojure-mode` hook to
-enable it on newly created `clojure-mode` buffers. The configuration snippet
-bellow allows you to override this (somewhat non-standard) behavior.
+By default, CIDER enables `cider-mode` in all `clojure-mode` buffers
+after it establishes the first CIDER connection. It will also add a
+`clojure-mode` hook to enable `cider-mode` on newly-created `clojure-mode`
+buffers. You can override this behavior, however:
```el
-;; Suppress auto-enabling of `cider-mode` in `clojure-mode` buffers, when starting CIDER
(setq cider-auto-mode nil)
```
-### Prompt for confirmation of the symbol at point
+### Disable Symbol Confirmation
-By default, interactive commands that require a symbol (e.g. `cider-doc`) will
-prompt for the symbol, with the prompt defaulting to the symbol at point. You
-can set `cider-prompt-for-symbol` to `nil` to instead try the command with the
-symbol at point first, and only prompt if that fails (this used to be the
-default behavior in older CIDER releases).
+By default, CIDER prompts you for a symbol when it executes
+interactive commands that require a symbol (e.g. `cider-doc`). The
+default symbol will be the one at point. If you set
+`cider-prompt-for-symbol` to `nil`, CIDER will try the symbol at point
+first, and only prompt if that fails (this was the behavior in older
+CIDER releases).
```el
(setq cider-prompt-for-symbol nil)
```
-### Log communication with the nREPL server
+### Log nREPL Communications
+
+If you want to see all communications between CIDER and the nREPL
+server:
```el
(setq nrepl-log-messages t)
```
-Basically, this will result in the creation of buffers like `*nrepl-messages
-conn-name*`. The communication log is invaluable for debugging CIDER issues, so
-you're generally advised to enable logging when you need to debug something
-nREPL related.
+CIDER will then create buffers named `*nrepl-messages conn-name*` for
+each connection.
+
+The communication log is tremendously valuable for
+debugging CIDER-to-nREPL problems and we recommend you enable it when
+you are facing such issues.
-### Hide special nREPL buffers
+### Hide Special nREPL Buffers
-You can hide the `*nrepl-connection*` and `*nrepl-server*` buffers
-from appearing in some buffer switching commands like
-`switch-to-buffer`(<kbd>C-x b</kbd>) like this:
+If you're finding that `*nrepl-connection*` and `*nrepl-server*`
+buffers are cluttering up your development environment, you can
+suppress them from appearing in some buffer switching commands like
+`switch-to-buffer`(<kbd>C-x b</kbd>):
```el
(setq nrepl-hide-special-buffers t)
```
-When using `switch-to-buffer`, pressing <kbd>SPC</kbd> after the command will
-make the hidden buffers visible. They'll always be visible in
-`list-buffers` (<kbd>C-x C-b</kbd>).
+If you need to make the hidden buffers appear When using
+`switch-to-buffer`, type <kbd>SPC</kbd> after issuing the command. The
+hidden buffers will always be visible in `list-buffers` (<kbd>C-x
+C-b</kbd>).
-### Prefer local resources over remote ones
+### Prefer Local Resources Over Remote Resources
-To prefer local resources to remote (tramp) ones when both are available:
+To prefer local resources to remote resources (tramp) when both are available:
```el
(setq cider-prefer-local-resources t)
```
-### Auto-save Clojure buffers on load
+### Auto-Save Clojure Buffers on Load
-Normally CIDER would prompt you to save a modified Clojure buffer on <kbd>C-c C-k</kbd> (`cider-load-buffer`).
-You can change this behaviour by adjusting `cider-save-file-on-load`:
+Normally, CIDER prompts you to save a modified Clojure buffer when you
+type <kbd>C-c C-k</kbd> (`cider-load-buffer`). You can change this
+behaviour by adjusting `cider-save-file-on-load`.
+
+Don't prompt and don't save:
```el
-;; Don't prompt and don't save
(setq cider-save-file-on-load nil)
-;; Just save without prompting
+```
+
+Just save without prompting:
+
+```el
(setq cider-save-file-on-load t)
```
-### Changing the result prefix for interactive evaluation
+### Change the Result Prefix for Interactive Evaluation
-Change the result prefix for interactive evaluation (by default it's `=> `):
+Change the result prefix for interactive evaluation (not the REPL
+prefix). By default the prefix is `=> `.
```el
(setq cider-eval-result-prefix ";; => ")
```
-To remove the prefix altogether just set it to an empty string(`""`).
+To remove the prefix altogether, just set it to the empty string (`""`).
-### Use a local copy of the JDK API documentation
+### Use a Local Copy of the JDK API Documentation
If you are targeting the JVM and prefer a local copy of the JDK API
documentation over Oracle's official copy (e.g., for
@@ -105,19 +120,19 @@ you can arrange your project to include the **root** path of the local API doc
path being `/usr/share/doc/java/api/`, put the following line in
`project.clj`:
-```clj
+```clojure
:dev {:resource-paths ["/usr/share/doc/java/api/"]}
```
**or** the following line in `$HOME/.lein/profiles.clj`:
-```clj
+```clojure
:user {:resource-paths ["/usr/share/doc/java/api/"]}
```
More details can be found [here](https://github.com/clojure-emacs/cider/issues/930).
-### Use a local copy of the Java source code
+### Use a Local Copy of the Java Source Code
When an exception is thrown, e.g. when eval-ing `(. clojure.lang.RT foo)`, a
stack trace pops up. Some places of the stack trace link to Clojure files,
@@ -292,7 +307,7 @@ a macro should be indented.
Here's a simple example of how someone would specify the indent spec for a macro
they've written (using an example in core):
-```clj
+```clojure
(defmacro with-in-str
"[DOCSTRING]"
{:style/indent 1}
@@ -302,7 +317,7 @@ they've written (using an example in core):
And here's a more complex one:
-```clj
+```clojure
(defmacro letfn
"[DOCSTRING]"
{:style/indent [1 [[:defn]] :form]}
diff --git a/doc/debugging.md b/doc/debugging.md
index 11c8310..7ed53cf 100644
--- a/doc/debugging.md
+++ b/doc/debugging.md
@@ -1,4 +1,4 @@
-CIDER ships with a powerful interactive Clojure debugger inspired by Emacs's own
+CIDER ships with a **powerful** interactive Clojure debugger inspired by Emacs's own
[Edebug][]. You're going to love it!
![CIDER Debugger](images/cider_debugger.gif)
@@ -11,18 +11,24 @@ CIDER ships with a powerful interactive Clojure debugger inspired by Emacs's own
## Debugging
-The debugger can be invoked in several ways, the simplest one is to type
-<kbd>C-u C-M-x</kbd>. This will take the current top-level form, place as many
-breakpoints inside it as possible (instrument it), and then evaluate it as
-normal. Whenever a breakpoint is reached, you'll be shown the value and asked
-for input (see below). Note that if the current form is a `defn`, it will stay
-instrumented, so the debugger will be triggered every time the function is
-called. To uninstrument `defn` (or similar forms), you just have to evaluate it
-again as you'd normally do (e.g. with <kbd>C-M-x</kbd>).
-
-Another way to trigger the debugger is by placing breakpoints yourself. Just
-write `#break` before a form, and the debugger will popup every time that form is
-evaluated. For instance, if you hit <kbd>C-M-x</kbd> on the following, a
+During normal CIDER development, it's common for a programmer to
+evaluate a form, often a function definition, by typing
+<kbd>C-M-x</kbd> (`cider-eval-defun-at-point`). CIDER can also
+instrument a form for debugging when you add a prefix to the
+evaluation command: <kbd>C-u C-M-x</kbd>. During the instrumentation
+process, CIDER will insert as many breakpoints as possible into the
+form. Whenever execution reaches a breakpoint, CIDER will drop into
+debugging mode and will prompt you for what to do next. You can remove
+the instrumentation by evaluating the form again normally, using
+<kbd>C-M-x</kbd>.
+
+You can also trigger insert a breakpoint manually into any code
+manually by placing `#break` in front of the form where you want the
+breakpoint to trigger and then evaluating the form with
+<kbd>C-M-x</kbd>. When execution reaches the form after the `#break`,
+you'll be dropped into the debugger.
+
+For instance, if you hit <kbd>C-M-x</kbd> on the following, a
breakpoint is triggered every time `(inspector msg)` is evaluated.
```clojure
@@ -32,22 +38,40 @@ breakpoint is triggered every time `(inspector msg)` is evaluated.
msg))
```
-Instead of `#break` you can also write `#dbg` before a form, this will not only
-breakpoint the form but also everything inside it. In the example above, this
-places a breakpoint around `(inspector msg)` and another around `msg`. If you've
-been paying attention, you may have noticed that the first option (<kbd>C-u
-C-M-x</kbd>) is a quick way of evaluating the current top-level form with `#dbg`
-in front.
+Instead of `#break`, you can also write `#dbg` before a form. This
+will place a breakpoint both in front of the form, as with `#break`,
+and also everything inside it. In the example above, this places one
+breakpoint around `(inspector msg)` and another around `msg`. In fact,
+typing <kbd>C-u C-M-x</kbd> to instrument a top-level form is just a
+convenient way to evaluate the form with an implicit `#dbg` in front
+of it; the behavior is the same.
At any point, you can bring up a list of all currently instrumented `def`s with
the command <kbd>M-x</kbd> `cider-browse-instrumented-defs`. Protocols and types
-can be instrumented as well, but they will not be listed by this command.
+can be instrumented as well, but they will not be listed by this
+command.
+
+## Understanding Breakpoints
+
+In the CIDER debugger, the term "breakpoint" refers to a place where
+the debugger can halt execution and display the value of an
+expression. You can set a single breakpoint with `#break`, or set
+breakpoints throughout a form with `#dbg` (or by evaluating with <kbd>C-u
+C-M-x</kbd>), as described previously.
+
+When using `#dbg` or <kbd>C-u C-M-x</kbd>, not every form is wrapped
+in a breakpoint. The debugger tries to avoid setting breakpoints on
+expressions that are not interesting. For example, there is little
+point in stopping execution at a literal number 23 in your code and
+showing you that its value is 23 - you already know that.
## Keys
-`cider-debug` tries to be consistent with [Edebug][], although there are some
-differences. It makes available the following bindings while stepping through
-code.
+Once you drop into the CIDER debugger, you have a number of commands
+available to you to step through your code, evaluate other forms,
+inspect values, inject new values, or view the current
+stack. `cider-debug` tries to be consistent with [Edebug] command
+keys, although there are some differences.
Keyboard shortcut | Description
--------------------------------|-------------------------------
@@ -66,32 +90,20 @@ Keyboard shortcut | Description
<kbd>t</kbd> | Trace. Continue, printing expressions and their values.
<kbd>q</kbd> | Quit execution
-In addition, all the usual evaluation commands (such as <kbd>C-x C-e</kbd> or
-<kbd>C-c M-:</kbd>) will use the current lexical context (local variables) while
-the debugger is active.
+Additionally, all the usual evaluation commands such as <kbd>C-x
+C-e</kbd> or <kbd>C-c M-:</kbd> will be scoped to the current lexical
+context while the debugger is active, allowing you to access local
+variables.
-## Command Details
-
-Here are some more details about what each of the above commands does.
-
-### Stepping Commands
+## Stepping Command Details
These commands continue execution until reaching a breakpoint.
-In the cider debugger, the term "breakpoint" refers to a place where the
-debugger can halt execution and display the value of an expression. You can set
-a single breakpoint with `#break`, or set breakpoints throughout a form with
-`#dbg` (or by evaluating with `C-u C-M-x`). Not every form is wrapped in a
-breakpoint; the debugger tries to avoid setting breakpoints on expressions that
-would not be interesting to stop at, such as constants. For example, there would
-not be much point in stopping execution at a literal number 23 in your code and
-showing that its value is 23 - you already know that.
-
- **next**: Steps to the next breakpoint
- **in**: Steps in to the function about to be called. If the next breakpoint is
not around a function call, does the same as `next`. Note that not all
functions can be stepped in to - only normal functions stored in vars, for
- which cider can find the source. You cannot currently step in to multimethods,
+ which CIDER can find the source. You cannot currently step in to multimethods,
protocol functions, or functions in clojure.core (although multimethods and
protocols can be instrumented manually).
- **out**: Steps to the next breakpoint that is outside of the current sexp.
@@ -105,7 +117,7 @@ showing that its value is 23 - you already know that.
- **Here**: Same as `h`, but skips breakpoints in other functions, as with `O`.
- **continue**: Continues without stopping, skipping all breakpoints.
-### Other Commands
+## Other Command Details
- **eval**: Prompts for a clojure expression, which can reference local
variables that are in scope where the debugger is stopped. Displays the result
@@ -124,7 +136,7 @@ showing that its value is 23 - you already know that.
- **quit**: Quits execution immediately. Unlike with `continue`, the rest of the
code in the debugged function is not executed.
-### Conditional Breakpoints
+## Conditional Breakpoints
Breakpoints can be conditional, such that the debugger will only stop when the
condition is true.
@@ -137,47 +149,51 @@ Conditions are specified using `:break/when` metadata attached to a form.
(prn i))
```
-Evaluating the above with `C-M-x`, the debugger will stop only once, when i
-is 7.
+Evaluating the above with `C-M-x`, the debugger will stop only once, when `i`
+equals 7.
-You can also have cider insert the break-condition into your code for you. Place
-the point where you want the condition to go and evaluate with `C-u C-u
-C-M-x` or `C-u C-u C-c C-c`.
+You can also have CIDER insert the break condition into your code for
+you. Place the point where you want the condition to go and evaluate
+with `C-u C-u C-M-x` or `C-u C-u C-c C-c`. CIDER will then prompt you
+for the condition in the minibuffer and insert the appropriate `#dbg`
+plus metadata annotation in your code. Note that you'll have to delete
+this annotation by hand; you cannot simply use <kbd>C-M-x</kbd> as you
+can to un-instrument <kbd>C-u C-M-x</kbd>.
-## Internal Details
+## Debugger Internals
!!! Note
This section explains a bit of the inner workings of the debugger. It is
- intended mostly to help those who are interested in contributing, and doesn't
+ intended to help those who are interested in contributing, and doesn't
teach anything about the debugger's usage.
-The CIDER debugger works in several steps:
+CIDER works in several steps as it instruments your code:
-1. First it walks through the user's code, adding metadata to forms and symbols
+1. First, CIDER walks through the code, adding metadata to forms and symbols
that identify their position (coordinate) in the code.
-2. Then it macroexpands everything to get rid of macros.
-3. Then it walks through the code again, instrumenting it. That involves a few things.
- - It understands all existing special forms, and takes care not to instrument
- where it's not supposed to. For instance, the arglist of a `fn*` or the
- left-side of a `let`-binding.
- - Wherever it finds the previously-injected metadata (if that place is valid
- for instrumentation) it wraps the form/symbol in a macro called
- `breakpoint-if-interesting`.
-
-4. When the resulting code actually gets evaluated by the Clojure compiler, the
- `breakpoint-if-interesting` macro will be expanded. This macro decides
- whether the return value of the form/symbol in question is actually something
- the user wants to see (see below). If it is, the form/symbol gets wrapped in
- the `breakpoint` macro, otherwise it's returned as is.
-5. The `breakpoint` macro takes that coordinate information that was provided in
- step `1.` and sends it over to Emacs (the front-end). It also sends the return
- value of the form and a prompt of available commands. Emacs then uses this
- information to show the value of actual code forms and prompt for the next
- action.
-
-
-A few example of forms that don't have interesting return values (and so are not
+2. Then, it macroexpands everything to get rid of macros.
+3. Then, it walks through the code again, instrumenting it.
+ - CIDER understands all existing special forms and takes care not
+ to instrument where it's not supposed to. For instance, CIDER
+ does not instrument the arglist of `fn*` or the left-side of a
+ `let`-binding.
+ - Wherever it finds the previously-injected metadata, assuming
+ that location is valid for instrumentation, it wraps the
+ form or symbol in a macro called `breakpoint-if-interesting`.
+4. When the resulting code actually gets compiled, the Clojure
+ compiler will expand the `breakpoint-if-interesting` macros. This
+ macro decides whether the return value of the form or symbol is
+ actually something the user might want to see. If it is, the
+ form or symbol gets wrapped in a `breakpoint` macro, otherwise it's
+ returned as is.
+5. The `breakpoint` macro takes the coordinate information that was
+ provided in step `1.` and sends it over to Emacs (the
+ front-end). It also sends the return value of the form and a prompt
+ of available commands. Emacs then uses this information to show the
+ value of actual code forms and prompt for the next action.
+
+A few example forms that don't have interesting return values (and so are not
wrapped in a `breakpoint`):
- In `(fn [x] (inc x))` the return value is a function object and carries no
@@ -185,8 +201,9 @@ wrapped in a `breakpoint`):
**call** this function (which **is** interesting). Also, even those this form
is not wrapped in a breakpoint, the forms inside it **are** (`(inc x)` and
`x`).
-- Similarly, in a form like `(map inc (range 10))`, the symbol `inc` points to a
- function in `clojure.core`. That's also irrelevant (unless it's being shadowed
- by a local, but the debugger can identify that).
+- Similarly, in a form like `(map inc (range 10))`, the symbol `inc`
+ points to a function in `clojure.core`. That's also irrelevant
+ (unless it's being shadowed by a local, but the debugger can
+ identify that).
[Edebug]: http://www.gnu.org/software/emacs/manual/html_node/elisp/Edebug.html
diff --git a/doc/faq.md b/doc/faq.md
index ac130e8..97f7e77 100644
--- a/doc/faq.md
+++ b/doc/faq.md
@@ -30,7 +30,7 @@ version before the time we started relying on nREPL middleware.
## What's the relationship between CIDER and inf-clojure?
-There's pretty much no relationship. `inf-clojure` provides a REPL based on the
+There's pretty much no relationship. [inf-clojure][] provides a REPL based on the
`comint` Emacs package - you're basically running an external REPL process
inside of Emacs (there's no network connectivity involved). The advantage of
this is that you have no external dependencies what-so-ever - you just need some
@@ -155,3 +155,5 @@ There are many ways in which you can help CIDER
* File bug reports and suggestions for improvements
* Promote CIDER via blog posts or at meetups and conferences
* Invite members of the CIDER team to speak about CIDER at meetups and conferences
+
+[inf-clojure]: https://github.com/clojure-emacs/inf-clojure
diff --git a/doc/hacking_on_cider.md b/doc/hacking_on_cider.md
index f260f51..163e699 100644
--- a/doc/hacking_on_cider.md
+++ b/doc/hacking_on_cider.md
@@ -30,10 +30,11 @@ Then:
```el
;; load CIDER from its source code
(add-to-list 'load-path "~/projects/cider")
-(require 'cider)
-(require 'cider-autoloads)
+(load "cider-autoloads" t t)
```
+If you want to compile **and** generate autoloads, just run `make`.
+
### Changing the code
It's perfectly fine to load CIDER from `package.el` and then to start making
diff --git a/doc/images/cider_architecture.png b/doc/images/cider_architecture.png
index 97704d0..fb681f8 100644
--- a/doc/images/cider_architecture.png
+++ b/doc/images/cider_architecture.png
Binary files differ
diff --git a/doc/indent_spec.md b/doc/indent_spec.md
index cf10128..9f68845 100644
--- a/doc/indent_spec.md
+++ b/doc/indent_spec.md
@@ -4,7 +4,7 @@ An indent spec can be used to specify intricate indentation rules for the more
complex macros (or functions). It is provided as a value in the var metadata,
under the `:style/indent` key.
-```clj
+```clojure
(defmacro with-in-str
"[DOCSTRING]"
{:style/indent 1}
@@ -43,7 +43,7 @@ One very simple example is the `do` form. All of its arguments get the same
indentation, and none of them are special. So its indent spec is simply `[0]`,
or `0` for short.
-```clj
+```clojure
(do
(something)
(quick))
@@ -67,7 +67,7 @@ Let's see something more sophisticated. If the `defrecord` indent spec used by
- All remaining arguments have an internal indent spec of `[1]` (which means
only the arglist is indented specially and the rest is the body).
-```clj
+```clojure
(defrecord Thing [a]
FileNameMap
(getContentTypeFor [_ file-name]
@@ -84,7 +84,7 @@ For something even more complicated: `letfn` is `[1 [[:defn]] :form]`. This mean
_inside_ the first arg have an indent spec of `[:defn]`.
- The second argument, and all other arguments, are regular forms.
-```clj
+```clojure
(letfn [(twice [x]
(* x 2))
(six-times [y]
@@ -102,7 +102,7 @@ placed on a separate line with additional indentation.
For instance, `defrecord` has two special arguments, and here's how it might be indented:
-```clj
+```clojure
(defrecord TheNameOfTheRecord
[a pretty long argument list]
SomeType
@@ -112,7 +112,7 @@ For instance, `defrecord` has two special arguments, and here's how it might be
Here's another way one could do it:
-```clj
+```clojure
(defrecord TheNameOfTheRecord
[a pretty long argument list]
SomeType
diff --git a/doc/index.md b/doc/index.md
index 65df244..cbe6be9 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -47,13 +47,13 @@ CIDER's basic architecture looks something like this:
Clojure code gets executed by an nREPL server. CIDER sends requests to the
server and processes its responses. The server's functionality is augmented by
-additional nREPL middleware, designed specifically to address the needs of an
+additional [nREPL middleware][cider-nrepl], designed specifically to address the needs of an
interactive development environment like CIDER.
!!! Note
- Much of the middleware we originally
+ Much of the nREPL middleware we originally
developed for CIDER is editor-agnostic and is being used by other Clojure
development environments as well (e.g. [vim-fireplace][] & [calva][]).
@@ -100,5 +100,4 @@ CIDER packs plenty of features. Here are some of them (in no particular order):
[calva]: https://github.com/BetterThanTomorrow/calva
[cider-nrepl]: https://github.com/clojure-emacs/cider-nrepl
[clojure-mode]: https://github.com/clojure-emacs/clojure-mode
-[inf-clojure]: https://github.com/clojure-emacs/inf-clojure
[which-key]: https://github.com/justbur/emacs-which-key
diff --git a/doc/installation.md b/doc/installation.md
index 6933855..6972933 100644
--- a/doc/installation.md
+++ b/doc/installation.md
@@ -1,30 +1,41 @@
-## CIDER's nREPL middleware
+## CIDER's nREPL Middleware
-Much of CIDER's functionality depends on the presence of CIDER's own
-[nREPL
+Much of CIDER's functionality depends on its own [nREPL
middleware](https://github.com/clojure-emacs/cider-nrepl). Starting
-with version 0.11, When `cider-jack-in` (<kbd>C-c C-x (C-)j (C-)j</kbd>) is used,
-CIDER takes care of injecting it and its other dependencies.
+with version 0.11, `cider-jack-in` (<kbd>C-c C-x (C-)j (C-)j</kbd>)
+automatically injects this middle and other dependencies as required.
-**`profiles.clj` or `profile.boot` don't need to be modified anymore for the above use case!**
+!!! Note
+ In the past, if you were setting up CIDER, you might have had to
+ modify `profiles.clj` or `profile.boot`. CIDER now handles
+ everything automatically and you don't need to add anything
+ special to these files.
-If you don't want `cider-jack-in` to inject dependencies automatically, set
-`cider-inject-dependencies-at-jack-in` to `nil`. Note that you'll have to setup
-the dependencies yourself (see the section below), just as in CIDER 0.10 and older.
+!!! Tip
+
+ If you don't want `cider-jack-in` to inject dependencies automatically, set
+ `cider-inject-dependencies-at-jack-in` to `nil`. Note that you'll have to setup
+ the dependencies yourself (see the section below), just as in CIDER 0.10 and older.
CIDER can also inject a Clojure dependency into your project, which is useful,
for example, if your project defaults to an older version of Clojure than that
supported by the CIDER middleware. Set `cider-jack-in-auto-inject-clojure`
appropriately to enable this.
-If a standalone REPL is preferred, you need to invoke `cider-connect` (instead
-of `cider-jack-in`) and you'll need to manually add the dependencies to your
-Clojure project (explained in the following section).
+If you prefer a standalone REPL, you will need to invoke
+`cider-connect` instead of `cider-jack-in` and manually add the
+dependencies to your Clojure project (explained in the following
+section).
-### Setting up a standalone REPL
+### Setting Up a Standalone REPL
#### Using Leiningen
+!!! Note
+
+ It's highly recommended to use Leiningen 2.8.3 or newer, as 2.8.3 is the first
+ release to ship with nREPL 0.5.
+
Use the convenient plugin for defaults, either in your project's
`project.clj` file or in the :repl profile in `~/.lein/profiles.clj`.
@@ -35,7 +46,7 @@ Use the convenient plugin for defaults, either in your project's
A minimal `profiles.clj` for CIDER would be:
```clojure
-{:repl {:plugins [[cider/cider-nrepl "0.18.0"]]}}
+{:repl {:plugins [[cider/cider-nrepl "0.19.0"]]}}
```
!!! warning
@@ -46,6 +57,11 @@ A minimal `profiles.clj` for CIDER would be:
#### Using Boot
+!!! Note
+
+ It's highly recommended to use Boot 2.8.2 or newer, as 2.8.2 is the first
+ release to ship with nREPL 0.4.
+
Boot users can configure the tool to include the middleware automatically in
all of their projects using a `~/.boot/profile.boot` file like so:
@@ -53,7 +69,7 @@ all of their projects using a `~/.boot/profile.boot` file like so:
(require 'boot.repl)
(swap! boot.repl/*default-dependencies*
- concat '[[cider/cider-nrepl "0.18.0"]])
+ concat '[[cider/cider-nrepl "0.19.0"]])
(swap! boot.repl/*default-middleware*
conj 'cider.nrepl/cider-middleware)
@@ -61,9 +77,9 @@ all of their projects using a `~/.boot/profile.boot` file like so:
For more information visit [boot-clj wiki](https://github.com/boot-clj/boot/wiki/Cider-REPL).
-### Using embedded nREPL server
+### Using Embedded nREPL Server
-If you're embedding nREPL in your application you'll have to start the
+If you're embedding nREPL in your application, you'll have to start the
server with CIDER's own nREPL handler.
```clojure
@@ -80,8 +96,11 @@ It goes without saying that your project should depend on `cider-nrepl`.
!!! note
- `x.y.z` should be compatible with the version of CIDER you're currently using.
- The required version can be checked in `cider-required-middleware-version`.
Prior to CIDER 0.18, CIDER and cider-nrepl were always released together
- and their versions had to match for things to work, but as the prominence
- of cider-nrepl grew and many other tools started using, this was changed.
+ and their versions had to match for things to work. But as the prominence
+ of cider-nrepl grew and many other tools started using it, the two
+ projects evolved separately and are no longer in tight
+ lock-step. Any recent version of cider-nrepl should be compatible
+ with a recent version of CIDER. You can check the required version
+ of cider-nrepl for your version of CIDER by looking at
+ `cider-required-middleware-version`.
diff --git a/doc/interactive_programming.md b/doc/interactive_programming.md
index 92906d0..5474d5f 100644
--- a/doc/interactive_programming.md
+++ b/doc/interactive_programming.md
@@ -1,16 +1,36 @@
-The idea of interactive programming is at the very heart of CIDER.
+Traditional programming languages and development environments often
+use a [Edit, Compile, Run
+Cycle](http://wiki.c2.com/?EditCompileLinkRun). In this environment,
+the programmer modifies the code, compiles it, and then runs it to see
+if it does what she wants. The program is then terminated, and the
+programmer goes back to editing the program further. This cycle is
+repeated over and over until the program behavior conforms to what the
+programmer desires. While modern IDEs have optimized this process to
+be quick and relatively painless, it's still a slow way to work.
-Programmers are expected to program in a very dynamic and incremental manner,
-constantly re-evaluating existing Clojure definitions and adding new ones to
-their running applications. You never stop/start a Clojure application while
-using CIDER - you're constantly interacting with it and changing it.
+Clojure and CIDER offer a better way to work called *interactive
+programming*. Indeed, this idea is at the very heart of CIDER.
-CIDER comes with a handy minor mode called `cider-mode` (complementing
-`clojure-mode`) that allows you to evaluate code in your Clojure source
-files and load it directly in the REPL. `cider-mode` is the primary
-way you're supposed to be interacting with your REPL process. If you
-want to get productive with CIDER, you'll have to get intimately familiar
-with it.
+Using CIDER's interactive programming environment, a programmer works
+in a very dynamic and incremental manner. Instead of repeatedly
+editing, compiling, and restarting an application, the programmer
+starts the application once and then adds and updates individual
+Clojure defintions as the program continues to run. Using the CIDER
+REPL, the programmer can access the value of different definitions and
+invoke program functions with test data, immediately seeing the
+result. This methodology is far more efficient than the typical Edit,
+Compile, and Run Cycle because the program continues to run and keeps
+its state intact while the programmer interacts with it. Indeed, some
+Clojure programmers have been known to keep a CIDER session running
+for weeks or even months as they continue to write code.
+
+CIDER's interactive programming environment is partially implemented
+using an Emacs minor mode called `cider-mode`. `cider-mode`
+complements `clojure-mode` and allows you to evaluate Clojure code
+from your source file buffers and send it directly to your running
+program through the CIDER REPL. Using the functions offered by
+`cider-mode` will improve your productivity and make you a more
+efficient Clojure programmer.
## Using cider-mode
@@ -72,8 +92,8 @@ Here's a list of `cider-mode`'s keybindings:
!!! Tip
- There's no need to memorize this list. In any Clojure buffer with `cider-mode`
- active you'll have a CIDER menu available, which lists all the most important
+ There's no need to memorize this list. If you're in a Clojure buffer with `cider-mode`
+ active you'll have a CIDER menu available. The menu lists all the most important
commands and their keybindings. You can also invoke `C-h f RET cider-mode` to
get a list of the keybindings for `cider-mode`.
@@ -84,10 +104,40 @@ Here's a list of `cider-mode`'s keybindings:
An even better solution would be to install [which-key][], which will
automatically show you a list of available keybindings as you start typing some
- keys. This will simplify your interactions with CIDER quite a lot (especially in
- the beginning). Here's what you'd see if you typed <kbd>C-c C-d</kbd> in a
+ keys. This will simplify your interactions with CIDER quite a lot,
+ especially in
+ the beginning. Here's what you'd see if you typed <kbd>C-c C-d</kbd> in a
Clojure buffer:
![CIDER which-key](images/cider-which-key.png)
+
+!!! Tip
+
+ `cider-find-var` has built-in support for [AVFS][]. AVFS is an a virtual
+ file system which allows seamless navigation within archives as if they were
+ normal directories. When AVFS is mounted, `cider-find-var` automatically
+ opens `jar` and `zip` files inside AVFS folder instead of attempting to
+ uncompress the archive.
+
+ On Linux-based systems, AVFS is available through the standard
+ package managers. For example, on Debian derivatives:
+
+ `sudo apt-get install avfs`
+
+ Once installed, you can put `mountavfs` in a place where it will
+ be invoked
+ automatically during the startup (`.bash_profile`, for
+ instance). You can also initialize the
+ `avfsd` daemon directly like this:
+
+ `/usr/bin/avfsd -o allow_root -o intr -o sync_read .avfs`
+
+ [AVFS][] is not available on Windows but can be installed on MacOS with [some
+ effort](http://blog.breadncup.com/tag/sunrise-commander/). Some other uses of
+ [AVFS][] in Emacs include
+ [dired-avfs](https://github.com/Fuco1/dired-hacks#dired-avfs) and
+ [sunrise-commander](https://www.emacswiki.org/emacs/Sunrise_Commander_Tips#toc12).
+
[which-key]: https://github.com/justbur/emacs-which-key
+[AVFS]: http://avf.sourceforge.net
diff --git a/doc/managing_connections.md b/doc/managing_connections.md
index 1b01c58..1e0fa10 100644
--- a/doc/managing_connections.md
+++ b/doc/managing_connections.md
@@ -24,7 +24,7 @@ Add new REPLs to the current session with
- <kbd>C-c C-x s j</kbd> `cider-connect-sibling-clj`
- <kbd>C-c C-x s s</kbd> `cider-connect-sibling-cljs`
-Session life-cycle management commands live in the [Sesman] map (<kbd>C-c
+Session life-cycle management commands live on the [Sesman] map (<kbd>C-c
C-s</kbd>)
- <kbd>C-c C-s s</kbd> `sesman-start`
@@ -50,11 +50,27 @@ Sessions can be linked to contexts (projects, directories and buffers)
- <kbd>C-c C-s p</kbd> `sesman-link-with-project`
- <kbd>C-c C-s u</kbd> `sesman-unlink`
+## Friendly Sessions
+
+[Sesman] defines "friendly" session to allow for on-the-fly operation on
+sessions from contexts where there are no explicit links. In CIDER friendly
+sessions are defined by the project dependencies. For example when you use
+`cider-find-var` (<kbd>M-.</kbd>) to navigate to a var definition in a
+dependency project the current project's session becomes a friendly session for
+the dependency.
+
+When you evaluate some code from a dependency project and there are no explicit
+links in that project, the most recent friendly session is used to evaluate the
+code. Explicitly linked sessions have precedence over the friendly sessions.
+
+You can disable friendly session inference by customizing
+`sesman-use-friendly-sessions`.
+
## Displaying Session Info
-Retrieve info on all linked with the current context sessions with <kbd>C-c C-s
-i</kbd> (`sesman-info`). On <kbd>C-u</kbd>, display info for all CIDER
-sessions. For the connection specific information use CIDER's built-in
+Get info on all linked and friendly sessions in the current context with
+<kbd>C-c C-s i</kbd> (`sesman-info`). On <kbd>C-u</kbd>, display info on all
+CIDER sessions. For the connection specific information use CIDER's built-in
`cider-describe-connection` (<kbd>C-c M-d</kbd>).
An interactive view of all CIDER sessions is available through the
@@ -64,8 +80,9 @@ An interactive view of all CIDER sessions is available through the
All CIDER commands (evaluation, completion, switching to REPL etc.) operate on
the relevant REPL within the current session. The current session is the most
-relevant session among all linked session. Session relevance is decided by the
-specificity of the linked contexts and recency of the REPL buffers.
+relevant session among all linked session (or friendly sessions when no links
+exist). Session relevance is decided by the specificity of the linked contexts
+and recency of the REPL buffers.
If the current context is linked to a single session then that session is the
current one. If multiple sessions are linked to a context (say, a project) then
diff --git a/doc/miscellaneous_features.md b/doc/miscellaneous_features.md
index 499aedc..05111a2 100644
--- a/doc/miscellaneous_features.md
+++ b/doc/miscellaneous_features.md
@@ -1,64 +1,59 @@
-CIDER packs a ton of extra functionality, besides basic Clojure code
-evaluation. Much of the functionality is centered around additional major modes,
-which provide you with convenient ways to get something done or inspect
-something.
+As the infomercials always say, "But wait, there's more!" If
+simultaneous Clojure and ClojureScript REPLs, interactive programming,
+code completion, stacktrace navigation, test running, and debugging
+weren't enough for you, CIDER delivers several additional
+features.
-## Evaluating Clojure code in the minibuffer
+## Evaluating Clojure Code in the Minibuffer
-You can evaluate Clojure code in the minibuffer from pretty much everywhere by
+You can evaluate Clojure code in the minibuffer at almost any time
using <kbd>M-x</kbd> `cider-read-and-eval` (bound in `cider-mode` buffers to
<kbd>C-c M-:</kbd>). <kbd>TAB</kbd> completion will work in the minibuffer,
-just as in a REPL/source buffer.
+just as in REPL and source buffers.
-Pressing <kbd>C-c C-v .</kbd> in a Clojure buffer will insert the defun
+Typing <kbd>C-c C-v .</kbd> in a Clojure buffer will insert the defun
at point into the minibuffer for evaluation. This way you can pass arguments
to the function and evaluate it and see the result in the minibuffer.
-You can also enable `eldoc-mode` in the minibuffer by adding the following to your
-config:
+You can also enable other convenient modes in the minibuffer. For
+instance, you might want to have both `eldoc-mode` and `paredit-mode`
+available to you:
```el
(add-hook 'eval-expression-minibuffer-setup-hook #'eldoc-mode)
-```
-
-You can also enable `paredit` or `smartparens` for minibuffer evaluations:
-
-```el
(add-hook 'eval-expression-minibuffer-setup-hook #'paredit-mode)
```
-## Using a scratchpad
+## Using a Scratchpad
CIDER provides a simple way to create a Clojure scratchpad via the
-<kbd>M-x</kbd> `cider-scratch` command. It provides a great way to
-play around with some code, without having to create source files
-or pollute the REPL buffer.
+<kbd>M-x</kbd> `cider-scratch` command. This is a great way to play
+around with some code without having to create source files or pollute
+the REPL buffer and is very similar to Emacs's own `*scratch*` buffer.
-In many ways the CIDER scratchpad is similar to Emacs's own `*scratch*` buffer.
+## Expanding Macros
-## Macroexpansion
-
-Pressing <kbd>C-c C-m</kbd> after some form in a source buffer or the REPL will
-result in a new buffer, showing the macroexpansion of the form in
-question. You'll have access to additional keybindings in the macroexpansion
-buffer (which is internally using `cider-macroexpansion-mode`):
+Typing <kbd>C-c C-m</kbd> after some form in a source buffer or the
+REPL will show you the macro expansion of the form in a new
+buffer. You'll have access to additional keybindings in the macro
+expansion buffer (which is internally using
+`cider-macroexpansion-mode`):
Keyboard shortcut | Description
----------------------------------|-------------------------------
<kbd>m</kbd> | Invoke `macroexpand-1` on the form at point and replace the original form with its expansion. If invoked with a prefix argument, `macroexpand` is used instead of `macroexpand-1`.
<kbd>a</kbd> | Invoke `clojure.walk/macroexpand-all` on the form at point and replace the original form with its expansion.
-<kbd>g</kbd> | The prior macroexpansion is performed again and the current contents of the macroexpansion buffer are replaced with the new expansion.
-<kbd>C-/</kbd> <br/> <kbd>u</kbd> | Undo the last inplace expansion performed in the macroexpansion buffer.
-
-## Value inspection
+<kbd>g</kbd> | The prior macro expansion is performed again and the current contents of the macro expansion buffer are replaced with the new expansion.
+<kbd>C-/</kbd> <br/> <kbd>u</kbd> | Undo the last in-place expansion performed in the macroexpansion buffer.
-Pressing <kbd>C-c M-i</kbd> after some form in a source buffer or the REPL will
-result in a new buffer, showing the structure of the result of the form in question.
-You can also use <kbd>C-u C-c M-i</kbd> to inspect the result of the current top-level
-form and <kbd>C-u C-u C-c M-i</kbd> to read an expression from the minibuffer and
-inspect its result.
+## Inspecting Values
-You'll have access to additional keybindings in the inspector buffer (which is
+Typing <kbd>C-c M-i</kbd> after some form in a source buffer or the
+REPL will show you the structure for the result of the form in a new
+buffer. You can also use <kbd>C-u C-c M-i</kbd> to inspect the result
+of the current top-level form and <kbd>C-u C-u C-c M-i</kbd> to read
+an expression from the minibuffer and inspect its result. You'll have
+access to additional keybindings in the inspector buffer (which is
internally using `cider-inspector-mode`):
Keyboard shortcut | Description
@@ -71,31 +66,52 @@ Keyboard shortcut | Description
<kbd>M-SPC</kbd> | Jump to previous page in paginated view
<kbd>s</kbd> | Set a new page size in paginated view
-## Enlighten (display local values)
+## Displaying Local Values with Enlighten Mode
-This feature displays the value of locals in realtime, as your code is being
-executed. This is somewhat akin to one of the features of the Light Table
+Enlighten Mode displays the value of locals in realtime, as your code
+runs. This feature is somewhat similar to a feature in the Light Table
editor.
-- To turn it on, issue <kbd>M-x</kbd> `cider-enlighten-mode`.
-- To use it, evaluate your functions one at a time (e.g., use <kbd>C-M-x</kbd> or
-<kbd>C-x C-e</kbd>, because <kbd>C-c C-k</kbd> won't work).
+To turn it on, issue <kbd>M-x</kbd> `cider-enlighten-mode`. Then,
+evaluate your functions one at a time using <kbd>C-M-x</kbd> or
+<kbd>C-x C-e</kbd>. Note that <kbd>C-c C-k</kbd> won't work.
That's it! Once your code executes, the regular old buffer on the left will turn
into the brilliant show of lights on the right.
-<p align="center">
- <img src="images/enlighten_disabled.png" height="300" />
- <img src="images/enlighten_enabled.png" height="300" />
-</p>
+Enlighten Mode Disabled | Enlighten Mode Enabled
+-------------------------------------------|---------------------------------------
+![Disabled](images/enlighten_disabled.png) | ![Enabled](images/enlighten_enabled.png)
To stop displaying the locals you'll have to disable `cider-enlighten-mode`
and reevaluate the definitions you had instrumented previously.
You can also trigger this on specific functions (without having to turn on the
-minor mode) by writing `#light` before the `(def` and reevaluating it.
+minor mode) by writing `#light` before the `(def` and re-evaluating
+it.
+
+## Reloading Code
-## Code reloading
+While Clojure's and CIDER's interactive programming style means you'll
+restart your application far less often than with other languages and
+development environments, sometimes you'll want to clean everything up
+and reload one or more namespaces to ensure that they are up to date
+and there are no temporary definitions hanging around.
+
+Typing <kbd>C-c M-n r</kbd> or <kbd>C-c M-n M-r</kbd> will invoke
+`cider-ns-refresh` and reload all modified Clojure files on the
+classpath.
+
+Adding a prefix argument, <kbd>C-u C-c M-n n</kbd>, will reload all
+the namespaces on the classpath unconditionally, regardless of their
+modification status.
+
+Adding a double prefix argument, <kbd>C-u C-u M-n n</kbd>, will first
+clear the state of the namespace tracker before reloading. This is
+useful for recovering from some classes of error that normal reloads
+would otherwise not recover from. A good example is circular
+dependencies. The trade-off is that stale code from any deleted files
+may not be completely unloaded.
`cider-ns-refresh` wraps
[clojure.tools.namespace](https://github.com/clojure/tools.namespace), and as
@@ -105,11 +121,6 @@ and
[caveats](https://github.com/clojure/tools.namespace#reloading-code-preparing-your-application)
regarding writing reloadable code also apply.
-Calling `cider-ns-refresh` will cause all modified Clojure files on the classpath
-to be reloaded. You can also provide a single prefix argument to reload all
-Clojure files on the classpath unconditionally, or a double prefix argument to
-first clear the state of the namespace tracker before reloading.
-
The above three operations are analogous to
[`clojure.tools.namespace.repl/refresh`](http://clojure.github.io/tools.namespace/#clojure.tools.namespace.repl/refresh),
[`clojure.tools.namespace.repl/refresh-all`](http://clojure.github.io/tools.namespace/#clojure.tools.namespace.repl/refresh-all)
@@ -117,55 +128,62 @@ and
[`clojure.tools.namespace.repl/clear`](http://clojure.github.io/tools.namespace/#clojure.tools.namespace.repl/clear)
(followed by a normal refresh), respectively.
-* You can define Clojure functions to be called before reloading, and after a
- successful reload, when using `cider-ns-refresh`:
+You can define Clojure functions to be called before reloading, and after a
+successful reload, when using `cider-ns-refresh`:
```el
(setq cider-ns-refresh-before-fn "user/stop-system!"
cider-ns-refresh-after-fn "user/start-system!")
```
-* These must be set to the namespace-qualified names of vars bound to functions
- of no arguments. The functions must be synchronous (blocking), and are
- expected to be side-effecting - they will always be executed serially, without
- retries.
+These must be set to the namespace-qualified names of vars bound to
+functions of no arguments. The functions must be synchronous
+(blocking), and are expected to be side-effecting - they will always
+be executed serially, without retries.
-* By default, messages regarding the status of the in-progress reload will be
- displayed in the echo area after you call `cider-ns-refresh`. The same
- information will also be recorded in the `*cider-ns-refresh-log*` buffer, along
- with anything printed to `*out*` or `*err*` by `cider-ns-refresh-before-fn` and
- `cider-ns-refresh-start-fn`.
+By default, messages regarding the status of the in-progress reload
+will be displayed in the echo area after you call
+`cider-ns-refresh`. The same information will also be recorded in the
+`*cider-ns-refresh-log*` buffer, along with anything printed to
+`*out*` or `*err*` by `cider-ns-refresh-before-fn` and
+`cider-ns-refresh-start-fn`.
-* You can make the `*cider-ns-refresh-log*` buffer display automatically after you
- call `cider-ns-refresh` by setting the `cider-ns-refresh-show-log-buffer` variable
- to a non-nil value (this will also prevent any related messages from also
- being displayed in the echo area):
+You can make the `*cider-ns-refresh-log*` buffer display automatically
+after you call `cider-ns-refresh` by setting the
+`cider-ns-refresh-show-log-buffer` variable to a non-nil value. This
+will also prevent any related messages from also being displayed in
+the echo area.
```el
(setq cider-ns-refresh-show-log-buffer t)
```
-* By default, all modified Clojure buffers are prompted to be saved. This
- behaviour can be customized using `cider-ns-save-files-on-refresh`.
+By default, CIDER will prompt for whether to save all modified Clojure
+buffers. You can customize this behavior with
+`cider-ns-save-files-on-refresh`.
-In case `cider-ns-refresh` does not work for you the
-`cider-ns-reload`|`cider-ns-reload-all` commands can be used instead: they will
-evaluate the Clojure's out of the box `(require ... :reload|:reload-all)` at
-the REPL.
+Sometimes, `cider-ns-refresh` may not work for you. If you're looking
+for a bit more forceful reloading the `cider-ns-reload`
+and `cider-ns-reload-all` commands can be used instead. These commands
+invoke Clojure's `(require ... :reload)` and `(require
+... :reload-all)` commands at the REPL.
-## Tracing function execution
+## Tracing Function Execution
-You can trace the results produced by functions using <kbd>C-c M-t v</kbd>. The
-command will prompt you for the name of the function you want to trace.
-Evaluating the command again for the same function will result in the function
-being untraced.
+You can trace the arguments supplied to and the result values produced
+by functions using <kbd>C-c M-t v</kbd>. CIDER will prompt you for the
+name of the function you want to trace, defaulting to the previous
+top-level definition.
![Tracing](images/tracing.png)
-You can also use <kbd>C-c M-t n</kbd> to toggle tracing on and off for an entire
-namespace.
+Invoking <kbd>C-c M-t v</kbd> again for the same function will result
+in the function being untraced.
+
+You can also use <kbd>C-c M-t n</kbd> to toggle tracing on and off for
+an entire namespace.
-## Classpath browser
+## Browsing the Classpath
You can easily browse the items on your classpath with the command
<kbd>M-x</kbd> `cider-classpath`.
@@ -176,10 +194,10 @@ Here you can see it in action:
Press <kbd>RET</kbd> on a classpath entry to navigate into it.
-## Namespace browser
+## Browsing Namespaces
You can browse the contents of any loaded namespace with the command
-<kbd>M-x</kbd> `cider-browse-ns`. The command will prompt you for the namespace
+<kbd>M-x</kbd> `cider-browse-ns`. CIDER will prompt you for the namespace
to browse.
![Namespace Browser](images/ns_browser.png)
@@ -198,22 +216,24 @@ Keyboard shortcut | Description
<kbd>n</kbd> | Go to next line.
<kbd>p</kbd> | Go to previous line.
-## Spec browser
+## Browsing the Clojure Spec Registry
-If you are using Clojure 1.9.0-alpha16 or newer you can browse the Clojure specs registry.
+If you are using Clojure 1.9 or newer you can browse the Clojure spec registry.
-If you know what you are looking for, you can type <kbd>M-x</kbd> `cider-browse-spec`.
-It will prompt you for a spec name to browse to, hit <kbd>RET</kbd> and you will find yourself
-at the spec browser.
+If you already know which spec you're looking for, you can type
+<kbd>M-x</kbd> `cider-browse-spec` and CIDER will prompt you for a
+spec name and then drop you into the spec browser.
![Spec Browser](images/spec_browser.png)
-You can also type the command <kbd>M-x</kbd> `cider-browse-spec-all`. This command will prompt you for
-a regex you can use to filter out the specs you are interested in, and will also take you to the spec browser.
+If you aren't quite sure which spec you want, you can type
+<kbd>M-x</kbd> `cider-browse-spec-all`. CIDER will then prompt you for
+a regex and will filter out all the spec names that don't match.
![Spec Browser](images/spec_browser_all.png)
-Once in the browser you can use your mouse or the keybindings below to navigate deeper into sub specs.
+Once in the browser you can use your mouse or the keybindings below to
+navigate deeper.
Keyboard shortcut | Description
--------------------------------|-------------------------------
@@ -223,27 +243,22 @@ Keyboard shortcut | Description
<kbd>p</kbd> | Go to previous spec.
<kbd>e</kbd> | Generate an example for the current browser spec.
-If your project contains a version of `org.clojure/test.check`, you can type <kbd>e</kbd> when browsing
-a spec to generate and print an example of it.
+If your project includes the `org.clojure/test.check` library, you can
+type <kbd>e</kbd> when browsing a spec to generate an example that
+meets the spec.
![Spec Browser Example](images/spec_browser_gen_example.png)
-## Documentation buffers include "See Also" references
-
-You can add references to other vars by including their names in `` ` `` in the docstring.
-If the var is in another namespace, then you'll have to include the full
-namespace qualified name in the docstring. If you want to use some other delimiter instead
-of the backticks, you'll have to update the value of `cider-doc-xref-regexp` to match that.
-The first group of the regexp should always match the var name.
+## Generating Documentation Cross References
-As an example, if you want to want to use the delimiter style used by
-[Codox](https://github.com/weavejester/codox) (`[[...]]`) the regexp would be;
+Sometimes in your documentation strings, you'd like to be able to
+point other programmers at different definitions. If you specify the
+name of a definition in backticks (`` ` ``), CIDER will convert these
+references into live links when it displays the documentation string
+in the documentation buffer.
-```
-(setq cider-doc-xref-regexp "\\[\\[\\(.*?\\)\\]\\]")
-```
-
-![CIDER See Also](images/cider_see_also.gif)
+If the name is in another namespace, then you'll have to include the
+fully qualified name in the docstring.
Example function with a docstring containing references:
@@ -256,3 +271,18 @@ Example function with a docstring containing references:
[]
(+ 1 1))
```
+
+You can change the delimiters that CIDER uses to find references if
+you don't like using backticks. Simply update the regexp in
+`cider-doc-xref-regexp` to match your preferred format. The first
+group of the regexp should always match the cross-reference name. For
+example, if you want to want to use
+[Codox's](https://github.com/weavejester/codox) delimiter style
+(`[[...]]`) instead of backticks, the regexp would be:
+
+```
+(setq cider-doc-xref-regexp "\\[\\[\\(.*?\\)\\]\\]")
+```
+
+![CIDER See Also](images/cider_see_also.gif)
+
diff --git a/doc/navigating_stacktraces.md b/doc/navigating_stacktraces.md
index 14c3ff6..934ff5f 100644
--- a/doc/navigating_stacktraces.md
+++ b/doc/navigating_stacktraces.md
@@ -1,8 +1,10 @@
-CIDER comes with a powerful solution to the problem of verbose Clojure
-stacktraces. Stacktraces are presented in a special major mode
-(`cider-stacktrace-mode`), which gives you the possibility to filter out certain
-stack frames and some handy ways to navigate causes. You'll also be able to go
-to the code in question with a single keystroke.
+CIDER comes with a powerful solution for dealing with Clojure
+stacktraces. CIDER presents stack traces in a special major mode,
+`cider-stacktrace-mode`, which gives you gives you some key features:
+
+- the ability to filter out certain stack frames to reduce clutter
+- some handy ways to navigate to the cause of the exception
+- the ability to jump straight to code with a single keystroke
Command | Keyboard shortcut | Description
---------------------------------------|-------------------------------------|--------------
@@ -24,33 +26,33 @@ Command | Keyboard shortcut | D
`cider-stacktrace-show-only-project` |<kbd>p</kbd> | Toggle display only project frames
`cider-stacktrace-toggle-all` |<kbd>a</kbd> | Toggle display of all frames
-You can configure whether the error buffer with stacktraces should be automatically
-shown on error. By default it will be displayed, but you can change this:
+By default, when an exception occurs, CIDER will display the exception
+in an error buffer using `cider-stacktrace-mode`. You can suppress
+this behavior, however:
```el
(setq cider-show-error-buffer nil)
```
-At times, the error being displayed will originate from a bug in the
-CIDER code itself. These internal errors might frequently occur and
-interrupt your workflow, but you might not want to suppress **all**
-stacktrace buffers via the `cider-show-error-buffer` variable as
-above; instead, you might only want to suppress *this specific type*
-of internal error. The stacktrace buffers provide such an option when
-displaying an internal error. A toggle button will be displayed with
-the error type's name, and you can toggle whether this particular type
-of error will cause the stacktrace buffer to automatically show
-itself. The toggle button controls this behavior only during the
-current Emacs session, but if you would like to make the suppression
-more permanent, you can do so by customizing the
-`cider-stacktrace-suppressed-errors` variable. The buffer will also
-provide a direct link to the bug reporting page to help facilitate its
-diagnosis and repair.
+At times, the error being displayed will originate from a bug in CIDER
+itself. These internal errors might frequently occur and interrupt
+your workflow, but you might not want to suppress **all** stacktrace
+buffers by using `cider-show-error-buffer`. Instead, you might only
+want to suppress *this specific type* of internal error. The
+stacktrace buffers provide such an option when displaying an internal
+error. A toggle button will be displayed with the error type's name,
+and you can toggle whether this particular type of error will cause
+the stacktrace buffer to automatically show itself. The toggle button
+controls this behavior only during the current Emacs session, but if
+you would like to make the suppression more permanent, you can do so
+by customizing the `cider-stacktrace-suppressed-errors` variable. The
+buffer will also provide a direct link to the bug reporting page to
+help facilitate its diagnosis and repair.
Independently of the value of `cider-show-error-buffer` or
-`cider-stacktrace-suppressed-errors`, the error buffer is always
-generated in the background. Use `cider-selector` (`C-c M-s`) to visit
-this buffer.
+`cider-stacktrace-suppressed-errors`, CIDER always generates the error
+buffer in the background. You can use `cider-selector` (<kbd>C-c M-s</kbd>) to
+visit this buffer if you decide that you need to.
There are two more selective strategies for the error buffer:
@@ -59,18 +61,23 @@ There are two more selective strategies for the error buffer:
(setq cider-show-error-buffer 'only-in-repl)
```
-* To disable auto-selection of the error buffer when it's displayed:
+To disable auto-selection of the error buffer when it's displayed:
```el
(setq cider-auto-select-error-buffer nil)
```
-* Error buffer stacktraces may be filtered by default. Valid filter
-types include `java`, `clj`, `repl`, `tooling`, and `dup`. There are
-also "positive" filtering types. The value `project` will cause only
-project frames to be shown or `all` will force all stackframes to be
-shown. Note that `project` and `all` are mutually exclusive. Whichever
-one is first will determine the behavior if they are both present.
+CIDER helps you cut through the clutter of Clojure stacktraces by
+allowing you to apply a list of filters using the
+`cider-stacktrace-default-filters` variable. Valid filter types
+include `java`, `clj`, `repl`, `tooling`, and `dup`. Specifying one of
+these filters will remove the corresponding frames from the stacktrace
+display. There are also "positive" filtering types (reverse filters)
+that specify what should be shown. The value of `project`, for
+instance, will cause only project frames to be shown, and `all` will
+force all stackframes to be shown. Note that `project` and `all` are
+mutually exclusive. Whichever one is first will determine the behavior
+if they are both present.
```el
(setq cider-stacktrace-default-filters '(tooling dup))
@@ -78,9 +85,18 @@ one is first will determine the behavior if they are both present.
(setq cider-stacktrace-default-filters '(project))
```
-* Error messages may be wrapped for readability. If this value is nil, messages
-will not be wrapped; if it is truthy but non-numeric, the default `fill-column`
-will be used.
+Finally, CIDER can wrap error messages when they are displayed in a
+buffer to help improve their readability. CIDER uses
+`cider-stacktrace-fill-column` for this, which can take on three
+types of values:
+
+- `nil`: The error is not wrapped.
+- numeric: The error message is wrapped to the specified fill column.
+- Something truthy but non-numeric: The error message is wrapped using
+ the value of `fill-column`.
+
+The following will cause error messages to be wrapped to 80 columns,
+for instance:
```el
(setq cider-stacktrace-fill-column 80)
diff --git a/doc/running_tests.md b/doc/running_tests.md
index 7baf850..afa95c6 100644
--- a/doc/running_tests.md
+++ b/doc/running_tests.md
@@ -1,43 +1,84 @@
-## Running tests
-
-You can run `clojure.test` tests pretty quickly in CIDER. Pressing <kbd>C-c C-t
-n</kbd> or <kbd>C-c C-t C-n</kbd> in a source buffer or a REPL buffer will run
-the tests for the namespace you're currently in. CIDER is smart enough to figure
-out the namespace containing the tests. The inference logic works in a pretty
-simple manner - if you're in an implementation namespace (e.g. `some.ns`) CIDER
-will try to find a matching test namespace (by default `some.ns-test`) and run
-the tests there. On the other hand - if you're in something that looks like a
-test namespace (e.g. `some.ns-test`), then the command will simply run the tests
-in that namespace. From time to time, however, you might want to suppress the
-test namespace inference logic (e.g. you have some tests in the implementation
-namespace that were defined with `clojure.test/with-test`)
-- in such cases you should use <kbd>C-u C-c C-t C-n</kbd>, which will simply run
-whatever tests are present in the currently visited/active namespace.
-
-You can also press <kbd>C-c C-t C-s</kbd> to run a subset of the tests defined in
-the namespace filtered by test selectors. CIDER will ask you for those test selectors
-in the minibuffer. If you call this command with a prefix (<kbd>C-u C-c C-t C-s</kbd>)
-you can suppress the inference logic as for run tests for the namespace.
-
-You can also run all loaded tests with <kbd>C-c C-t l</kbd> or <kbd>C-c C-t
-C-l</kbd> and all tests within a project with <kbd>C-c C-t p</kbd> or <kbd>C-c
-C-t C-p</kbd> (note that this will load **all** namespaces in your
-project). If you call these two with a prefix CIDER will ask for test selector filters
-and only run those tests in the project which match the selector inclusions/exclusions. Using
-<kbd>C-c C-t t</kbd> or <kbd>C-c C-t C-t</kbd>, you can execute only the
-test at point.
-
-Test selectors are originally a `leiningen` feature - see `lein help test` for some explanation.
-People use them to define subsets of tests usually run together for different purposes. For
-example you can mark some of your tests with the `^:smoke` metadata marker others with
-`^:integration`. This enables you to run these tests separately in your build pipeline.
-This feature in CIDER helps you to run these test subsets in your development environment.
-
-All test commands are available in REPL buffers as well. There you can also use
+The Clojure ecosystem provides a lot of support for test-driven
+development (TDD) and other test-centric patterns. First, Clojure
+provides a standardized framework for developing tests called
+[clojure.test]. Many other testing libraries plug into this
+framework. Second, tools like Leiningen create standardized
+application and library project structures that provide locations and
+idiomatic naming for test code. Finally, CIDER provides several easy
+ways to run these tests, view the test results, and quickly jump to
+code that is failing to pass a given test.
+
+!!! NOTE
+
+ CIDER only supports clojure.test and other libraries
+ providing integration with clojure.test.
+
+## Running Tests
+
+CIDER has several functions that help you run all your tests or a
+selected subset of them. All of the CIDER test commands are available
+in both source code and REPL buffers. In REPL buffers you can also use
<kbd>,</kbd> to invoke some of the testing commands.
-In the buffer displaying the test execution results (`*cider-test-results*`)
-you'll have a bit of additional functionality at your disposal.
+First, you can run all the tests in your project with <kbd>C-c C-t p</kbd>
+or <kbd>C-c C-t C-p</kbd>. It's important to realize that this will
+load **all** the namespaces in your project, which might be more than
+you're expecting.
+
+You can run all *loaded* tests with <kbd>C-c C-t l</kbd> or
+<kbd>C-c C-t C-l</kbd>.
+
+If you invoke either of these commands with a prefix CIDER, will
+prompt for test selector filters and only run those tests that match
+the selector inclusions/exclusions.
+
+Test developers use selectors to define subsets of the total test
+suite that are run together for different testing tasks. For example
+you can mark some of your tests with the `^:smoke` metadata marker
+and others with `^:integration`. This enables you to run these tests
+separately in your build pipeline. CIDER helps you to run these same
+test subsets in your development environment.
+
+Test selectors were originally a `leiningen` feature and you can get
+more information by executing:
+
+```sh
+$ lein help test
+```
+
+You can run all the tests in the current namespace, whether specified
+by a source file or by the REPL, using <kbd>C-c C-t n</kbd> or
+<kbd>C-c C-t C-n</kbd>. Note that it's idiomatic for Clojure projects
+to locate tests in a separate namespace than the code that is being
+tested. CIDER uses a simple algorithm to figure out where the tests
+are located. The algorithm works as follows. If you're in an
+implementation namespace (e.g. `some.ns`), CIDER will try to find a
+matching test namespace (by default `some.ns-test`) and run the tests
+there. But if you're in something that already looks like a test
+namespace (e.g. `some.ns-test`), CIDER will simply run the tests in
+that namespace. If you have put some of your tests into your
+implementation namespace, using `clojure.test/with-test`, for
+instance, you might want to suppress the namespace inference logic and
+force CIDER to run tests in the current namespace unconditionally.
+You can do this by adding a prefix to the namespace commands: <kbd>C-u
+C-c C-t C-n</kbd>. This will simply run whatever tests are present in
+the currently visited or active namespace.
+
+You can also run a subset of the tests defined in the namespace,
+filtered by test selectors, using <kbd>C-c C-t C-s</kbd>. CIDER will
+prompt for the selectors in the minibuffer. If you call this
+command with a prefix (<kbd>C-u C-c C-t C-s</kbd>) you can suppress
+the namespace inference logic as for <kbd>C-u C-c C-t C-n</kbd>
+
+Finally, you can execute the specific test at the point using
+<kbd>C-c C-t t</kbd> or <kbd>C-c C-t C-t</kbd>.
+
+## Interacting with Test Result Reports
+
+After running your tests, CIDER displays a test result report in the
+`*cider-test-report*` buffer. This buffer uses `test-report-mode`,
+which makes it easy to review any failures that might have occurred
+and jump directly to the definition of failing tests.
Keyboard shortcut | Description
--------------------------------|-------------------------------
@@ -53,26 +94,30 @@ Keyboard shortcut | Description
<kbd>d</kbd> | Display diff of actual vs expected.
<kbd>e</kbd> | Display test error cause and stacktrace info.
-Certain aspects of the test execution behavior are configurable:
+## Configuration
+
+You can configure CIDER's test execution behavior in multiple ways.
-* If your tests are not following the `some.ns-test` naming convention you can
-customize the variable `cider-test-infer-test-ns`. It should be bound to a
-function that takes the current namespace and returns the matching test
-namespace (which may be the same as the current namespace).
+If your tests are not following the `some.ns-test` naming convention
+you can set the variable `cider-test-infer-test-ns` to a function that
+takes the current namespace and returns the matching test namespace
+(which may be the same as the current namespace). This provides
+complete flexibility to structure your test suite using whatever
+conventions you might want.
-* If your individual tests are not defined by `deftest` or `defspec`, CIDER will
+If your individual tests are not defined by `deftest` or `defspec`, CIDER will
not recognize them when searching for a test at point in `cider-test-run-test`.
You can customize the variable `cider-test-defining-forms` to add additional
forms for CIDER to recognize as individual test definitions.
-* If you want to view the test report regardless of whether the tests have
+If you want to view the test report regardless of whether the tests have
passed or failed:
```el
(setq cider-test-show-report-on-success t)
```
-### Running tests automatically (test-driven development)
+## Running Tests Automatically (Test-Driven Development)
CIDER provides a minor-mode that automatically runs all tests for a namespace
whenever you load a file (with <kbd>C-c C-k</kbd>). You can toggle it
@@ -82,26 +127,35 @@ manually with <kbd>M-x</kbd> `cider-auto-test-mode`, or you can use:
(cider-auto-test-mode 1)
```
-This is completely equivalent to manually typing <kbd>C-c C-t C-n</kbd> every
-time you load a Clojure buffer. Also, as described above before, CIDER is smart
-enough to figure out the namespace containing the tests.
+This is identical to manually typing <kbd>C-c C-t C-n</kbd> every time
+you load a Clojure buffer. As described previously, CIDER will try to
+automatically determine the namespace containing the tests.
-### Using cider-test with alternative test libraries
+## Using cider-test with Alternative Test Libraries
-The `clojure.test` machinery is designed to be pluggable. Any test library
-can implement it if so desired, and therefore leverage `cider-test`. For
-instance, [test.check](https://github.com/clojure/test.check/) does this, and
-`cider-test` handles `defspec` just like `deftest`.
+The `clojure.test` machinery is designed to be pluggable. Any test
+library can integrate with it and leverage the `cider-test`
+ecosystem.
As a test framework author, supporting the built-in `clojure.test` machinery
(and hence `cider-test`) is pretty straightforward:
-1. Assoc each test fn as `:test` metadata on some var. These are what get run.
+1. Add `:test` metadata to the vars corresponding to the test
+ functions. The `clojure-test` machinery uses this metadata to
+ find tests.
2. Implement the `clojure.test/report` multimethod to capture the test results.
-The `test.check` library is a good example here. It was also designed completely
-independently of `clojure.test`. It just adds compatibility in this
+For example, [test.check] was designed independently of `clojure.test`
+but integrates with it. Because of this, `cider-test` handles
+`defspec` just like `deftest`. `test.check` just adds compatibility in this
[namespace](https://github.com/clojure/test.check/blob/24f74b83f1c7a032f98efdcc1db9d74b3a6a794d/src/main/clojure/clojure/test/check/clojure_test.cljc).
-[clojure-expectations](https://github.com/clojure-expectations/expectations) added
+### Supported Libraries
+
+* [test-check]
+* [clojure-expectations](https://github.com/clojure-expectations/expectations) added
support for `clojure.test` in version 2.2 and should also work with CIDER.
+* [fudge](https://github.com/jimpil/fudje)
+
+[clojure.test]: https://clojure.github.io/clojure/clojure.test-api.html "`clojure.test`"
+[test.check]: https://github.com/clojure/test.check "`test.check`"
diff --git a/doc/troubleshooting.md b/doc/troubleshooting.md
index bbb579f..be26760 100644
--- a/doc/troubleshooting.md
+++ b/doc/troubleshooting.md
@@ -151,13 +151,13 @@ The solution to this depends on what you see and on what you're doing.
#### You see a number like `X.X.X`, and you're starting the REPL with `cider-connect`
Your project specifies the wrong version for the cider-nrepl middleware. See the
-[instructions](http://docs.cider.mx/en/latest/installation/#ciders-nrepl-middleware)
+[instructions](https://docs.cider.mx/en/latest/installation/#ciders-nrepl-middleware)
on the Installation section.
#### You see `not installed` or `nil`, and you're starting the REPL with `cider-connect`
To use `cider-connect` you need to add the cider-nrepl middleware to your project. See the
-[instructions](http://docs.cider.mx/en/latest/installation/#ciders-nrepl-middleware)
+[instructions](https://docs.cider.mx/en/latest/installation/#ciders-nrepl-middleware)
on the Installation section.
#### You see `not installed` or `nil`, and you're starting the REPL with `cider-jack-in`
@@ -169,7 +169,7 @@ on the Installation section.
If the above doesn't work, you can try specifying the cider-nrepl middleware
manually, as per the
-[instructions](http://docs.cider.mx/en/latest/installation/#ciders-nrepl-middleware)
+[instructions](https://docs.cider.mx/en/latest/installation/#ciders-nrepl-middleware)
on the Installation section.
#### You see a number like `X.X.X`, and you're starting the REPL with `cider-jack-in`
diff --git a/doc/up_and_running.md b/doc/up_and_running.md
index 8d7861e..bf6bc8b 100644
--- a/doc/up_and_running.md
+++ b/doc/up_and_running.md
@@ -1,42 +1,38 @@
-The only requirement to use CIDER is to have an nREPL server to which it may
-connect. Many Clojurians favour the use of tools like Leiningen, Boot or Gradle
-to start an nREPL server, but the use of one of them is not a prerequisite to
-use CIDER.
-
-## Setting up a Clojure project (optional)
-
-CIDER features a command called `cider-jack-in` that will start an nREPL server
-for a particular Clojure project and connect to it automatically. Most
-popular Clojure project management tools are supported by default - namely
-Leiningen, Boot, `clj` (`tools.deps`) and Gradle.
+To use CIDER, you'll need to connect it to a running nREPL server that
+is associated with your program. Most Clojure developers use standard
+build tooling such as Leiningen, Boot, or Gradle, and CIDER can
+automatically work with those tools to get you up and running
+quickly. But those tools are not required; CIDER can connect to an
+nREPL server that is already started and is managed separately.
!!! Note
- This functionality depends on Leiningen 2.5.2+ or Boot
+ CIDER will automatically work with Leiningen 2.5.2+ or Boot
2.7.0+. Older versions are not supported.
-Let's create a simple Clojure project using Leiningen now. Provided you've installed
-it already, all you need to do is:
+There are two ways to connect CIDER to an nREPL server:
-```
-$ lein new demo
-```
+1. CIDER can launch an nREPL server for your project from Emacs.
+2. You can connect CIDER to an already-running nREPL server, managed separately.
-The two main ways to obtain an nREPL connection are discussed in the following sections of the manual.
+The following sections describe each of these methods.
-## Launch an nREPL server and client from Emacs
+## Launch an nREPL Server From Emacs
-Simply open in Emacs a file belonging to your project (like `foo.clj`) and type
-<kbd>M-x</kbd> `cider-jack-in` <kbd>RET</kbd>. This will start an nREPL server
-and CIDER will automatically connect to it.
+If you have a Clojure project in your file system and want CIDER to
+launch an nREPL session for it, simply visit a file that belongs to
+the project, and type <kbd>M-x</kbd> `cider-jack-in`
+<kbd>RET</kbd>. CIDER will start an nREPL server and automatically
+connect to it.
!!! Note
- If it is a `lein`, `boot` or `tools.deps (deps.edn)` project nREPL will be
- started with all dependencies loaded. Dependency auto-injection is currently
- not support for Gradle projects.
+ If your project uses `lein`, `boot` or `tools.deps (deps.edn)`,
+ CIDER will automatically inject all the necessary nREPL
+ dependencies when it starts the server. CIDER does not currently support
+ dependency auto-injection for Gradle projects.
-Alternatively you can use <kbd>C-u M-x</kbd> `cider-jack-in` <kbd>RET</kbd> to
+Alternatively, you can use <kbd>C-u M-x</kbd> `cider-jack-in` <kbd>RET</kbd> to
specify the name of a `lein`, `boot` or `tools.deps` project, without having to
visit any file in it. This option is also useful if your project contains some
combination of `project.clj`, `build.boot` and `deps.edn` and you want to launch
@@ -46,68 +42,109 @@ a REPL for one or the other.
In Clojure(Script) buffers the command `cider-jack-in` is bound to <kbd>C-c C-x (C-)j (C-)j</kbd>.
-For further customizing the command line used for `cider-jack-in`, you can
-change the following (all string options):
+You can further customize the command line CIDER uses for `cider-jack-in` by
+modifying the following string options:
- * `cider-lein-global-options`, `cider-boot-global-options`,
- `cider-clojure-cli-global-options`, `cider-gradle-global-options`:
- these are passed to the command directly, in first position
- (e.g. `-o` to `lein` enables offline mode).
- * `cider-lein-parameters`, `cider-boot-parameters`,
- `cider-clojure-cli-parameters`, `cider-gradle-parameters`: these
- are usually tasks names and their parameters (e.g.: `dev` for
- launching boot's dev task instead of the standard `repl -s wait`).
+* `cider-lein-global-options`, `cider-boot-global-options`,
+ `cider-clojure-cli-global-options`, `cider-gradle-global-options`:
+ these are passed to the command directly, in first position
+ (e.g., `-o` to `lein` enables offline mode).
+* `cider-lein-parameters`, `cider-boot-parameters`,
+ `cider-clojure-cli-parameters`, `cider-gradle-parameters`: these are
+ usually task names and their parameters (e.g., `dev` for launching
+ boot's dev task instead of the standard `repl -s wait`).
Note that if you try to run `cider-jack-in` outside a project
-directory normally you'd get a warning to confirm you really want to
-do this, as more often than not you'd probably do this
-accidentally. If you decide to proceed, CIDER will invoke the command
-configured in `cider-jack-in-default`. This used to be `lein` prior to
-CIDER 0.17 and it was switched to Clojure's CLI (`clj`) afterwards.
+directory, CIDER will warn you and ask you to confirm whether you
+really want to do this; more often than not, this is an accident. If
+you decide to proceed, CIDER will invoke the command configured in
+`cider-jack-in-default`. Prior to CIDER 0.17, this defaulted to `lein`
+but was subsequently switched to `clj`, Clojure's basic startup command.
!!! Tip
You can set `cider-allow-jack-in-without-project` to `t` if you'd like to
disable the warning displayed when jacking-in outside a project.
-## Connect to a running nREPL server
+## Connect to a Running nREPL Server
-Go to your project's directory in a terminal and type there:
+If you have an nREPL server already running, CIDER can connect to
+it. For instance, if you have a Leiningen-based project, go to your
+project's directory in a terminal session and type:
-```
-$ lein repl
+```sh
+$ lein repl :headless
```
-Or for `boot`:
+This will start the project's nREPL server.
-```
+If your project uses `boot`, do this instead:
+
+```sh
$ boot repl -s wait (or whatever task launches a repl)
```
It is also possible for plain `clj`, although the command is somewhat longer:
-```
-$ clj -Sdeps '{:deps {cider/cider-nrepl {:mvn/version "0.18.0-SNAPSHOT"} }}' -e '(require (quote cider-nrepl.main)) (cider-nrepl.main/init ["cider.nrepl/cider-middleware"])'
+```sh
+$ clj -Sdeps '{:deps {cider/cider-nrepl {:mvn/version "0.19.0"}}}' -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
```
-Alternatively you can start nREPL either manually or by the facilities
-provided by your project's build tool (Maven, etc).
+Alternatively, you can start nREPL either manually or using the facilities
+provided by your project's build tool (Gradle, Maven, etc).
-After you get your nREPL server running, go back to Emacs. Type there
-<kbd>M-x</kbd> `cider-connect` <kbd>RET</kbd> to connect to the
-running nREPL server.
+After you get your nREPL server running, go back to Emacs and connect
+to it: <kbd>M-x</kbd> `cider-connect` <kbd>RET</kbd>. CIDER will
+prompt you for the host and port information, which should have been
+printed when the previous commands started the nREPL server in your
+project.
!!! Tip
- In Clojure(Script) buffers the command `cider-connect` is bound to <kbd>C-c M-c</kbd>.
+ In Clojure(Script) buffers the command `cider-connect` is bound to <kbd>C-c C-x c s</kbd>.
-You can configure known endpoints used by the `cider-connect` command offered
-via a completing read. This is useful if you have a list of common host/ports
-you want to establish remote nREPL connections to. Using an optional label is
-helpful for identifying each host.
+If you frequently connect to the same hosts and ports, you can tell
+CIDER about them and it will use the information to do completing
+reads for the host and port prompts when you invoke
+`cider-connect`. You can identify each host with an optional label.
-```
+```el
(setq cider-known-endpoints
'(("host-a" "10.10.10.1" "7888")
("host-b" "7888")))
```
+
+## Working with Remote Hosts
+
+While most of the time you'd be connecting to a locally running nREPL
+server, that was started manually or via `cider-jack-in-*`, there's
+also the option to connect to remote nREPL hosts. For the sake of security
+CIDER has the ability to tunnel a connection over SSH in such cases.
+This behavior is controlled by
+`nrepl-use-ssh-fallback-for-remote-hosts`: when true, CIDER will attempt to
+connect via ssh to remote hosts when unable to connect directly. It's
+`nil` by default.
+
+There's also `nrepl-force-ssh-for-remote-hosts` which will force the use
+of ssh for remote connection unconditionally.
+
+!!! Warning
+
+ As nREPL connections are insecure by default you're encouraged to use only SSH
+ tunneling when connecting to servers running outside of your network.
+
+There's a another case in which CIDER may optionally leverage the `ssh` command - when
+trying to figure out potential target hosts and ports when you're doing `cider-connect-*`.
+If `cider-infer-remote-nrepl-ports` is true, CIDER will use ssh to try to infer
+nREPL ports on remote hosts (for a direct connection). That option is also set to `nil`
+by default.
+
+!!! Note
+
+ Enabling either of these causes CIDER to use
+ [TRAMP](https://www.gnu.org/software/tramp/) for some SSH operations, which parses
+ config files such as `~/.ssh/config` and `~/.ssh/known_hosts`. This is known to
+ cause problems with complex or nonstandard ssh configs.
+
+You can safely run `cider-jack-in-*` while working with remote files over TRAMP. CIDER
+will handle this use-case transparently for you.
diff --git a/doc/using_the_repl.md b/doc/using_the_repl.md
index e9888cf..1328a63 100644
--- a/doc/using_the_repl.md
+++ b/doc/using_the_repl.md
@@ -1,6 +1,7 @@
-CIDER comes with a powerful REPL, which is quite handy when you want to
-experiment with the code you're working on or just explore some stuff (e.g. a
-library you're playing with). The REPL offers a number of advanced features:
+CIDER comes with a powerful REPL that complements the interactive
+development functionality in `cider-mode`. Using the CIDER REPL you
+can experiment with your running program, test functions, or just
+explore a new library you're interested in using. The CIDER REPL offers a number of advanced features:
* auto-completion
* font-locking (the same as in `clojure-mode`)
@@ -64,8 +65,9 @@ character used to trigger the shortcuts is configurable via
#### Behavior on connect
-Normally, the REPL buffer is auto-displayed in a separate window after
- a connection is established. You can suppress this behaviour like this:
+Normally, when you first establish a REPL connection, the REPL buffer is
+auto-displayed in a separate window. You can suppress this behaviour
+like this:
```el
(setq cider-repl-pop-to-buffer-on-connect nil)
@@ -80,9 +82,9 @@ focused, use this:
#### Behavior on switch
-By default <kbd>C-c C-z</kbd> will display the REPL buffer in a different window.
-You can make <kbd>C-c C-z</kbd> switch to the CIDER REPL buffer in the current
-window:
+By default <kbd>C-c C-z</kbd> will display the REPL buffer in a
+different window. You can make <kbd>C-c C-z</kbd> switch to the CIDER
+REPL buffer in the current window:
```el
(setq cider-repl-display-in-current-window t)
@@ -99,30 +101,30 @@ It's extremely useful! Enable `eldoc` in REPL buffers like this:
#### Customizing the REPL prompt
-You can customize the prompt in REPL buffer. To do that you can customize
-`cider-repl-prompt-function` and set it to a function that takes one argument,
-a namespace name. For convenience, three functions are already provided:
-`cider-repl-prompt-lastname`, `cider-repl-prompt-abbreviated`,
-`cider-repl-prompt-default` and by default the last one is being used.
-Prompt for each of them for namespace `leiningen.core.ssl`:
+You can customize the REPL buffer prompt by setting
+`cider-repl-prompt-function` to a function that takes one
+argument, a namespace name. For convenience, CIDER provides three
+functions that implement common formats:
- * `cider-repl-prompt-lastname`:
+* `cider-repl-prompt-lastname`:
- ```
- ssl>
- ```
+```
+ssl>
+```
- * `cider-repl-prompt-abbreviated`:
+* `cider-repl-prompt-abbreviated`:
- ```
- l.c.ssl>
- ```
+```
+l.c.ssl>
+```
- * `cider-repl-prompt-default`:
+* `cider-repl-prompt-default`:
- ```
- leiningen.core.ssl>
- ```
+```
+leiningen.core.ssl>
+```
+
+By default, CIDER uses `cider-repl-prompt-default`.
You may, of course, write your own function. For example, in `leiningen` there
are two namespaces with similar names - `leiningen.classpath` and
@@ -140,44 +142,66 @@ namespace. Here is an example function that will do exactly that:
#### TAB Completion
-You can control the <kbd>TAB</kbd> key behavior in the REPL via the
+You can control the <kbd>TAB</kbd> key behavior in the REPL using the
`cider-repl-tab-command` variable. While the default command
`cider-repl-indent-and-complete-symbol` should be an adequate choice for
most users, it's very easy to switch to another command if you wish
to. For instance if you'd like <kbd>TAB</kbd> to only indent (maybe
because you're used to completing with <kbd>M-TAB</kbd>) use the
-following snippet:
+following:
```el
(setq cider-repl-tab-command #'indent-for-tab-command)
```
+#### Auto-scrolling the REPL on Output
+
+By default, if the REPL buffer contains more lines than the size of the
+(Emacs) window, the buffer is automatically re-centered upon
+completion of evaluating an expression, so that the bottom line of
+output is on the bottom line of the window.
+
+The default has the nice advantage that you always see as much as you
+can from your previous REPL interactions, but can be pretty annoying
+if you're a heavy user of `C-l` (`M-x recenter-top-bottom`), as even
+if you're at the top of the REPL buffer the next output will scroll it all
+the way down.
+
+If you don't like this re-centering you can disable it like this:
+
+```el
+(setq cider-repl-scroll-on-output nil)
+```
+
#### Result Prefix
-Change the result prefix for REPL evaluation (by default there's no prefix):
+You can change the string used to prefix REPL results:
```el
(setq cider-repl-result-prefix ";; => ")
```
-And here's the result of that change:
+Which then results in the following REPL output:
```
user> (+ 1 2)
;; => 3
```
+By default, REPL results have no prefix.
+
#### Customize the REPL Buffer's Name
-The REPL buffer name has the format `*cider-repl project-name*`.
-You can change the separator from space to something else by overriding `nrepl-buffer-name-separator`.
+The REPL buffer name has the format `*cider-repl project-name*`. You
+can change the separator from a space character to something else by
+setting `nrepl-buffer-name-separator`.
```el
(setq nrepl-buffer-name-separator "-")
```
The REPL buffer name can also display the port on which the nREPL server is running.
-Buffer name will look like `*cider-repl project-name:port*`.
+The buffer name will look like `*cider-repl project-name:port*`.
```el
(setq nrepl-buffer-name-show-port t)
@@ -185,10 +209,12 @@ Buffer name will look like `*cider-repl project-name:port*`.
#### Font-locking
-Normally code in the REPL is font-locked the same way as in
-`clojure-mode`. Before CIDER 0.10 by default REPL input was font-locked with
-`cider-repl-input-face` (after you press `RET`) and results were font-locked with
-`cider-repl-result-face`. If you want to restore the old behaviour use:
+Normally, code in the REPL is font-locked the same way as in
+`clojure-mode`. Before CIDER 0.10, by default, REPL input was
+font-locked with `cider-repl-input-face` (after pressing
+<kbd>Return</kbd>) and results were font-locked with
+`cider-repl-result-face`. If you want to restore the old behaviour
+use:
```el
(setq cider-repl-use-clojure-font-lock nil)
@@ -196,9 +222,8 @@ Normally code in the REPL is font-locked the same way as in
#### Pretty printing in the REPL
-Make the REPL always pretty-print the results of your evaluations.
-
-<kbd>M-x cider-repl-toggle-pretty-printing</kbd>
+You can make the REPL always pretty-print the results of your
+evaluations using <kbd>M-x cider-repl-toggle-pretty-printing</kbd>.
To make this behavior the default:
@@ -216,11 +241,11 @@ behavior if you don't like it.
(setq cider-repl-use-content-types nil)
```
-Alternatively you can toggle this behaviour on and off using <kbd>M-x
+Alternatively, you can toggle this behaviour on and off using <kbd>M-x
cider-repl-toggle-content-types</kbd>.
-Currently the feature doesn't work well with pretty-printing in the REPL,
-so you're advised not to enable both of them at the same time.
+Currently, the feature doesn't work well with pretty-printing in the REPL,
+so we don't advise you to enable both features at the same time.
#### Limiting printed output in the REPL
@@ -234,17 +259,20 @@ section of your Leiningen project's configuration.
:repl-options {:init (set! *print-length* 50)}
```
-or via `cider-repl-print-length` (set to 100 by default). In case both are
-present, CIDER's config will take precedence over what came from Lein.
+You can also set `cider-repl-print-length` to an appropriate value (it
+defaults to 100). If both `*print-length` and
+`cider-repl-print-length` are set, CIDER's setting will take precedence
+over the value set through Leiningen.
-All of this applies to `*print-level*` as well. CIDER's configuration
-variable for it is named `cider-repl-print-level` (set to `nil` by default).
+The preceeding discussion also applies to Clojure's `*print-level*`
+variable. The corresponding CIDER variable is
+`cider-repl-print-level`, set to `nil` by default.
#### Customizing the initial REPL namespace
-Normally the CIDER REPL will start with the `user` namespace.
-You can supply a default value for REPL sessions via the `repl-options` section
-of your Leiningen project's configuration.
+Normally, the CIDER REPL will start in the `user` namespace. You can
+supply an initial namespace for REPL sessions in the `repl-options`
+section of your Leiningen project configuration:
```clojure
:repl-options {:init-ns 'my-ns}
@@ -252,23 +280,23 @@ of your Leiningen project's configuration.
#### Customizing newline interaction
-Ordinarily <kbd>Return</kbd> sends a form for evaluation meaning entering a
-newline requires a special chord: <kbd>C-j</kbd>. When entering forms that span
-multiple lines, it may be desirable to make evaluation require the special
-invocation and have entering a new-line be the default.
-
-The following customization of the `cider-repl-mode-map` will change these
-keybindings so that <kbd>Return</kbd> will introduce a new-line and
-<kbd>C-<return></kbd> will send the form off for evaluation.
+Ordinarily, <kbd>Return</kbd> immediate sends a form for
+evaluation. If you want to insert a newline into the REPL buffer as
+you're editing, you can do so using <kbd>C-j</kbd>. If you are
+entering a lot of longer forms that span multiple lines, it may be
+more convenient to change the keybindings:
``` el
(define-key cider-repl-mode-map (kbd "RET") #'cider-repl-newline-and-indent)
(define-key cider-repl-mode-map (kbd "C-<return>") #'cider-repl-return)
```
+This will make <kbd>Return</kbd> insert a newline into the REPL buffer
+and <kbd>C-<Return></kbd> send the form off for evaluation.
+
#### REPL history
-* To make the REPL history wrap around when its end is reached:
+* To make the REPL history wrap around when CIDER reaches the end:
```el
(setq cider-repl-wrap-history t)
@@ -286,51 +314,66 @@ keybindings so that <kbd>Return</kbd> will introduce a new-line and
(setq cider-repl-history-file "path/to/file")
```
-Note that the history is written to the file when you kill the REPL
-buffer (which includes invoking `cider-quit`) or you quit Emacs.
+Note that CIDER writes the history to the file when you kill the REPL
+buffer, which includes invoking `cider-quit`, or when you quit Emacs.
### REPL history browser
You can browse your REPL input history with the command <kbd>M-x</kbd>
-`cider-repl-history`. It is also bound in `cider-repl-mode` buffers to
-<kbd>C-c M-p</kbd>, and is also available via the `history` shortcut.
+`cider-repl-history`. This command is bound to <kbd>C-c M-p</kbd>
+in `cider-repl-mode` buffers and is also available via the
+`history` shortcut.
-The history is displayed in order, with the most recent input at the top of the
-buffer, and the oldest one at the bottom. You can scroll through the history,
-and when you find the history item you were looking for, you can insert it from
-the history buffer into your REPL buffer.
+The history is displayed in reverse order, with the most recent input
+at the top of the buffer, and the oldest input at the bottom. You can
+scroll through the history, and when you find the history item you
+were looking for, you can insert it from the history buffer into your
+REPL buffer.
![History Browser](images/history_browser.png)
#### Mode
-The history buffer has its own major mode, `cider-repl-history-mode` which is derived
-from `clojure-mode`, so you get fontification in the history buffer. It supports
-the expected defcustom hook variable, `cider-repl-history-hook`.
+The history buffer has its own major mode,
+`cider-repl-history-mode`. This is derived from `clojure-mode`, so you
+get fontification in the history buffer. This mode supports the
+expected defcustom hook variable, `cider-repl-history-hook`.
#### Insertion
-Typically your cursor will be at the bottom of the REPL buffer (`point-max`)
-when you use this feature; if that's the case, the text is inserted, and point
-is advanced to the end of the inserted text. In the unusual case where you
-invoke the history browser when your cursor is _not_ at the end of the buffer,
-the text is _still_ inserted at point-max, but point is not modified.
+Where you use the history buffer to insert text into the REPL buffer,
+the exact behavior depends on the location of the cursor in the buffer
+prior to the insertion.
+
+Typically, when you're actively using the REPL, your cursor will be at
+the end of the REPL buffer (`point-max`). In this case, the text is
+inserted at the end of the buffer and the point advances to the end of
+the inserted text (as if point was pushed by along by the text as it
+was inserted).
-The text is inserted without a final newline, meaning you can edit the form
-if you wish, and you must explicitly hit <kbd>Enter</kbd> to have it evaluated
-by the REPL.
+In the unusual case where you invoke the history browser when your
+cursor is _not_ at the end of the REPL buffer, the inserted text will
+still be inserted at the end of the buffer (`point-max`), but the
+point is not modified.
+
+CIDER inserts the text without a final newline, allowing you to edit
+it. When you are ready, hit <kbd>Return</kbd> to have it evaluated by
+the REPL.
#### Quitting
-After text is inserted, the history buffer is automatically quit. If you decide
-you don't want to insert any text after all, you can explicitly quit by running
-`cider-repl-history-quit` (see keyboard shortcuts). Due to the initialization and
-cleanup done, it is better to properly quit, rather than just switch away from
-the history buffer.
+If you select an input, the text will be inserted into the REPL buffer
+and the history buffer will automatically quit. If you decide you want
+to quit without inserting any text at all, you can explicitly quit by
+running `cider-repl-history-quit` (see keyboard shortcuts). Because
+of the initialization and cleanup that is done when using the history
+buffer, it is better to quit properly rather than just switch away
+from the history buffer.
-When you quit the history buffer, there are several different ways for the
-buffers and windows to be restored. This is controlled by the custom variable
-`cider-repl-history-quit-action`, which can be assigned one of several values:
+When you quit the history buffer, CIDER can restore the buffer and
+window configuration in a few different ways. The behavior is
+controlled by `cider-repl-history-quit-action`, which can be assigned
+one of several values:
- `quit-window` restores the window configuration to what it was before.
This is the default.
@@ -340,39 +383,44 @@ buffers and windows to be restored. This is controlled by the custom variable
deletes the window.
- `bury-buffer` simply buries the `*cider-repl-history*` buffer, but keeps the
window.
-- `bury-and-delete-window` buries the buffer, and (if there is more than one
- window) deletes the window.
+- `bury-and-delete-window` buries the buffer, and deletes the window
+ if there is more than one window.
- any other value is interpreted as the name of a function to call
#### Filtering
-By invoking `cider-repl-history-occur` from the history buffer, you will be prompted
-for a regular expression, and the history buffer will be filtered to only those
-inputs that match the regexp.
+By invoking `cider-repl-history-occur` from the history buffer, you
+will be prompted for a regular expression. The history buffer will be
+filtered to only those inputs that match the regexp.
#### Preview and Highlight
-When `cider-repl-history-show-preview` is non-nil, we display an [`overlay`]
+When `cider-repl-history-show-preview` is non-nil, CIDER displays an [`overlay`]
(https://www.gnu.org/software/emacs/manual/html_node/elisp/Overlays.html)
of the currently selected history entry, in the REPL buffer.
-This is a nice feature; the only thing to be careful of is that if you do not
-properly quit from browsing the history (i.e., if you just <kbd>C-x b</kbd>
-away from the buffer), you may be left with an unwanted overlay in your REPL
-buffer. It can be eliminated with <kbd>M-x</kbd> `cider-repl-history-clear-preview`.
+If you do not properly quit from browsing the history (i.e., if you
+just <kbd>C-x b</kbd> away from the buffer), you may be left with an
+unwanted overlay in your REPL buffer. If this happens, you can clean
+it up with <kbd>M-x</kbd> `cider-repl-history-clear-preview`.
+
+By default, `cider-repl-history-show-preview` is nil (disabled).
-By default, the variable is nil and the feature is off.
+There is a related feature to highlight the entry once it is actually
+inserted into the REPL buffer, controlled by the variable
+`cider-repl-history-highlight-inserted-item`, which can be set to the
+following values:
-A related feature is to highlight the entry once it is actually inserted into
-the REPL buffer. This is controlled by the variable
-`cider-repl-history-highlight-inserted-item`. The non-nil value selected controls how
-the inserted item is highlighted, possible values are `solid` (highlight the
-inserted text for a fixed period of time), or `pulse` (fade out the highlighting
-gradually). Setting this variable to the value t will select the default
-highlighting style, which currently `pulse`. Default is nil.
+- `solid` highlights the inserted text for a fixed period of time.
+- `pulse` causes the highlighting to fade out gradually.
+- `t` selects the default highlighting style, which is currently
+ `pulse`.
+- `nil` disables highlighting. This is the default value for
+ `cider-repl-history-highlight-inserted-item`.
-When "highlight-inserted" is turned on, you can customize the face of the
-inserted text with the variable `cider-repl-history-inserted-item-face`.
+When `cider-repl-history-highlight-inserted-item` is non-nil, you
+can customize the face used for the inserted text with the variable
+`cider-repl-history-inserted-item-face`.
#### Additional Customization
diff --git a/mkdocs.yml b/mkdocs.yml
index f726b46..2f984ee 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -3,7 +3,7 @@ repo_url: https://github.com/clojure-emacs/cider
site_dir: html
edit_uri: edit/master/doc/
site_favicon: favicon.ico
-copyright: "Copyright &copy; 2016-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors"
+copyright: "Copyright &copy; 2016-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors"
docs_dir: doc
pages:
- Home: index.md
diff --git a/nrepl-client.el b/nrepl-client.el
index 7db01ec..33a6cfd 100644
--- a/nrepl-client.el
+++ b/nrepl-client.el
@@ -1,7 +1,7 @@
;;; nrepl-client.el --- Client for Clojure nREPL -*- lexical-binding: t -*-
;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
@@ -466,12 +466,20 @@ and kill the process buffer."
(substring message 0 -1)))
(when (equal (process-status process) 'closed)
(when-let* ((client-buffer (process-buffer process)))
+ (sesman-remove-object 'CIDER nil client-buffer
+ (not (process-get process :keep-server))
+ 'no-error)
(nrepl--clear-client-sessions client-buffer)
(with-current-buffer client-buffer
+ (goto-char (point-max))
+ (insert-before-markers
+ (propertize
+ (format "\n*** Closed on %s ***\n" (current-time-string))
+ 'face 'cider-repl-stderr-face))
(run-hooks 'nrepl-disconnected-hook)
(let ((server-buffer nrepl-server-buffer))
(when (and (buffer-live-p server-buffer)
- (not (plist-get (process-plist process) :no-server-kill)))
+ (not (process-get process :keep-server)))
(setq nrepl-server-buffer nil)
(nrepl--maybe-kill-server-buffer server-buffer)))))))
@@ -501,7 +509,11 @@ key-values depending on the connection type."
(message "[nREPL] Falling back to SSH tunneled connection ...")
(nrepl--ssh-tunnel-connect host port))
;; fallback is either not enabled or it failed as well
- (error "[nREPL] Cannot connect to %s:%s" host port))
+ (if (and (null nrepl-use-ssh-fallback-for-remote-hosts)
+ (not localp))
+ (error "[nREPL] Direct connection to %s:%s failed; try setting `nrepl-use-ssh-fallback-for-remote-hosts' to t"
+ host port)
+ (error "[nREPL] Cannot connect to %s:%s" host port)))
;; `nrepl-force-ssh-for-remote-hosts' is non-nil
(nrepl--ssh-tunnel-connect host port)))))
@@ -719,10 +731,7 @@ to the REPL."
(propertize msg 'face face)
(format "%s: %s" (upcase type) msg))))
(cider-repl--emit-interactive-output msg (or face 'font-lock-builtin-face))
- (message msg)
- ;; Interactive eval handler covers this message, but it won't be eval
- ;; middleware using this functionality.
- (sit-for 2)))
+ (message msg)))
(defvar cider-buffer-ns)
(defvar cider-special-mode-truncate-lines)
@@ -1044,7 +1053,9 @@ been determined."
(when (and (null nrepl-endpoint)
(string-match "nREPL server started on port \\([0-9]+\\)" output))
(let ((port (string-to-number (match-string 1 output))))
- (setq nrepl-endpoint (list :host "localhost" :port port))
+ (setq nrepl-endpoint (list :host (or (file-remote-p default-directory 'host)
+ "localhost")
+ :port port))
(message "[nREPL] server started on %s" port)
(when nrepl-on-port-callback
(funcall nrepl-on-port-callback (process-buffer process)))))))))
diff --git a/nrepl-dict.el b/nrepl-dict.el
index be14386..d77aa60 100644
--- a/nrepl-dict.el
+++ b/nrepl-dict.el
@@ -1,7 +1,7 @@
;;; nrepl-dict.el --- Dictionary functions for Clojure nREPL -*- lexical-binding: t -*-
;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov
-;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
diff --git a/test/cider-apropos-tests.el b/test/cider-apropos-tests.el
index 2c44e02..1ab0044 100644
--- a/test/cider-apropos-tests.el
+++ b/test/cider-apropos-tests.el
@@ -1,6 +1,6 @@
;;; cider-apropos-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/test/cider-browse-ns-tests.el b/test/cider-browse-ns-tests.el
index 6967b4b..f3c7fc3 100644
--- a/test/cider-browse-ns-tests.el
+++ b/test/cider-browse-ns-tests.el
@@ -1,6 +1,6 @@
;;; cider-browse-ns-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/test/cider-classpath-tests.el b/test/cider-classpath-tests.el
index 19b1429..e5e5af8 100644
--- a/test/cider-classpath-tests.el
+++ b/test/cider-classpath-tests.el
@@ -1,6 +1,6 @@
;;; cider-classpath-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/test/cider-client-tests.el b/test/cider-client-tests.el
index 02b797f..702d87a 100644
--- a/test/cider-client-tests.el
+++ b/test/cider-client-tests.el
@@ -1,6 +1,6 @@
;;; cider-client-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
@@ -63,20 +63,20 @@
;; clojure mode
(with-temp-buffer
(clojure-mode)
- (expect (cider-repl-type-for-buffer) :to-equal "clj"))
+ (expect (cider-repl-type-for-buffer) :to-equal 'clj))
;; clojurescript mode
(with-temp-buffer
(clojurescript-mode)
- (expect (cider-repl-type-for-buffer) :to-equal "cljs")))
+ (expect (cider-repl-type-for-buffer) :to-equal 'cljs)))
(it "returns the connection type based on `cider-repl-type'"
;; clj
- (setq cider-repl-type "clj")
- (expect (cider-repl-type-for-buffer) :to-equal "clj")
+ (setq cider-repl-type 'clj)
+ (expect (cider-repl-type-for-buffer) :to-equal 'clj)
;; cljs
- (setq cider-repl-type "cljs")
- (expect (cider-repl-type-for-buffer) :to-equal "cljs"))
+ (setq cider-repl-type 'cljs)
+ (expect (cider-repl-type-for-buffer) :to-equal 'cljs))
(it "returns nil as its default value"
(setq cider-repl-type nil)
@@ -85,7 +85,7 @@
(describe "cider-nrepl-send-unhandled-request"
(it "returns the id of the request sent to nREPL server and ignores the response"
(spy-on 'process-send-string :and-return-value nil)
- (with-repl-buffer "cider-nrepl-send-request" "clj" b
+ (with-repl-buffer "cider-nrepl-send-request" 'clj b
(setq-local nrepl-pending-requests (make-hash-table :test 'equal))
(setq-local nrepl-completed-requests (make-hash-table :test 'equal))
(let ((id (cider-nrepl-send-unhandled-request '("op" "t" "extra" "me"))))
diff --git a/test/cider-common-tests.el b/test/cider-common-tests.el
index 4b8144f..894207c 100644
--- a/test/cider-common-tests.el
+++ b/test/cider-common-tests.el
@@ -1,6 +1,6 @@
;;; cider-common-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/test/cider-connection-tests.el b/test/cider-connection-tests.el
index 4d2c3b0..be2e2dc 100644
--- a/test/cider-connection-tests.el
+++ b/test/cider-connection-tests.el
@@ -1,6 +1,6 @@
;;; cider-connection-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov, Vitalie Spinu
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov, Vitalie Spinu
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
@@ -43,7 +43,7 @@
(it "returns nil when a cider connection is available"
(let ((default-directory "/tmp/a-dir"))
- (with-repl-buffer "cider-ensure-session" "clj" b
+ (with-repl-buffer "cider-ensure-session" 'clj b
(expect (cider-ensure-connected) :to-equal
(list "cider-ensure-session" b)))))
@@ -63,22 +63,22 @@
(describe "when there are no active connections"
(it "returns nil"
(expect (cider-current-repl) :not :to-be-truthy)
- (expect (cider-current-repl "clj") :not :to-be-truthy)
- (expect (cider-current-repl "cljs") :not :to-be-truthy)))
+ (expect (cider-current-repl 'clj) :not :to-be-truthy)
+ (expect (cider-current-repl 'cljs) :not :to-be-truthy)))
(describe "when active connections are available"
(it "always returns the latest connection"
(let ((default-directory "/tmp/a-dir"))
- (with-repl-buffer ses-name "clj" bb1
- (with-repl-buffer ses-name "cljs" bb2
- (with-repl-buffer ses-name "clj" b1
- (with-repl-buffer ses-name "cljs" b2
+ (with-repl-buffer ses-name 'clj bb1
+ (with-repl-buffer ses-name 'cljs bb2
+ (with-repl-buffer ses-name 'clj b1
+ (with-repl-buffer ses-name 'cljs b2
(expect (cider-current-repl) :to-equal b2)
;; follows type arguments
- (expect (cider-current-repl "clj") :to-equal b1)
- (expect (cider-current-repl "cljs") :to-equal b2)
+ (expect (cider-current-repl 'clj) :to-equal b1)
+ (expect (cider-current-repl 'cljs) :to-equal b2)
;; follows file type
(with-temp-buffer
@@ -91,19 +91,19 @@
(it "always returns the most recently used connection"
(let ((default-directory "/tmp/a-dir"))
- (with-repl-buffer ses-name "clj" bb1
- (with-repl-buffer ses-name "cljs" bb2
- (with-repl-buffer ses-name "clj" b1
- (with-repl-buffer ses-name "cljs" b2
+ (with-repl-buffer ses-name 'clj bb1
+ (with-repl-buffer ses-name 'cljs bb2
+ (with-repl-buffer ses-name 'clj b1
+ (with-repl-buffer ses-name 'cljs b2
(switch-to-buffer bb2)
(switch-to-buffer bb1)
(expect (cider-current-repl) :to-equal bb1)
;; follows type arguments
- (expect (cider-current-repl "clj") :to-equal bb1)
+ (expect (cider-current-repl 'clj) :to-equal bb1)
(message "%S" (seq-take (buffer-list) 10))
- (expect (cider-current-repl "cljs") :to-equal bb2)
+ (expect (cider-current-repl 'cljs) :to-equal bb2)
;; follows file type
(with-temp-buffer
@@ -118,13 +118,13 @@
(describe "when there is only one connection available"
(it "returns the only connection"
(let ((default-directory "/tmp/a-dir"))
- (with-repl-buffer ses-name "clj" b
+ (with-repl-buffer ses-name 'clj b
(with-temp-buffer
(clojure-mode)
- (expect (cider-current-repl "clj") :to-equal b))
+ (expect (cider-current-repl 'clj) :to-equal b))
(with-temp-buffer
(clojurec-mode)
- (expect (cider-current-repl "clj") :to-equal b)))))))
+ (expect (cider-current-repl 'clj) :to-equal b)))))))
(describe "when type argument is given"
@@ -132,23 +132,23 @@
(it "returns that connection buffer"
(let ((default-directory "/tmp/a-dir"))
;; for clj
- (with-repl-buffer ses-name "clj" b1
- (with-repl-buffer ses-name "cljs" b2
- (expect (cider-current-repl "clj") :to-equal b1)))
+ (with-repl-buffer ses-name 'clj b1
+ (with-repl-buffer ses-name 'cljs b2
+ (expect (cider-current-repl 'clj) :to-equal b1)))
;; for cljs
- (with-repl-buffer ses-name "cljs" b1
- (with-repl-buffer ses-name "clj" b2
- (expect (cider-current-repl "cljs") :to-equal b1))))))
+ (with-repl-buffer ses-name 'cljs b1
+ (with-repl-buffer ses-name 'clj b2
+ (expect (cider-current-repl 'cljs) :to-equal b1))))))
(describe "when connection of that type doesn't exists"
(it "returns nil"
;; for clj
- (with-repl-buffer ses-name "cljs" b1
- (expect (cider-current-repl "clj") :to-equal nil))
+ (with-repl-buffer ses-name 'cljs b1
+ (expect (cider-current-repl 'clj) :to-equal nil))
;; for cljs
- (with-repl-buffer ses-name "clj" b2
- (expect (cider-current-repl "cljs") :to-equal nil))))
+ (with-repl-buffer ses-name 'clj b2
+ (expect (cider-current-repl 'cljs) :to-equal nil))))
(describe "when type argument is not given"
@@ -156,15 +156,15 @@
(it "returns that connection buffer"
(let ((default-directory "/tmp/a-dir"))
;; for clj
- (with-repl-buffer ses-name "clj" b1
- (with-repl-buffer ses-name "cljs" b2
+ (with-repl-buffer ses-name 'clj b1
+ (with-repl-buffer ses-name 'cljs b2
(with-temp-buffer
(setq major-mode 'clojure-mode)
(expect (cider-current-repl) :to-equal b1))))
;; for cljs
- (with-repl-buffer ses-name "cljs" b1
- (with-repl-buffer ses-name "clj" b2
+ (with-repl-buffer ses-name 'cljs b1
+ (with-repl-buffer ses-name 'clj b2
(with-temp-buffer
(setq major-mode 'clojurescript-mode)
(expect (cider-current-repl) :to-equal b1)))))))
@@ -172,13 +172,13 @@
(describe "when a connection matching current file extension doesn't exist"
(it "returns nil"
;; for clj
- (with-repl-buffer ses-name "clj" b1
+ (with-repl-buffer ses-name 'clj b1
(with-temp-buffer
(setq major-mode 'clojurescript-mode)
(expect (cider-current-repl) :to-equal nil)))
;; for cljs
- (with-repl-buffer ses-name "cljs" b2
+ (with-repl-buffer ses-name 'cljs b2
(with-temp-buffer
(setq major-mode 'clojure-mode)
(expect (cider-current-repl) :to-equal nil))))))))
@@ -188,19 +188,19 @@
(let ((a-dir "/tmp/a-dir")
(b-dir "/tmp/b-dir"))
(let ((default-directory a-dir))
- (with-repl-buffer ses-name "clj" bb1
- (with-repl-buffer ses-name "cljs" bb2
+ (with-repl-buffer ses-name 'clj bb1
+ (with-repl-buffer ses-name 'cljs bb2
(let ((default-directory a-dir))
- (with-repl-buffer ses-name2 "clj" b1
- (with-repl-buffer ses-name2 "cljs" b2
+ (with-repl-buffer ses-name2 'clj b1
+ (with-repl-buffer ses-name2 'cljs b2
(switch-to-buffer bb2)
(switch-to-buffer bb1)
(expect (cider-current-repl) :to-equal bb1)
;; follows type arguments
- (expect (cider-current-repl "clj") :to-equal bb1)
- (expect (cider-current-repl "cljs") :to-equal bb2)
+ (expect (cider-current-repl 'clj) :to-equal bb1)
+ (expect (cider-current-repl 'cljs) :to-equal bb2)
;; follows file type
(with-temp-buffer
@@ -234,19 +234,19 @@
(describe "when there are no active connections"
(it "returns nil"
(expect (cider-repls) :to-equal nil)
- (expect (cider-repls "clj") :to-equal nil)
- (expect (cider-repls "cljs") :to-equal nil)))
+ (expect (cider-repls 'clj) :to-equal nil)
+ (expect (cider-repls 'cljs) :to-equal nil)))
(describe "when multiple sessions exist"
(it "always returns the most recently used connection"
(let ((a-dir "/tmp/a-dir")
(b-dir "/tmp/b-dir"))
(let ((default-directory a-dir))
- (with-repl-buffer ses-name "clj" bb1
- (with-repl-buffer ses-name "cljs" bb2
+ (with-repl-buffer ses-name 'clj bb1
+ (with-repl-buffer ses-name 'cljs bb2
(let ((default-directory b-dir))
- (with-repl-buffer ses-name2 "clj" b1
- (with-repl-buffer ses-name2 "cljs" b2
+ (with-repl-buffer ses-name2 'clj b1
+ (with-repl-buffer ses-name2 'cljs b2
(expect (cider-repls) :to-equal (list b2 b1))
@@ -254,8 +254,8 @@
(expect (cider-repls) :to-equal (list bb2 bb1))
;; follows type arguments
- (expect (cider-repls "clj") :to-equal (list bb1))
- (expect (cider-repls "cljs") :to-equal (list bb2))
+ (expect (cider-repls 'clj) :to-equal (list bb1))
+ (expect (cider-repls 'cljs) :to-equal (list bb2))
(switch-to-buffer bb2)
;; follows file type
@@ -263,13 +263,13 @@
(with-temp-buffer
(setq major-mode 'clojure-mode)
(expect (cider-repls) :to-equal (list b2 b1))
- (expect (cider-repls "clj") :to-equal (list b1))))
+ (expect (cider-repls 'clj) :to-equal (list b1))))
(let ((default-directory a-dir))
(with-temp-buffer
(setq major-mode 'clojurescript-mode)
(expect (cider-repls) :to-equal (list bb2 bb1))
- (expect (cider-repls "cljs") :to-equal (list bb2)))))))))))))
+ (expect (cider-repls 'cljs) :to-equal (list bb2)))))))))))))
(describe "killed buffers"
(it "do not show up in it"
@@ -278,9 +278,9 @@
(a b)
(let ((session (list "some-session" a b)))
(with-current-buffer a
- (setq cider-repl-type "clj"))
+ (setq cider-repl-type 'clj))
(with-current-buffer b
- (setq cider-repl-type "clj"))
+ (setq cider-repl-type 'clj))
(sesman-register 'CIDER session)
(expect (cider-repls) :to-equal (list a b))
(kill-buffer b)
@@ -297,7 +297,7 @@
(with-temp-buffer
(setq-local nrepl-endpoint '(:host "localhost" :port 4005))
(setq-local nrepl-project-dir "proj")
- (setq-local cider-repl-type "clj")
+ (setq-local cider-repl-type 'clj)
(expect (cider--connection-info (current-buffer))
:to-equal "CLJ proj@localhost:4005 (Java 1.7, Clojure 1.7.0, nREPL 0.2.1)"))))
@@ -305,7 +305,7 @@
(it "returns information about the connection buffer without project name"
(with-temp-buffer
(setq-local nrepl-endpoint '(:host "localhost" :port 4005))
- (setq-local cider-repl-type "clj")
+ (setq-local cider-repl-type 'clj)
(expect (cider--connection-info (current-buffer))
:to-equal "CLJ <no project>@localhost:4005 (Java 1.7, Clojure 1.7.0, nREPL 0.2.1)")))))
@@ -316,9 +316,9 @@
(a b)
(let ((session (list "some-session" a b)))
(with-current-buffer a
- (setq cider-repl-type "clj"))
+ (setq cider-repl-type 'clj))
(with-current-buffer b
- (setq cider-repl-type "clj"))
+ (setq cider-repl-type 'clj))
(sesman-register 'CIDER session)
(expect (cider-repls) :to-equal (list a b))
(cider--close-connection b)
@@ -350,7 +350,7 @@
:and-return-value '(:project-dir "some/project" :host "localhost" :port 1234))
(spy-on 'nrepl-start-server-process
:and-return-value nil)
- (spy-on 'sesman-linked-sessions
+ (spy-on 'sesman-current-sessions
:and-return-value '(("a-session")))
(spy-on 'y-or-n-p
:and-return-value t)
@@ -361,5 +361,3 @@
(cider-jack-in-clj&cljs '(:project-dir "some/other/project")))
(it "detects existing project"
(expect 'y-or-n-p :to-have-been-called-times 3)))
-
-
diff --git a/test/cider-debug-tests.el b/test/cider-debug-tests.el
index e6afa65..606ecf5 100644
--- a/test/cider-debug-tests.el
+++ b/test/cider-debug-tests.el
@@ -1,6 +1,6 @@
;;; cider-debug-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/test/cider-eldoc-tests.el b/test/cider-eldoc-tests.el
index 750483c..03a2cbb 100644
--- a/test/cider-eldoc-tests.el
+++ b/test/cider-eldoc-tests.el
@@ -1,6 +1,6 @@
;;; cider-eldoc-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/test/cider-error-parsing-tests.el b/test/cider-error-parsing-tests.el
index 299d47b..46b5664 100644
--- a/test/cider-error-parsing-tests.el
+++ b/test/cider-error-parsing-tests.el
@@ -1,6 +1,6 @@
;;; cider-error-parsing-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/test/cider-find-tests.el b/test/cider-find-tests.el
index 3fcb3cb..657274c 100644
--- a/test/cider-find-tests.el
+++ b/test/cider-find-tests.el
@@ -1,6 +1,6 @@
;;; cider-find-tests.el
-;; Copyright © 2012-2018 Bozhidar Batsov
+;; Copyright © 2012-2019 Bozhidar Batsov
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/test/cider-font-lock-tests.el b/test/cider-font-lock-tests.el
index 1d135d9..eade167 100644
--- a/test/cider-font-lock-tests.el
+++ b/test/cider-font-lock-tests.el
@@ -68,7 +68,7 @@
(it "uses cider-reader-conditional-face"
(spy-on 'cider-connected-p :and-return-value t)
(spy-on 'cider-repls :and-return-value '(list t))
- (spy-on 'cider-repl-type :and-return-value "clj")
+ (spy-on 'cider-repl-type :and-return-value 'clj)
(cider--test-with-temp-buffer "#?(:clj 'clj :cljs 'cljs :cljr 'cljr)"
(let ((cider-font-lock-reader-conditionals t)
(found (cider--face-exists-in-range-p (point-min) (point-max)
@@ -78,7 +78,7 @@
(it "highlights unmatched reader conditionals"
(spy-on 'cider-connected-p :and-return-value t)
(spy-on 'cider-repls :and-return-value '(list t))
- (spy-on 'cider-repl-type :and-return-value "clj")
+ (spy-on 'cider-repl-type :and-return-value 'clj)
(cider--test-with-temp-buffer "#?(:clj 'clj :cljs 'cljs :cljr 'cljr)"
(let ((cider-font-lock-reader-conditionals t))
(expect (cider--face-exists-in-range-p 4 12 'cider-reader-conditional-face)
@@ -91,7 +91,7 @@
(it "works with splicing"
(spy-on 'cider-connected-p :and-return-value t)
(spy-on 'cider-repls :and-return-value '(list t))
- (spy-on 'cider-repl-type :and-return-value "clj")
+ (spy-on 'cider-repl-type :and-return-value 'clj)
(cider--test-with-temp-buffer "[1 2 #?(:clj [3 4] :cljs [5 6] :cljr [7 8])]"
(let ((cider-font-lock-reader-conditionals t))
(expect (cider--face-exists-in-range-p 1 18 'cider-reader-conditional-face)
@@ -104,7 +104,7 @@
(it "does not apply inside strings or comments"
(spy-on 'cider-connected-p :and-return-value t)
(spy-on 'cider-repls :and-return-value '(list t))
- (spy-on 'cider-repl-type :and-return-value "clj")
+ (spy-on 'cider-repl-type :and-return-value 'clj)
(cider--test-with-temp-buffer "\"#?(:clj 'clj :cljs 'cljs :cljr 'cljr)\" ;; #?(:clj 'clj :cljs 'cljs :cljr 'cljr)"
(let ((cider-font-lock-reader-conditionals t))
(expect (cider--face-exists-in-range-p (point-min) (point-max) 'cider-reader-conditional-face)
@@ -113,7 +113,7 @@
(it "highlights all unmatched reader conditionals"
(spy-on 'cider-connected-p :and-return-value t)
(spy-on 'cider-repls :and-return-value '(list t))
- (spy-on 'cider-repl-type :and-return-value "cljs")
+ (spy-on 'cider-repl-type :and-return-value 'cljs)
(cider--test-with-temp-buffer
"#?(:clj 'clj :cljs 'cljs :cljr 'cljr)\n#?(:clj 'clj :cljs 'cljs :cljr 'cljr)\n"
(let ((cider-font-lock-reader-conditionals t))
@@ -129,7 +129,7 @@
(it "does not highlight beyond the limits of the reader conditional group"
(spy-on 'cider-connected-p :and-return-value t)
(spy-on 'cider-repls :and-return-value '(list t))
- (spy-on 'cider-repl-type :and-return-value "clj")
+ (spy-on 'cider-repl-type :and-return-value 'clj)
(cider--test-with-temp-buffer
"#?(:clj 'clj :cljs 'cljs :cljr 'cljr)\n#?(:clj 'clj :cljs 'cljs :cljr 'cljr)\n"
(let ((cider-font-lock-reader-conditionals t))
@@ -144,7 +144,7 @@
(it "is disabled"
(spy-on 'cider-connected-p :and-return-value nil)
(spy-on 'cider-repls :and-return-value '(list t))
- (spy-on 'cider-repl-type :and-return-value '("clj" "cljs"))
+ (spy-on 'cider-repl-type :and-return-value '(clj cljs))
(cider--test-with-temp-buffer "#?(:clj 'clj :cljs 'cljs :cljr 'cljr)"
(let ((cider-font-lock-reader-conditionals t))
(expect (cider--face-exists-in-range-p (point-min) (point-max) 'cider-reader-conditional-face)
diff --git a/test/cider-grimoire-tests.el b/test/cider-grimoire-tests.el
index 0fd1c80..2318970 100644
--- a/test/cider-grimoire-tests.el
+++ b/test/cider-grimoire-tests.el
@@ -1,6 +1,6 @@
;;; cider-grimoire-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/test/cider-interaction-tests.el b/test/cider-interaction-tests.el
index 6dc8e37..9d30031 100644
--- a/test/cider-interaction-tests.el
+++ b/test/cider-interaction-tests.el
@@ -1,6 +1,6 @@
;;; cider-eval-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
@@ -77,7 +77,7 @@
(it "works as expected in empty Clojure buffers"
(spy-on 'cider-request:load-file :and-return-value nil)
(let ((default-directory "/tmp/a-dir"))
- (with-repl-buffer "load-file-session" "clj" b
+ (with-repl-buffer "load-file-session" 'clj b
(with-temp-buffer
(clojure-mode)
(setq buffer-file-name (make-temp-name "tmp.clj"))
@@ -87,7 +87,7 @@
(it "works as expected in empty Clojure buffers"
(spy-on 'cider-nrepl-request:eval :and-return-value nil)
(let ((default-directory "/tmp/a-dir"))
- (with-repl-buffer "interaction-session" "clj" b
+ (with-repl-buffer "interaction-session" 'clj b
(with-temp-buffer
(clojure-mode)
(expect (cider-interactive-eval "(+ 1)") :not :to-throw))))))
diff --git a/test/cider-ns-tests.el b/test/cider-ns-tests.el
index ed28984..4944523 100644
--- a/test/cider-ns-tests.el
+++ b/test/cider-ns-tests.el
@@ -1,6 +1,6 @@
;;; cider-ns-tests.el
-;; Copyright © 2018 Bozhidar Batsov
+;; Copyright © 2019 Bozhidar Batsov
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/test/cider-overlay-tests.el b/test/cider-overlay-tests.el
index 13b17be..16c2d08 100644
--- a/test/cider-overlay-tests.el
+++ b/test/cider-overlay-tests.el
@@ -1,6 +1,6 @@
;;; cider-overlay-tests.el -*- lexical-binding: t; -*-
-;; Copyright © 2015-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors
+;; Copyright © 2015-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors
;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
diff --git a/test/cider-repl-tests.el b/test/cider-repl-tests.el
index 5229b03..02124e5 100644
--- a/test/cider-repl-tests.el
+++ b/test/cider-repl-tests.el
@@ -1,6 +1,6 @@
;;; cider-repl-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/test/cider-selector-tests.el b/test/cider-selector-tests.el
index 88a8794..b5565eb 100644
--- a/test/cider-selector-tests.el
+++ b/test/cider-selector-tests.el
@@ -1,6 +1,6 @@
;;; cider-selector-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
@@ -65,7 +65,7 @@
;; (describe "cider-selector-method-m"
;; (it "switches to current connection's *nrepl-messages* buffer"
;; (let ((buf (get-buffer-create "*nrepl-messages some-id*")))
-;; (with-repl-buffer "a-session" "clj" _
+;; (with-repl-buffer "a-session" 'clj _
;; (setq-local nrepl-messages-buffer buf)
;; (message "%S" (nrepl-messages-buffer (cider-current-repl)))
;; (cider--test-selector-method ?m nil "*nrepl-messages some-id*")))))
diff --git a/test/cider-stacktrace-tests.el b/test/cider-stacktrace-tests.el
index 94c0956..9caccf7 100644
--- a/test/cider-stacktrace-tests.el
+++ b/test/cider-stacktrace-tests.el
@@ -1,6 +1,6 @@
;;; cider-stacktrace-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/test/cider-tests--no-auto.el b/test/cider-tests--no-auto.el
index c27bd50..e5116cb 100644
--- a/test/cider-tests--no-auto.el
+++ b/test/cider-tests--no-auto.el
@@ -1,6 +1,6 @@
;;; cider-tests--no-auto.el --- Non-automated tests -*- lexical-binding: t -*-
-;; Copyright © 2014-2018 Jeff Valk, Bozhidar Batsov and CIDER contributors
+;; Copyright © 2014-2019 Jeff Valk, Bozhidar Batsov and CIDER contributors
;; Author: Jeff Valk <jv@jeffvalk.com>
diff --git a/test/cider-tests.el b/test/cider-tests.el
index 61796cc..4c6a5da 100644
--- a/test/cider-tests.el
+++ b/test/cider-tests.el
@@ -1,6 +1,6 @@
;;; cider-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/test/cider-util-tests.el b/test/cider-util-tests.el
index b38cc94..ad43424 100644
--- a/test/cider-util-tests.el
+++ b/test/cider-util-tests.el
@@ -1,6 +1,6 @@
;;; cider-util-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
@@ -183,11 +183,11 @@
;; :var (cider-version)
;; (it "returns the manual correct url for stable cider versions"
;; (setq cider-version "0.11.0")
-;; (expect (cider-manual-url) :to-equal "http://docs.cider.mx/en/stable/"))
+;; (expect (cider-manual-url) :to-equal "https://docs.cider.mx/en/stable/"))
;; (it "returns the manual correct url for snapshot cider versions"
;; (setq cider-version "0.11.0-snapshot")
-;; (expect (cider-manual-url) :to-equal "http://docs.cider.mx/en/latest/")))
+;; (expect (cider-manual-url) :to-equal "https://docs.cider.mx/en/latest/")))
(describe "cider-refcard-url"
:var (cider-version)
diff --git a/test/nrepl-bencode-tests.el b/test/nrepl-bencode-tests.el
index 4e70435..64b11b0 100644
--- a/test/nrepl-bencode-tests.el
+++ b/test/nrepl-bencode-tests.el
@@ -1,6 +1,6 @@
;;; nrepl-bencode-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/test/nrepl-client-tests.el b/test/nrepl-client-tests.el
index 840525c..0c99a0f 100644
--- a/test/nrepl-client-tests.el
+++ b/test/nrepl-client-tests.el
@@ -1,6 +1,6 @@
;;; nrepl-client-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
@@ -78,14 +78,14 @@
(it "understands all formats"
(with-temp-buffer
(let ((params '(:project-dir "path/to/dirB" :host "localhost" :port 100
- :repl-type "cljs" :cljs-repl-type "node")))
+ :repl-type cljs :cljs-repl-type "node")))
(expect (nrepl-make-buffer-name "*buff-name %j:%J:%h:%H:%p:%r:%S*" params)
:to-equal "*buff-name dirB:to/dirB:localhost:100:cljs:node*"))))
(it "strips trailing separators"
(with-temp-buffer
(let ((params '(:project-dir "path/to/dirB" :host "localhost" :port 100
- :repl-type "cljs" :cljs-repl-type nil)))
+ :repl-type cljs :cljs-repl-type nil)))
(expect (nrepl-make-buffer-name "*buff-name [%r:%S]*" params)
:to-equal "*buff-name [cljs]*")
(expect (nrepl-make-buffer-name "*buff-name (%r:%S)*" params)
diff --git a/test/nrepl-dict-tests.el b/test/nrepl-dict-tests.el
index 0011ff7..fb50c7b 100644
--- a/test/nrepl-dict-tests.el
+++ b/test/nrepl-dict-tests.el
@@ -1,6 +1,6 @@
;;; nrepl-dict-tests.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
diff --git a/test/utils/cider-connection-test-utils.el b/test/utils/cider-connection-test-utils.el
index a9c53ad..2c04c39 100644
--- a/test/utils/cider-connection-test-utils.el
+++ b/test/utils/cider-connection-test-utils.el
@@ -1,6 +1,6 @@
;;; cider-connection-test-utils.el
-;; Copyright © 2012-2018 Tim King, Bozhidar Batsov
+;; Copyright © 2012-2019 Tim King, Bozhidar Batsov
;; Author: Tim King <kingtim@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>