Skip to content

cider-toggle-buffer-connection fails #1913

@alvinfrancis

Description

@alvinfrancis

Expected behavior

cider-toggle-buffer-connection should toggle between CLJ and CLJS connections (if both exist) in a clojurec-mode buffer (e.g. cljc files) or in a cider-clojure-interaction-mode buffer (e.g. *cider-scratch*). This should allow expressions to be evaluated in the appropriate connection. Also, cider-connections should still contain both CLJ and CLJS connections after toggling.

Actual behavior

Connection to REPL is seemingly lost; evaluating expressions causes CIDER to complain that a Clojure REPL is required and that a jack in is probably needed. Also, cider-connections loses one of the connections (the current one).

Steps to reproduce the problem

  1. Do lein new cider-toggle-buffer-connection
  2. Edit project.clj to the following:
(defproject cider-toggle-buffer-connection "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [com.cemerick/piggieback "0.2.1"]
                 [org.clojure/clojure "1.7.0"]]
  :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
  )
  1. Do mv src/cider-toggle-buffer-connection/core.cljs src/cider-toggle-buffer-connection/core.cljc
  2. Edit src/cider-toggle-buffer-connection/core.cljc to the following:
(ns cider-toggle-buffer-connection.core)
(println "Test")
  1. Open src/cider-toggle-buffer-connection/core.cljc in emacs.
  2. Do cider-jack-in-clojurescript.
  3. Take note of the value of cider-connections: there should be two connections (CLJ and CLJS).
  4. Evaluate (println "Test") with cider-eval-last-sexp. This should print "Test" in the *cider-repl cider-toggle-buffer-connection* buffer.
  5. Do cider-toggle-buffer-connection.
  6. Evaluate (println "Test") with cider-eval-last-sexp. This should cause CIDER to complain with the following message:

user-error: ‘cider-eval-last-sexp’ needs a Clojure REPL.
If you don’t know what that means, you probably need to jack-in (‘C-c M-j’).

  1. Take note of the value of cider-connections: only the CLJS connections remains.

Environment & Version information

CIDER version information

;; CIDER 0.14.0 (Berlin), nREPL 0.2.12
;; Clojure 1.8.0, Java 1.8.0_74

Emacs version

GNU Emacs 25.1.3 (x86_64-apple-darwin15.6.0, Carbon Version 157 AppKit 1404.47) of 2016-09-18

Operating system

OSX 10.11.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions