   :keymap ros-run-keymap
   (message "ros-run mode: k to stop, q to quit, r to restart"))
 
+(setq ros-run-mode-hook 'ansi-color-for-comint-mode-on)
+
+
 (defun rosemacs/contains-running-process (name)
   (let ((buf (get-buffer name)))
     (and buf

(defvar rosemacs/nodes-vec (vector) "Vector of nodes")

(defvar roslaunch/history-list nil)

(defvar ros-buffer-package nil "A buffer-local variable for caching the current buffer's ros package.")
(make-variable-buffer-local 'ros-buffer-package)

           (and proc
                (member (process-status proc) '(run stop)))))))

(defun ros-run (pkg exec &optional edit-command)
  (interactive (list (setq ros-run-temp-var (ros-completing-read-package
                                             nil (get-buffer-ros-package)))
                     (funcall ros-completion-function (format "Enter executable (default %s): " ros-run-temp-var)
                              (map 'list #'identity (ros-find-executables ros-run-temp-var))
                              nil nil nil nil ros-run-temp-var)
                     current-prefix-arg))
  (let* ((name (format "*rosrun:%s/%s" pkg exec))
         (buf (get-buffer-create name)))
    (if (rosemacs/contains-running-process buf)
        (warn "Buffer %s already contains running process: not creating new one" name)
      (let* ((default-command (format "rosrun %s %s" pkg exec))
             (rosrun-command
              (split-string
               (if edit-command
                   (read-string "Enter rosrun command: " default-command
                                'rosrun/history-list default-command)
                 default-command)))
             (prefix (subseq rosrun-command 0 3))
             (expected-prefix (list "rosrun" pkg exec)))
        (if (equal prefix expected-prefix)
            (save-excursion
              (set-buffer buf)
              (comint-mode)
              (setq ros-run-pkg pkg
                    ros-run-executable exec
                    ros-run-args (subseq rosrun-command 3))
              (rosrun/restart buf))
          (warn "prefix %s did not equal %s.  Not running."
                prefix expected-prefix))))))

(defun rosrun/restart (buf)
  (if (rosemacs/contains-running-process buf)
