Skip to content

Latest commit

 

History

History
85 lines (69 loc) · 5.48 KB

todo.org

File metadata and controls

85 lines (69 loc) · 5.48 KB

Core

set repl type on connection not first command

For some reason inf-clojure--set-repl-type is called in:

  1. inf-clojure–send-string
  2. inf-clojure-reload-form
  3. inf-clojure-reload-all-form

Seems better to do this on the two different connection methods and then be done with it?

do we need repl type in both source buffer and connection?

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)

Better dispatch for the implementations

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.

Nicer interface to create a command

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.

Simpler way to define an implementation

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.

ability to update repl commands

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"))

Multiple connections

As proven by CIDER, multiple connections are just a pain. Scoping, navigating into dependencies, etc. This is a monster lurking

navigation to source

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?

PREPL

Be nice to implement this now that we have parseedn in elisp to understand edn.

inhibit custom repl-type and startup form

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.

Nice-to-haves

Put repl type in modeline

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.

How do CIDER and inf-clojure play nice on the same emacs?

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.

is disabling color still required?

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?

nice startup

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?