From: Nick Roberts Date: Thu, 17 Aug 2006 11:44:40 +0000 (+0000) Subject: (gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first. X-Git-Tag: emacs-pretest-22.0.90~969 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=38a52690e0d5d9f1ba1bbf9af21da50a1ce0a7c3;p=emacs.git (gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first. (gdb-edit-locals-map-1): New variable. (gdb-edit-locals-value): New function. (gdb-stack-list-locals-handler): Use them. --- diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index b5334ba5bc5..61078877c31 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -384,8 +384,7 @@ With arg, use separate IO iff arg is positive." (list t nil) nil "-c" (concat gdb-cpp-define-alist-program " " gdb-cpp-define-alist-flags))))) - (define-list (split-string output "\n" t)) - (name)) + (define-list (split-string output "\n" t)) (name)) (setq gdb-define-alist nil) (dolist (define define-list) (setq name (nth 1 (split-string define "[( ]"))) @@ -2657,6 +2656,7 @@ corresponding to the mode line clicked." (defvar gdb-locals-watch-map (let ((map (make-sparse-keymap))) + (suppress-keymap map) (define-key map "\r" (lambda () (interactive) (beginning-of-line) (gud-watch))) @@ -3512,10 +3512,32 @@ in_scope=\"\\(.*?\\)\".*?}") (defvar gdb-locals-watch-map-1 (let ((map (make-sparse-keymap))) + (suppress-keymap map) + (define-key map "\r" 'gud-watch) (define-key map [mouse-2] 'gud-watch) map) "Keymap to create watch expression of a complex data type local variable.") +(defvar gdb-edit-locals-map-1 + (let ((map (make-sparse-keymap))) + (suppress-keymap map) + (define-key map "\r" 'gdb-edit-locals-value) + (define-key map [mouse-2] 'gdb-edit-locals-value) + map) + "Keymap to edit value of a simple data type local variable.") + +(defun gdb-edit-locals-value (&optional event) + "Assign a value to a variable displayed in the locals buffer." + (interactive (list last-input-event)) + (save-excursion + (if event (posn-set-point (event-end event))) + (beginning-of-line) + (let* ((var (current-word)) + (value (read-string (format "New value (%s): " var)))) + (gdb-enqueue-input + (list (concat gdb-server-prefix"set variable " var " = " value "\n") + 'ignore)))))) + ;; Dont display values of arrays or structures. ;; These can be expanded using gud-watch. (defun gdb-stack-list-locals-handler () @@ -3543,17 +3565,23 @@ in_scope=\"\\(.*?\\)\".*?}") (let* ((window (get-buffer-window buf 0)) (start (window-start window)) (p (window-point window)) - (buffer-read-only nil)) + (buffer-read-only nil) (name) (value)) (erase-buffer) (dolist (local locals-list) (setq name (car local)) - (if (or (not (nth 2 local)) - (string-match "^\\0x" (nth 2 local))) + (setq value (nth 2 local)) + (if (or (not value) + (string-match "^\\0x" value)) (add-text-properties 0 (length name) `(mouse-face highlight help-echo "mouse-2: create watch expression" local-map ,gdb-locals-watch-map-1) - name)) + name) + (add-text-properties 0 (length value) + `(mouse-face highlight + help-echo "mouse-2: edit value" + local-map ,gdb-edit-locals-map-1) + value)) (insert (concat name "\t" (nth 1 local) "\t" (nth 2 local) "\n")))