Skip to content

Commit

Permalink
cider--sesman-friendly-session-p: check for ns-list op availability
Browse files Browse the repository at this point in the history
This speeds up `(cider-current-repl)` performance in non-linked buffers from to 0.01s to 0.00098800s.

Because `(cider-current-repl)` can be repeatedly invoked by e.g. `electric-indent-mode`, it makes a difference.

Fixes clojure-emacs/clojure-mode#665
  • Loading branch information
vemv committed Sep 28, 2023
1 parent 6b36f09 commit 3693274
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cider-repl.el
Original file line number Diff line number Diff line change
Expand Up @@ -1778,11 +1778,12 @@ The checking is done as follows:
(cider-classpath-entries))))
(process-put proc :cached-classpath cp)
cp)))
(ns-list (or (process-get proc :all-namespaces)
(let ((ns-list (with-current-buffer repl
(cider-sync-request:ns-list))))
(process-put proc :all-namespaces ns-list)
ns-list)))
(ns-list (when (nrepl-op-supported-p "ns-list" repl)
(or (process-get proc :all-namespaces)
(let ((ns-list (with-current-buffer repl
(cider-sync-request:ns-list))))
(process-put proc :all-namespaces ns-list)
ns-list))))
(classpath-roots (or (process-get proc :cached-classpath-roots)
(let ((cp (thread-last classpath
(seq-filter (lambda (path) (not (string-match-p "\\.jar$" path))))
Expand Down

0 comments on commit 3693274

Please sign in to comment.