diff options
| author | Nick Roberts | 2005-04-27 22:01:14 +0000 |
|---|---|---|
| committer | Nick Roberts | 2005-04-27 22:01:14 +0000 |
| commit | abc7eb900345b1b4b3315f0fbbd70f8d4593e054 (patch) | |
| tree | 718eb0d3c489084c814b7bf885a0d382250a23a3 | |
| parent | 9cc4d7dd649b05d5e07241dbe0b7cfcb5b51c5af (diff) | |
| download | emacs-abc7eb900345b1b4b3315f0fbbd70f8d4593e054.tar.gz emacs-abc7eb900345b1b4b3315f0fbbd70f8d4593e054.zip | |
(tooltip-gud-tips): Show the associated #define
directives when a C program under GDB is not executing.
| -rw-r--r-- | lisp/tooltip.el | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/lisp/tooltip.el b/lisp/tooltip.el index 840aa3c2006..69f35a9997f 100644 --- a/lisp/tooltip.el +++ b/lisp/tooltip.el | |||
| @@ -453,29 +453,46 @@ If TOOLTIP-GUD-DEREFERENCE is t, also prepend a `*' to EXPR." | |||
| 453 | "Show tip for identifier or selection under the mouse. | 453 | "Show tip for identifier or selection under the mouse. |
| 454 | The mouse must either point at an identifier or inside a selected | 454 | The mouse must either point at an identifier or inside a selected |
| 455 | region for the tip window to be shown. If tooltip-gud-dereference is t, | 455 | region for the tip window to be shown. If tooltip-gud-dereference is t, |
| 456 | add a `*' in front of the printed expression. | 456 | add a `*' in front of the printed expression. In the case of a C program |
| 457 | controlled by GDB, show the associated #define directives when program is | ||
| 458 | not executing. | ||
| 457 | 459 | ||
| 458 | This function must return nil if it doesn't handle EVENT." | 460 | This function must return nil if it doesn't handle EVENT." |
| 459 | (let (process) | 461 | (let (process) |
| 460 | (when (and (eventp event) | 462 | (when (and (eventp event) |
| 461 | tooltip-gud-tips-p | 463 | tooltip-gud-tips-p |
| 462 | (boundp 'gud-comint-buffer) | 464 | (boundp 'gud-comint-buffer) |
| 465 | gud-comint-buffer | ||
| 466 | (buffer-name gud-comint-buffer); gud-comint-buffer might be killed | ||
| 463 | (setq process (get-buffer-process gud-comint-buffer)) | 467 | (setq process (get-buffer-process gud-comint-buffer)) |
| 464 | (posn-point (event-end event)) | 468 | (posn-point (event-end event)) |
| 465 | (progn (setq tooltip-gud-event event) | 469 | (or (eq gud-minor-mode 'gdba) |
| 466 | (eval (cons 'and tooltip-gud-display)))) | 470 | (progn (setq tooltip-gud-event event) |
| 471 | (eval (cons 'and tooltip-gud-display))))) | ||
| 467 | (let ((expr (tooltip-expr-to-print event))) | 472 | (let ((expr (tooltip-expr-to-print event))) |
| 468 | (when expr | 473 | (when expr |
| 469 | (let ((cmd (tooltip-gud-print-command expr))) | 474 | (if (and (eq gud-minor-mode 'gdba) |
| 470 | (unless (null cmd) ; CMD can be nil if unknown debugger | 475 | (not gdb-active-process)) |
| 471 | (case gud-minor-mode | 476 | (progn |
| 472 | (gdba (gdb-enqueue-input | 477 | (with-current-buffer |
| 473 | (list (concat cmd "\n") 'gdb-tooltip-print))) | 478 | (window-buffer (let ((mouse (mouse-position))) |
| 474 | (t | 479 | (window-at (cadr mouse) |
| 475 | (setq tooltip-gud-original-filter (process-filter process)) | 480 | (cddr mouse)))) |
| 476 | (set-process-filter process 'tooltip-gud-process-output) | 481 | (when (boundp 'cc-define-alist) ; might be a Fortran program |
| 477 | (gud-basic-call cmd))) | 482 | (let ((define-elt (assoc expr cc-define-alist))) |
| 478 | expr))))))) | 483 | (unless (null define-elt) |
| 484 | (tooltip-show (cdr define-elt)) | ||
| 485 | expr))))) | ||
| 486 | (let ((cmd (tooltip-gud-print-command expr))) | ||
| 487 | (unless (null cmd) ; CMD can be nil if unknown debugger | ||
| 488 | (case gud-minor-mode | ||
| 489 | (gdba (gdb-enqueue-input | ||
| 490 | (list (concat cmd "\n") 'gdb-tooltip-print))) | ||
| 491 | (t | ||
| 492 | (setq tooltip-gud-original-filter (process-filter process)) | ||
| 493 | (set-process-filter process 'tooltip-gud-process-output) | ||
| 494 | (gud-basic-call cmd))) | ||
| 495 | expr)))))))) | ||
| 479 | 496 | ||
| 480 | (defun gdb-tooltip-print () | 497 | (defun gdb-tooltip-print () |
| 481 | (tooltip-show | 498 | (tooltip-show |