abo-abo / lispy

Short and sweet LISP editing
http://oremacs.com/lispy/
1.19k stars 129 forks source link

lispy-to-ifs not handling trailing newlines for cond #638

Open RuijieYu opened 1 year ago

RuijieYu commented 1 year ago

For this snippet:

(cond (nil)
      )

When calling lispy-to-ifs (xi) on the beginning of the cond expression, I get this snippet:

(if nil
    nil (if ly-raw newline))

After looking around I think it is because of these lines inside lispy-to-ifs: https://github.com/abo-abo/lispy/blob/31b9bfb4bc9799a2654b28e85a5cae2820c15f32/lispy.el#L5330-L5338

In particular, the call to lispy--read generates this:

(cond (nil) (ly-raw newline))

Maybe there should be some sort of input sanitization inside lispy-to-ifs?