Fork me on GitHub
#cursive
<
2021-11-19
>
markaddleman16:11:38

I've been searching for a way to replace the REPL console window with the Portal plugin. I've been playing with repl commands for a few days and have recently come up with :

(ns ~file-namespace)
(try (tap> (eval '~top-level-form))
     (catch Throwable t
       (tap> t)))
I like it because taps forms that cannot be evaluated. Anybody else have Cursive repl commands that might be worth sharing?

shinichy19:11:14

Hi @cfleming, is there any plan to support paredit-convolute-sexp? I sometimes miss this functionality. https://github.com/cursive-ide/cursive/issues/809

1
cfleming00:12:47

Sorry, I missed this when you posted it. I could do, but I never found a decent explanation online of how it should work.

shinichy04:12:58

I think emacs’s document explains the behavior. > “Convolute S-expressions. > Save the S-expressions preceding point and delete them. > Splice the S-expressions following point. > Wrap the enclosing list in a new list prefixed by the saved text. > With a prefix argument N, move up N lists before wrapping.” https://github.com/emacsmirror/paredit/blob/8330a41e8188fe18d3fa805bb9aa529f015318e8/paredit.el#L2181 Calva’s implementation https://github.com/BetterThanTomorrow/calva/blob/986b4fd1afd84a916c6c460acb7a9a69f08e4692/src/cursor-doc/paredit.ts#L879

shinichy04:12:49

An example used in Calva https://calva.io/paredit/

(let [s [1 2 3 4 5]]
  (->> s
       (map (apply + [1 2 3]))
       |(repeat 4)
       (zipmap (range 4))))
;Save the S-expressions preceding point and delete them.
;Saved S-expressions are
;->> s
;    (map (apply + [1 2 3]))

(let [s [1 2 3 4 5]]
  (|(repeat 4)
   (zipmap (range 4))))
;Splice the S-expressions following point.
(let [s [1 2 3 4 5]]
  |(repeat 4)
  (zipmap (range 4)))
;Wrap the enclosing list in a new list prefixed by the saved text.
(->> s
     (map (apply + [1 2 3]))
     (let [s [1 2 3 4 5]]
       |(repeat 4)
       (zipmap (range 4))))

shinichy23:12:41

@cfleming Just want to ping you in case you missed my reply.

cfleming23:12:56

@U40AQPFAM Thanks, I’ve updated the Github issue with those examples. It’s probably likely to be a low priority with everything else I have to do, though.

shinichy00:12:02

@cfleming ok. Hope you find some time to work on it in the future. Thanks!