   ;     '(gdb-variables-font-lock-keywords))
   (run-mode-hooks 'rdebug-variables-mode-hook))
 
-(defun rdebug--setup-variables-buffer (buf name)
+(defun rdebug--setup-variables-buffer (buf comint-buffer)
   (rdebug-debug-enter "rdebug--setup-variables-buffer"
   (with-current-buffer buf
     (rdebug-variables-mode)
-    (set (make-local-variable 'gud-target-name) name))))
-
-(defun rdebug-edit-variables-value (&optional event)
-  "Assign a value to a variable displayed in the variables buffer."
+    (set (make-local-variable 'gud-comint-buffer) comint-buffer))))
+
+(defun rdebug-variables-edit-mouse (&optional event)
+  "Assign a value to a variable displayed in the variables buffer.
+This function is intended to be bound to a mouse key"
   (interactive (list last-input-event))
   (save-excursion
     (if event (posn-set-point (event-end event)))
-    (beginning-of-line)
-    (if (looking-at "^@?[a-zA-Z_0-9]+")
-	(let* ((var (match-string 0))
-	       (value (read-string (format "New value (%s): " var))))
-	  (gud-call (format "p %s=%s" var value)))
-      (message "No variable found"))))
+    (call-interactively 'rdebug-variables-edit)))
+
+(defun rdebug-variables-edit (var value)
+  "Assign a value to a variable displayed in the variables buffer."
+  (interactive
+   (let ((var nil)
+         (value nil))
+     (save-excursion
+       (beginning-of-line)
+       (when (looking-at "^\\(@?[a-zA-Z_0-9]+\\) *= *\\(.*\\)$")
+         (setq var (match-string 1))
+         (setq value (match-string 2))
+         (setq value (read-from-minibuffer
+                      (format "New value (%s): " var) value)))
+       (list var value))))
+  (gud-call (format "p %s=%s" var value)))
+
 
 ;; -- display (a.k.a watch window)
 

;; filter.
(defun gud-rdebug-marker-filter (string)
  (rdebug-debug-enter "gud-rdebug-marker-filter"
    (rdebug-debug-message "GOT: %S\n" string)
    (setq gud-marker-acc (concat gud-marker-acc string))
    (let ((output "") s s2 (tmp ""))
      
      ;; ALB first we process the annotations (if any)
      (while (setq s (string-match rdebug-annotation-start-regexp
				   gud-marker-acc))
	(rdebug-debug-message "ACC: %S\n" gud-marker-acc)
	(let ((name (substring gud-marker-acc (match-beginning 1) (match-end 1)))
	      (end (match-end 0)))
	  (if (setq s2 (string-match rdebug-annotation-end-regexp


(defun rdebug-display-edit (number expr)
  (interactive
   (let ((number nil)
         (expr nil))
     (save-excursion
       (beginning-of-line)
       (when (looking-at "^\\([0-9]+\\): *\\([^=]*[^= ]\\) *=")
         (setq number (match-string 1))
         (setq expr (match-string 2))
         (setq expr (read-from-minibuffer "Ruby expression: " expr)))
       (list number expr))))
  (when expr
    (gud-call (format "undisplay %s" number))
    (gud-call (format "display %s" expr))))
