 ;;---------------------------------------------------------------------------
 ;; Begin of modification by H.Li
 
-(defun erl-undo-process(node)
-  "Start the undo managment process."
-  (interactive (list (erl-target-node)))
-  (erl-spawn (erl-send-rpc node 'wrangler_distel 'start_undo_process (list))))
+;; (defun erl-undo-process(node)
+;;   "Start the undo managment process."
+;;   (interactive (list (erl-target-node)))
+;;   (erl-spawn (erl-send-rpc node 'wrangler_distel 'start_undo_process (list))))
 
 (defun erl-refactor-undo(node)
   "Undo the latest refactoring."

	 (if changed (message-box (format "there are modified buffers: %s" changed))
	   (if (yes-or-no-p "Undo a refactoring will also undo the editings done after the refactoring, undo anyway?")
	   (erl-spawn
	     (erl-send-rpc node 'wrangler_distel 'undo (list))
	     (erl-receive (buffer)
		 ((['rex ['badrpc rsn]]
		   (message "Undo failed: %S" rsn))

		       nil)))))
            (message "Refactoring succeeded!"))))))))

(defun erl-refactor-rename-process(node name)
  "Rename a registered process."
  (interactive (list (erl-target-node)
		     (read-string "New name: ")
		     ))
  (let ((current-file-name (buffer-file-name))
	(line-no           (current-line-no))
        (column-no         (current-column-no))
	(buffer (current-buffer)))
    (let (changed)
      (dolist (b (buffer-list) changed)
	(let* ((n (buffer-name b)) (n1 (substring n 0 1)))
	  (if (and (not (or (string= " " n1) (string= "*" n1))) (buffer-modified-p b))
	      (setq changed (cons (buffer-name b) changed)))))
      (if changed (message-box (format "there are modified buffers: %s" changed))
	(erl-spawn
	  (erl-send-rpc node 'wrangler_distel 'rename_process (list current-file-name line-no column-no name erlang-refac-search-paths))
      (erl-receive (buffer node name current-file-name)
	  ((['rex ['badrpc rsn]]
	    (message "Refactoring failed: %S" rsn))
	   (['rex ['error rsn]]
	    (message "Refactoring failed: %s" rsn))
	   (['rex ['undecidables oldname]]
	   (if (yes-or-no-p "Do you want to continue the refactoring?")
	       (erl-spawn
		 (erl-send-rpc node 'refac_rename_process 'rename_process_1
			       (list current-file-name oldname name erlang-refac-search-paths))
		 (erl-receive (buffer)
		     ((['rex ['badrpc rsn]]
		       (message "Refactoring failed: %S" rsn))
		      (['rex ['error rsn]]
		       (message "Refactoring failed: %s" rsn))
		      (['rex ['ok modified]]
		       (with-current-buffer buffer (revert-buffer nil t t))
		       (message "Refactoring succeeded!")))))
	     (message "Refactoring aborted!")))
	   (['rex ['ok modified]]
	    (with-current-buffer buffer
	       (dolist (f modified)
		 (let ((buffer (get-file-buffer f)))
		   (if buffer (with-current-buffer buffer (revert-buffer nil t t))
		     ;;(message-box (format "modified unopened file: %s" f))))))
		     nil))))
	       (message "Refactoring succeeded!")))))))))


(defun erl-refactor-register-pid(node name start end)
