 
 (defvar darcsum-darcs-2-options 'not-set)
 
-(defun darcsum-start-process (subcommand args
-                                         &optional name value &rest localize)
-  "Start darcs process."
+(defun darcsum-darcs-2-options-init ()
   (if (eq darcsum-darcs-2-options 'not-set)
       ;; Check version and set proper darcsum-darcs-2-options
       (with-temp-buffer
 	(call-process darcsum-program nil t nil "--version")
 	(goto-char (point-min))
 	(setq darcsum-darcs-2-options
-	      (if (looking-at "2[.]") (list "--quiet")))))
+	      (if (looking-at "2[.]") (list "--quiet"))))))
+
+(defun darcsum-call-process (subcommand &rest args)
+  "Calls darcs process and places it's output into current buffer"
+  (darcsum-darcs-2-options-init)
+  (apply 'call-process darcsum-program nil t nil subcommand (append darcsum-darcs-2-options args)))
+
+(defun darcsum-start-process (subcommand args
+                                         &optional name value &rest localize)
+  "Start darcs process."
+    (darcsum-darcs-2-options-init)
     (let*
         ((buf (generate-new-buffer (format " *darcs %s*" subcommand)))
          (process-environment

	    change (cadr file))
      (if (memq (car change) '(newfile newdir))
	  (with-temp-buffer
	    (if (/= 0 (call-process
		       darcsum-program nil t nil "add" path))
		(error "Error running `darcs add' for `%s'" path)
	      (setcar change (cdr (assoc (car change) '((newfile . addfile)
							(newdir . adddir))))))

	  (error "First undo pending changes in file")))
     (t
      (error "Not added file or directory")))
    (unless (= 0 (darcsum-call-process "remove" path))
      (error "Error running `darcs remove'"))
    (darcsum-redo)))

