For some reason inf-clojure--set-repl-type
is called in:
- inf-clojure–send-string
- inf-clojure-reload-form
- inf-clojure-reload-all-form
Seems better to do this on the two different connection methods and then be done with it?
these can get out of sync and lead to confusing errors when closing a repl and opening a new one. It seems like we keep the repl-type in the source buffer to prevent a single (with-current-buffer (process-buffer proc) inf-clojure-repl-type)
Right now the functions are kinda clunky cond statements:
(defun inf-clojure-cljs-features-dispatch (feature)
(case feature
;; ((load) "(cljs.core/load-file \"%s\")")
((doc) "(cljs.repl/doc %s)")
((source) "(cljs.repl/source %s)")
((arglists) "(try (->> '%s cljs.core/resolve cljs.core/meta :arglists) (catch :default _ nil))")
((apropos) "(cljs.repl/apropos \"%s\")")
((ns-vars) "(cljs.repl/dir %s)")
((set-ns) "(cljs.core/in-ns '%s)")
((macroexpand) "(cljs.core/macroexpand '%s)")
((macroexpand-1) "(cljs.core/macroexpand-1 '%s)")
;; ((completion) inf-clojure-completion-form-lumo)
))
I really want something similar to (defprotocol Inf-clojure-REPL (doc ...)(source ...))
rather than just this super open ended dispatch on symbols. I just don’t know enough elisp at the moment. Also, the current function version prevents introspection and providing a way of listing the repl’s capabilities without duplicating the keys. Or maybe a hack of sending all of the known keys in and seeing which return strings. Still not great.
Right now everything is just a format string with a single %s
in it and that’s called with (format feature-form e)
where e
is a symbol, or a form, or a whatever makes sense for that type of feature. This isn’t super elegant although it does keep inf-clojure honest in that all it does it format commands to ask a simple repl. But there could probably be a better way.
This first pass is very mechanical and just rearranging so we can easily see which features are where. In the future we should look into just providing the repl namespace and seeing how far we can get with that. For instance, an API like (inf-clojure-register 'bb "bb.repl")
and this would tell us where source
, doc
, apropos
…etc live. No reason to duplicate all of these.
we had this feature originally but now they are all literals. This is almost entirely fine but one problem. It would be common to toss clojure completions on the class path and then add the completions form for clojure.
This should come back but only in a sense: if you don’t have this on the classpath its obviously unacceptable to throw errors every time the user hits tab. Do we need some state recording if this is on the classpath or not maybe?
(defcustom inf-clojure-completion-form
"(complete.core/completions \"%s\")"
"Form to query inferior Clojure for completion candidates."
:type 'string
:safe #'stringp
:package-version '(inf-clojure . "2.0.0"))
As proven by CIDER, multiple connections are just a pain. Scoping, navigating into dependencies, etc. This is a monster lurking
The source primitive is quite nice but we most likely need a way to navigate to source. Possibly punt on this and just suggest people use with clojure-lsp?
Be nice to implement this now that we have parseedn in elisp to understand edn.
its nice to have these in dir-locals to just start up. but if you normally have clojure -m cljs.main -r
as the startup command but you want to crank up a clj repl there’s no way without removing those dir locals.
Rather than just *inf-clojure*
we could put the repl type. Make it easy to follow and makes it easy to see when it gets it wrong.
inf-clojure and CIDER are fighting over the keymappings. I’ve been doing a bit of a kludge to remove CIDER’s tentacles from my clojure files for developing:
(seq-doseq (buffer (buffer-list))
(with-current-buffer buffer
(cider-mode -1))
(remove-hook 'clojure-mode-hook #'cider-mode))
Seems a bit heavy handed but its working for me so far.
in the readme it mentions that color should be turned off. in my usage I haven’t run into this problem at all. perhaps no longer true?
There’s some project detection but that’s becoming less and less useful as time goes on. Shadow, lein, deps.edn can all easily be mixed in the same project. And then lumo, planck, or bb scripts could live side by side. Rather than trying to guess the project type, I think i’d like to mimic geiser’s style of handling multiple scheme backends. Perhaps m-x inf-clojure-run-planck
and similar could help out.
Some considerations:
- is this path aware? IE, don’t show an option to run planck, lumo, etc, if they aren’t visible or installed?
- should it have a rebuild function so that user registered implementations can show up in the
m-x
menu as well?