     (call-process olm-ruby-executable nil buf nil
                   "-r" "rubygems" "-r" "olm" "-e" command)))
 
+(defun olm-do-command-buf (command)
+  (call-process-region (point-min) (point-max)
+                       olm-ruby-executable
+                       nil (get-buffer-create "*Messages*") nil
+                       "-r" "rubygems" "-r" "olm" "-e" command))
+
 (defun olm-sync ()
   (interactive)
   (with-current-buffer (get-buffer-create "*olm-sync*")

  (message msg)
  (save-restriction
    (widen)
    (olm-draft-do-command cmd)))

(defun olm-draft-reply-all-save-message ()
  (interactive)

  (kill-buffer)
  (olm-scan))

(defun olm-draft-save-message ()
  (interactive)
  (message "Olm: saving message ...")
  (olm-do-command-buf "Olm.save_message")
  (olm-draft-kill))

(defun olm-draft-send-message ()
  (interactive)
  (message "Olm: sending message ...")
  (olm-do-command-buf "Olm.send_message")
  (olm-draft-kill))


