Fork me on GitHub
#inf-clojure
<
2022-04-07
>
apt16:04:46

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.

apt16:04:34

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.

dpsutton17:04:12

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

dpsutton17:04:48

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

apt17:04:39

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.

apt17:04:52

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