# HG changeset patch # User Nick Roberts # Date 1142549778 0 # Node ID 64cdad743e23980488b59ed6438666abf260b375 # Parent c32efda6ab271374e52b0017c13db28ebd0d1018 (gud-gdb-complete-command, gud-gdb-run-command-fetch-lines): Adapt for use with watch expressions. (gud-tooltip-mode): Use buffer-local value. diff -r c32efda6ab27 -r 64cdad743e23 lisp/progmodes/gud.el --- a/lisp/progmodes/gud.el Thu Mar 16 22:55:00 2006 +0000 +++ b/lisp/progmodes/gud.el Thu Mar 16 22:56:18 2006 +0000 @@ -740,14 +740,18 @@ (defvar gud-comint-buffer nil) -(defun gud-gdb-complete-command () +(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 available with older versions of GDB." (interactive) - (let* ((end (point)) - (command (buffer-substring (comint-line-beginning-position) end)) - (command-word + (if command + ;; Used by gud-watch in mini-buffer. + (setq command (concat "p " command)) + ;; Used in GUD buffer. + (let ((end (point))) + (setq command (buffer-substring (comint-line-beginning-position) end)))) + (let* ((command-word ;; Find the word break. This match will always succeed. (and (string-match "\\(\\`\\| \\)\\([^ ]*\\)\\'" command) (substring command (match-beginning 2)))) @@ -866,13 +870,14 @@ (defun gud-gdb-run-command-fetch-lines (command buffer &optional skip) "Run COMMAND, and return the list of lines it outputs. -BUFFER is the GUD buffer in which to run the command. +BUFFER is the current buffer which may be the GUD buffer in which to run. SKIP is the number of chars to skip on each lines, it defaults to 0." - (with-current-buffer buffer - (if (save-excursion - (goto-char (point-max)) - (forward-line 0) - (not (looking-at comint-prompt-regexp))) + (with-current-buffer gud-comint-buffer + (if (and (eq gud-comint-buffer buffer) + (save-excursion + (goto-char (point-max)) + (forward-line 0) + (not (looking-at comint-prompt-regexp)))) nil ;; Much of this copied from GDB complete, but I'm grabbing the stack ;; frame instead. @@ -881,12 +886,13 @@ (gud-gdb-fetch-lines-string nil) (gud-gdb-fetch-lines-break (or skip 0)) (gud-marker-filter - `(lambda (string) (gud-gdb-fetch-lines-filter string ',gud-marker-filter)))) + `(lambda (string) + (gud-gdb-fetch-lines-filter string ',gud-marker-filter)))) ;; Issue the command to GDB. (gud-basic-call command) ;; Slurp the output. (while gud-gdb-fetch-lines-in-progress - (accept-process-output (get-buffer-process buffer))) + (accept-process-output (get-buffer-process gud-comint-buffer))) (nreverse gud-gdb-fetched-lines))))) @@ -3270,11 +3276,10 @@ (remove-hook 'tooltip-hook 'gud-tooltip-tips) (define-key global-map [mouse-movement] 'ignore))) (gud-tooltip-activate-mouse-motions-if-enabled) - (if (and - gud-comint-buffer - (buffer-name gud-comint-buffer); gud-comint-buffer might be killed - (with-current-buffer gud-comint-buffer - (memq gud-minor-mode '(gdbmi gdba)))) + (if (and gud-comint-buffer + (buffer-name gud-comint-buffer); gud-comint-buffer might be killed + (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) + '(gdbmi gdba))) (if gud-tooltip-mode (progn (dolist (buffer (buffer-list))