This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-18
Channels
- # aleph (1)
- # announcements (31)
- # babashka (9)
- # babashka-sci-dev (36)
- # beginners (72)
- # calva (20)
- # clj-kondo (99)
- # cljsrn (1)
- # clojure (77)
- # clojure-europe (33)
- # clojure-nl (4)
- # clojure-norway (12)
- # clojure-uk (4)
- # clojurescript (23)
- # cursive (2)
- # datascript (5)
- # events (1)
- # fulcro (3)
- # honeysql (3)
- # inf-clojure (82)
- # interop (2)
- # kaocha (10)
- # lsp (15)
- # meander (1)
- # missionary (10)
- # off-topic (22)
- # pathom (4)
- # pedestal (3)
- # polylith (20)
- # re-frame (10)
- # react (4)
- # reagent (4)
- # reitit (27)
- # ring-swagger (1)
- # shadow-cljs (34)
- # specter (3)
- # sql (1)
- # testing (5)
- # tools-deps (22)
- # vim (12)
Is it possible to interact with a random process via stdin/stdin in inf-clojure? it's a while since I used it
I'm trying C-u M-x inf-clojure
but I'm not able to enter a random process like npx nbb
so you can totally just enter a random process m-x inf-clojure
and then instead of choosing something in that list just type npx nbb
i tried to choose y but i think inf-clojure is trying to display a prompt and it is not working
i executed npx nbb from a terminal afterwards and tried again and still got the same behavior
I tried that, but it wants me to choose one of the autocompletions and there's no way for me to get around this
you can type whatever you want here. the prefilled are just conveniences. because you'll always need the possibility for aliases
Yes, but the socket REPL doesn't offer the completions yet, but they are supported on the console now and I wanted to test if that worked with inf-clojure.
The completions are activated when you press TAB (twice) and this works on the console
> • ‘confirm-after-completion’ means that the user can exit with any input, but she needs to confirm her choice if she called ‘minibuffer-complete’ right before ‘minibuffer-complete-and-exit’ and the input is not an element of COLLECTION.
if you want to just edit the source a little bit
(completing-read "Select Clojure REPL startup command: "
(mapcar #'cdr inf-clojure-startup-forms)
nil
'confirm-after-completion)
change that confirm-after-competion
to be a nil
.also, make sure you've updated to the latest version (a change from a day or two ago) and set (setq inf-clojure-enable-eldoc nil)
because it will keep trying to get arglists for eldoc from your cursor position and erroring and adding new prompts to the repl
inf-clojure 20220315.1102 installed Run an external Clojure process in an Emacs buffer
yeah we’d have to tell it how to get completions from nbb. and i thought its not exposed as a function that is callable
no urgency here, I just wanted to see if it worked. if you go in your terminal and do:
npx [email protected]
(require '["fs" :as fs])
(fs/ TAB TAB
then you should see some completions> The easiest possible data passed in input is a list of candidates (e.g.: (\“def\” \“defn\“)) but more complex libraries like `alexander-yakushev/compliment’ can return other things like edn.
there is an edn parser but its not a dep of this project yet. but i’d be happy adding it
well, "for the moment" is the problem because when I return a flat list of strings, I don't have the oppurtunity to add more later, a recipe for breaking changes
I guess inf-clojure could wrap the function call in some data processing inside of nbb and then get that result, right?
or the function could take an arg indicating the return? (completions :list "set")
and later (completions :edn "set")
. Or yes we could process inside of nbb. (map :name (completions "set"))
the thing, is, I'd like to keep the things relatively the same for nREPL and other stuff. That format is
{"completions" [{"candidate "fs/readFileSync" "ns" nil}]}
$ node out/nbb_main.js
Welcome to nbb v0.2.8!
user=> (require '[nbb.repl :refer [get-completions]])
nil
user=> (get-completions "in")
["inst-ms" "inst?" "int-array" "interleave" "into" "int" "int?" "indexed?" "instance?" "integer?" "intern" "inc" "ints" "interpose" "into-array"]
OK, I guess I can just re-use the nREPL format internally and expose the more simple format just for socket REPL/inf-clojure ^user=> (require '["fs" :as fs])
nil
user=> (get-completions "fs/")
["fs/Dir" "fs/Dirent" "fs/F_OK" ...]
Welcome to nbb v0.2.9!
user=> (require '[nbb.repl :refer [get-completions]])
nil
user=> (get-completions "co")
("contains?" "cond->>" "comp" "cons" "conj!" "conj" "compare-and-set!" "concat" "counted?" "completer*" "cond->" "condp" "cond" "comment" "count" "comparator" "compare" "complement" "constantly" "completing" "coll?")
user=> (require '[clojure.set :as set])
nil
user=> (get-completions "set/")
("set/union" "set/map-invert" "set/join" "set/select" "set/intersection" "set/superset?" "set/index" "set/subset?" "set/rename" "set/rename-keys" "set/project" "set/difference" "set/")
(nbb.repl/get-completions "str/")
("str/ends-with?" "str/capitalize" "str/reverse" "str/join" "str/replace-first" "str/starts-with?" "str/escape" "str/last-index-of" "str/includes?" "str/replace" "str/split-lines" "str/lower-case" "str/trim-newline" "str/upper-case" "str/split" "str/trimr" "str/index-of" "str/trim" "str/triml" "str/blank?" "str/")
it’s close. gonna have to figure out what little assumption needs to be respected somewhere later