parinfer / parinfer.js

Let's simplify the way we write Lisp
https://shaunlebron.github.io/parinfer
MIT License
1.76k stars 40 forks source link

Revise "Paredit emerges" section #108

Open shaunlebron opened 8 years ago

shaunlebron commented 8 years ago

I stated things in the "Paredit emerges" section without proof, and it's been shown to not work in some cases described in #102 and #107.

I'll be revisiting assumptions. What follows is my current understanding of how to fix descriptions of expected behavior, and how to revise the rules to minimize unexpected behavior.

New Rules

  1. When encountering an unmatched close paren, suspend Indent Mode.
    • unless it falls inside a Paren Trail, where by definition, its susceptible to relocation by indentation
    • is this exception truly safe?

      New Implications

If parens are balanced:

If parens are imbalanced:

mauricioszabo commented 8 years ago

Maybe one more case to check, suppose I have: (map (fn [c] ) changes)

If I insert (map (fn [c] {) changes), I suppose it would become (map (fn [c] {}) changes). Right now, is ignoring the close-parens and becoming: (map (fn [c] { changes})).