Fork me on GitHub
#parinfer
<
2020-10-15
>
grav22:10:25

(Also posted in #emacs) I've been trying to get parinfer v3 (aka "smart-mode") to work in Emacs. I've been using it in Cursive. I've found two implementations: 1. parinfer-mode, the smart branch: https://github.com/DogLooksGood/parinfer-mode/tree/smart 2. parinfer-rust-mode: https://github.com/justinbarclay/parinfer-rust-mode I've been able to get both up and running, but none of them seem to work like the reference implementation: https://shaunlebron.github.io/parinfer/demo A test that I made is to type a ( in front of the {:sum ... map. Both implementations don't automatically "slurp" the hashmap into a pair of parens (ie turning it into

({:sum sum 
  :prod prod})
Anyone had other experiences?

seancorfield23:10:50

@grav I would expect ( to just introduce () unless you are using paredit as well.

grav18:10:42

That's not how the reference implementation which I linked to, as well as Cursive, which implements paredit smart-mode, behaves

grav18:10:07

Or maybe I'm misunderstanding your comment

justinbarclay23:10:11

For parinfer-rust, and parinfer-rust-mode, if paredit mode is on it forces parens to be balanced before parinfer operates on the buffer. Therefore, parinfer won't infer that it should wrap the following sexp. cc @grav

grav18:10:27

Thanks, that makes sense! I'm pretty new to Emacs, and I apparently am not able to disable paredit in a simple way with prelude, so I am unable to test it.

grav18:10:41

Ah, apparently it's called smartparens, and yes, disabling it does seem to make the specific scenario work!

justinbarclay18:10:13

Awesome glad to here it 🙂 If you always want smartparens turned off in a particular major-mode, you could use something like: (add-hook 'clojure-mode-hook (lambda () (smartparens-mode -1)))

grav18:10:31

Perfect, thanks! 🙂

justinbarclay23:10:41

I assume that this holds true for smartparens as well.