(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?@grav I would expect (
to just introduce ()
unless you are using paredit as well.
That's not how the reference implementation which I linked to, as well as Cursive, which implements paredit smart-mode, behaves
Or maybe I'm misunderstanding your comment
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
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.
Ah, apparently it's called smartparens, and yes, disabling it does seem to make the specific scenario work!
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)))
Perfect, thanks! 🙂
I assume that this holds true for smartparens as well.