Wilfred / emacs-refactor

language-specific refactoring in Emacs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected newline in `emr-el-extract-to-let`

symbiont-matthew-piziak opened this issue · comments

To reproduce, insert (+ 1 (* 2 3)), select (* 2 3), and run emr-el-extract-to-let. This results in the following:

(let (
      (x (* 2 3)))
  (+ 1 x))

I would expect this instead:

(let ((x (* 2 3)))
  (+ 1 x))

This is only unsatisfying on the first variable extraction. Added variables work fine, since they are added to the body. If I start with this…

(let ((x (* 2 3)))
  (+ 1 x))

…and I extract y = 1, I get this…

(let ((x (* 2 3))
      (y 1))
  (+ y x))

…which looks good to me.

Is this behavior expected, can I fix it? Or is this something I should be customizing somewhere else?

Possible fix here? #53