Function: gud-tooltip-tips

gud-tooltip-tips is a byte-compiled function defined in gud.el.gz.

Signature

(gud-tooltip-tips EVENT)

Documentation

Show tip for identifier or selection under the mouse.

The mouse must either point at an identifier or inside a selected region for the tip window to be shown. If gud-tooltip-dereference(var)/gud-tooltip-dereference(fun) is t, add a * in front of the printed expression. In the case of a C program controlled by GDB, show the associated #define directives when program is not executing.

This function must return nil if it doesn't handle EVENT.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/gud.el.gz
(defun gud-tooltip-tips (event)
  "Show tip for identifier or selection under the mouse.
The mouse must either point at an identifier or inside a selected
region for the tip window to be shown.  If `gud-tooltip-dereference' is t,
add a `*' in front of the printed expression.  In the case of a C program
controlled by GDB, show the associated #define directives when program is
not executing.

This function must return nil if it doesn't handle EVENT."
  (let (process)
    (when (and (eventp event)
	       gud-tooltip-mode
	       gud-comint-buffer
	       (buffer-name gud-comint-buffer); might be killed
	       (setq process (get-buffer-process gud-comint-buffer))
	       (posn-point (event-end event))
	       (or (and (eq gud-minor-mode 'gdbmi) (not gdb-active-process))
		   (progn (setq gud-tooltip-event event)
			  (eval (cons 'and gud-tooltip-display) t))))
      (let ((expr (tooltip-expr-to-print event)))
	(when expr
	  (if (and (eq gud-minor-mode 'gdbmi)
		   (not gdb-active-process))
	      (progn
		(with-current-buffer (tooltip-event-buffer event)
		  (let ((define-elt (assoc expr gdb-define-alist)))
		    (unless (null define-elt)
		      (tooltip-show
		       (cdr define-elt)
		       (or gud-tooltip-echo-area tooltip-use-echo-area
                           (not tooltip-mode)))
		      expr))))
	    (when gud-tooltip-dereference
	      (setq expr (concat "*" expr)))
	    (let ((cmd (gud-tooltip-print-command expr)))
	      (when (and gud-tooltip-mode (eq gud-minor-mode 'gdb))
		(gud-tooltip-mode -1)
		;; The blank before the newline is for MS-Windows,
		;; whose emulation of message box removes newlines and
		;; displays a single long line.
		(message-box "Using GUD tooltips in this mode is unsafe \n\
so they have been disabled."))
	      (unless (null cmd) ; CMD can be nil if unknown debugger
		(if (eq gud-minor-mode 'gdbmi)
                    (if gdb-macro-info
                        (gdb-input
                         (concat
			  "server macro expand " expr "\n")
			 (lambda () (gdb-tooltip-print-1 expr)))
                      (gdb-input
		       (concat cmd "\n")
		       (lambda () (gdb-tooltip-print expr))))
                  (add-function :override (process-filter process)
                                #'gud-tooltip-process-output)
		  (gud-basic-call cmd))
		expr))))))))