       (if changed (message-box (format "there are modified buffers: %s" changed))
     (erl-spawn
       (erl-send-rpc node 'wrangler_distel 'tuple_funpar (list current-file-name line-no column-no number erlang-refac-search-paths))
-      (erl-receive (buffer)
+      (erl-receive (buffer line-no column-no)
 	  ((['rex ['badrpc rsn]]
 	    (message "Refactoring failed: %S" rsn))
 	   (['rex ['error rsn]]
 	    (message "Refactoring failed: %s" rsn))
 	   (['rex ['ok refac-rename]]
-	    (with-current-buffer buffer (revert-buffer nil t t))
+	    (with-current-buffer buffer (progn (revert-buffer nil t t)
+					       (goto-char (get-position line-no column-no))))
             (message "Refactoring succeeded!")))))))))
 
 

  (save-excursion
    (goto-line line)
    (move-to-column col)
    (point)))


(defvar highlight-region-overlay

			   (['rex ['error rsn]]
			    (message "Refactoring failed: %s" rsn))
			   (['rex ['ok refac-generalisation]]
			    (with-current-buffer buffer (progn (revert-buffer nil t t)
							       (goto-char (get-position start-line-no start-col-no))))
			    (message "Refactoring succeeded!")))))
		  (erl-spawn
		      (erl-send-rpc node 'refac_gen 'gen_fun_1 (list 'false current-file-name parname funname arity defpos exp))
		      (erl-receive (buffer start-line-no start-col-no)
			  ((['rex ['badrpc rsn]]
			    (message "Refactoring failed: %S" rsn))
			   (['rex ['error rsn]]
			    (message "Refactoring failed: %s" rsn))
			   (['rex ['ok refac-generalisation]]
			    (with-current-buffer buffer (progn (revert-buffer nil t t)
							       (goto-char (get-position start-line-no start-col-no))))
			    (message "Refactoring succeeded!")))))))
	   (['rex ['ok refac-generalisation]]
	    (with-current-buffer buffer (progn (revert-buffer nil t t)
						(goto-char (get-position start-line-no start-col-no))))
            (message "Refactoring succeeded!")))))))))


