inf-clojure

apt 2022-04-07T16:54:46.675879Z

Hi folks. What’s the best way of setting inf-clojure-custom-repl-type (which is a defcustom) locally? Context: I have a custom command for starting clojure projects and another one for cljs. I’d like to set inf-clojure-custom-repl-type in each of them. What’s the most idiomatic way of doing that? I tried to simply use let but it complained about redefining a lexical var or something like that.

apt 2022-04-07T16:55:34.480159Z

I suppose I can just setq and override the value later, as needed, but if there’s a way of binding it locally, I’d rather use it.

dpsutton 2022-04-07T17:00:12.472369Z

i think you’d need to add some new functionality. It shouldn’t be too hard but it does get a bit verbose. My thinking is make a rebindable var for a custom repl type and then you could set it to whatever you need, and update the “get feature” type functions to look at the custom one when using a custom repl type

dpsutton 2022-04-07T17:00:48.506479Z

you should be able to reuse some stuff if it largely overlaps. (setq custom-thingy ...) and get the one for clojure or clojurescript and assoc the things into it you need

apt 2022-04-07T17:34:39.560379Z

I think I got your suggestion. In any case, I search for occurrences of inf-clojure-custom-repl-type in inf-clojure. I just found it once in inf-clojure, for binding the repl type, which gets stored in inf-clojure-repl-type with setq-local. So I think it’s safe to set it with setq in my custom commands, it’s not used internally after that anyway.

apt 2022-04-07T17:35:52.284039Z

That is, it represents only the default repl type when using the inf-clojure command.