   ;     '(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)
 

    ;; buffer process (nil). When the debugger processes is replaced
    ;; with another process we should not restore the window
    ;; configuration.
    (when (and rdebug-restore-original-window-configuration
               (or (null (get-buffer-process gud-comint-buffer))
                   (eq process (get-buffer-process gud-comint-buffer)))
               (eq rdebug-window-configuration-state 'debugger)
               (not (eq (process-status process) 'run)))
      (setq rdebug-window-configuration-state 'original)
      (rdebug-display-original-window-configuration))))

;; Fontification and keymaps for secondary buffers (breakpoints, stack)

  (use-local-map rdebug-display-mode-map)
  (run-mode-hooks 'rdebug-display-mode-hook))

(defun rdebug--setup-display-buffer (buf comint-buffer)
  (rdebug-debug-enter "rdebug--setup-display-buffer"
    (with-current-buffer buf
      (rdebug-display-mode)
      (set (make-local-variable 'gud-comint-buffer) comint-buffer))))

(defun rdebug-display-add (expr)
  (interactive "sRuby expression: ")
