# HG changeset patch # User Nick Roberts # Date 1146092636 0 # Node ID 4fc61ee2deb24c99b6ba79ca8eedf005acdba5b5 # Parent 039ae41bde1ad6f0c3737e6d09cecac1d45f3a2a (gud-comint-buffer): Move forward to stop byte compiler warnings. (gud-basic-call, gud-find-expr): Let user select an expression for printing. Print expression as well as value in GUD buffer. diff -r 039ae41bde1a -r 4fc61ee2deb2 lisp/progmodes/gud.el --- a/lisp/progmodes/gud.el Wed Apr 26 23:02:33 2006 +0000 +++ b/lisp/progmodes/gud.el Wed Apr 26 23:03:56 2006 +0000 @@ -83,6 +83,8 @@ (defvar gud-minor-mode nil) (put 'gud-minor-mode 'permanent-local t) +(defvar gud-comint-buffer nil) + (defvar gud-keep-buffer nil) (defun gud-symbol (sym &optional soft minor-mode) @@ -740,8 +742,6 @@ ;; The completion list is constructed by the process filter. (defvar gud-gdb-fetched-lines) -(defvar gud-comint-buffer nil) - (defun gud-gdb-complete-command (&optional command a b) "Perform completion on the GDB command preceding point. This is implemented using the GDB `complete' command which isn't @@ -2889,8 +2889,11 @@ (set-buffer gud-comint-buffer) (save-restriction (widen) - (goto-char (process-mark proc)) - (forward-line 0) + (if (marker-position gud-delete-prompt-marker) + ;; We get here when printing an expression. + (goto-char gud-delete-prompt-marker) + (goto-char (process-mark proc)) + (forward-line 0)) (if (looking-at comint-prompt-regexp) (set-marker gud-delete-prompt-marker (point))) (if (memq gud-minor-mode '(gdbmi gdba)) @@ -2911,7 +2914,21 @@ (defvar gud-find-expr-function 'gud-find-c-expr) (defun gud-find-expr (&rest args) - (apply gud-find-expr-function args)) + (let ((expr (if (and transient-mark-mode mark-active) + (buffer-substring (region-beginning) (region-end)) + (apply gud-find-expr-function args)))) + (save-match-data + (if (string-match "\n" expr) + (error "Expression must not include a newline")) + (with-current-buffer gud-comint-buffer + (save-excursion + (goto-char (process-mark (get-buffer-process gud-comint-buffer))) + (forward-line 0) + (when (looking-at comint-prompt-regexp) + (set-marker gud-delete-prompt-marker (point)) + (set-marker-insertion-type gud-delete-prompt-marker t)) + (insert (concat expr " = "))))) + expr)) ;; The next eight functions are hacked from gdbsrc.el by ;; Debby Ayers ,