diff --git a/cider.el b/cider.el index 1b21fd707..41ec02744 100644 --- a/cider.el +++ b/cider.el @@ -892,10 +892,15 @@ buffer." (cider--check-required-nrepl-version) (cider--check-clojure-version-supported) (cider--check-middleware-compatibility) - (cider--debug-init-connection) (cider--subscribe-repl-to-server-out) (when cider-auto-mode (cider-enable-on-existing-clojure-buffers)) + ;; Middleware on cider-nrepl side is loaded dynamically on first + ;; usage. Loading middleware concurrently can lead to confusing issues + ;; (likely a clojure bug). Debug middleware is heavy, so enable it at the + ;; end and hope for the best. Ideally, the sequence of middleware loading + ;; should be done in a deferred chain. + (cider--debug-init-connection) (run-hooks 'cider-connected-hook))) (defun cider--disconnected-handler ()