Wilfred / emacs-refactor

language-specific refactoring in Emacs
GNU General Public License v3.0
348 stars 27 forks source link

emr-el-extract-function is confused by let binding #10

Open Wilfred opened 8 years ago

Wilfred commented 8 years ago

Given the following code, where | is the point:

(defun foobar (x)
  (let* ((y |(+ x 1)))))

M-x emr-el-extract-function RET foo RET RET gives:

(defun foo (y x)
  (+ x 1))

(defun foobar (x)
  (let* ((y (foo y x)))))
Wilfred commented 8 years ago

It does work if point is inside the form:

(defun foobar (x)
  (let* ((y (|+ x 1)))))

This is because emr-el:form-extent-for-extraction calls list-at-point, which gets the enclosing list.

Is this a behaviour that's worth changing, or is just a documentation issue?

mooseyboots commented 2 years ago

i just got going with emr and found this really confusing, mainly because with non-let refactorings into functions, extracting from outside the form works.