Skip to content

babashka.nrepl - Emacs Cider "Lisp Expression:" minibuffer prompt when switching projects #3182

@kwrooijen

Description

@kwrooijen

Expected behavior

Connect to babashka.nrepl like any other Clojure NREPL server.

Actual behavior

When connecting to to a babashka.nrepl server everything seems to work fine until I try to switch files (mostly from another project) Emacs will keep prompting "Lisp Expression:" in the minibuffer. Sometimes it also completely locks my Emacs instance.

Steps to reproduce the problem

  1. Start the repl server with lein run (code example below)
  2. Using Emacs, navigate to any Clojure project
  3. M-x cider-connect >> localhost >> 23456
  4. Eval some stuff (this works)
  5. Navigate to another clojure project and open a clj file >> Lisp expression: should pop up

Environment & Version information

Minimal Emacs config (Only install clojure + cider)

(setq gc-cons-threshold most-positive-fixnum)
(defvar bootstrap-version)

(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'use-package)

(use-package clojure-mode :straight t)

(use-package cider :straight t)

Minimal babashka nrepl setup:

;; project.clj
(defproject nrepl-test "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.10.3"]
                 [babashka/babashka.nrepl "0.0.6"]]
  :main ^:skip-aot nrepl-test.core)

;; src/nrepl-test/core.clj
(ns nrepl-test.core
  (:require
   [sci.core :as sci]
   [sci.addons :as addons]
   [babashka.nrepl.server])
  (:gen-class))

(defn start-server! []
  (let [opts {:namespaces {'clojure.main {'repl-requires '[]}}}
        sci-ctx (-> (sci/init opts)
                    addons/future)]
    (babashka.nrepl.server/start-server! sci-ctx {:host "127.0.0.1" :port 23456})))

(defn -main [& args]
  (start-server!)
  @(promise))

CIDER version information

;; Connected to nREPL server - nrepl://localhost:23456
;; CIDER 1.3.0 (Ukraine)
: Nothing specified to load user 
WARNING: Can't determine Clojure version.  The refactor-nrepl middleware requires clojure 1.8.0 (or newer)
WARNING: clj-refactor and refactor-nrepl are out of sync.
Their versions are 3.5.2 and n/a, respectively.
You can mute this warning by changing cljr-suppress-middleware-warnings.

Emacs version

29.0.50

Operating system

Linux Laptop 5.16.14-1-MANJARO

Notes

I initially opened an issue at babashka.repl babashka/babashka.nrepl#50 but was redirected here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions