Mercurial > emacs
comparison lisp/tooltip.el @ 61608:6a8ebeaf5f56
(tooltip-gud-echo-area): Rename from
tooltip-use-echo-area.
(tooltip-show, tooltip-gud-process-output, gdb-tooltip-print)
(tooltip-help-tips): Allow GUD tooltips to be displayed in echo
area independently of where help tooltips are displayed.
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Mon, 18 Apr 2005 00:29:45 +0000 |
parents | 19480ce3528d |
children | 5739226d2d8c |
comparison
equal
deleted
inserted
replaced
61607:22de918e7a8c | 61608:6a8ebeaf5f56 |
---|---|
137 only tooltips in the buffer containing the overlay arrow." | 137 only tooltips in the buffer containing the overlay arrow." |
138 :type 'sexp | 138 :type 'sexp |
139 :tag "GUD buffers predicate" | 139 :tag "GUD buffers predicate" |
140 :group 'tooltip) | 140 :group 'tooltip) |
141 | 141 |
142 (defcustom tooltip-use-echo-area nil | 142 (defcustom tooltip-gud-echo-area nil |
143 "Use the echo area instead of tooltip frames. | 143 "Use the echo area instead of frames for GUD tooltips." |
144 This is only relevant GUD display, since otherwise it is equivalent to | |
145 turning off Tooltip mode." | |
146 :type 'boolean | 144 :type 'boolean |
147 :tag "Use echo area" | 145 :tag "Use echo area" |
148 :group 'tooltip) | 146 :group 'tooltip) |
149 | 147 |
150 | 148 |
289 (if (consp param) | 287 (if (consp param) |
290 (setcdr param value) | 288 (setcdr param value) |
291 (push (cons key value) alist)) | 289 (push (cons key value) alist)) |
292 alist)) | 290 alist)) |
293 | 291 |
294 (defun tooltip-show (text) | 292 (defun tooltip-show (text gud-tip) |
295 "Show a tooltip window displaying TEXT. | 293 "Show a tooltip window displaying TEXT. |
296 | 294 |
297 Text larger than `x-max-tooltip-size' (which see) is clipped. | 295 Text larger than `x-max-tooltip-size' is clipped. |
298 | 296 |
299 If the alist in `tooltip-frame-parameters' includes `left' and `top' | 297 If the alist in `tooltip-frame-parameters' includes `left' and `top' |
300 parameters, they determine the x and y position where the tooltip | 298 parameters, they determine the x and y position where the tooltip |
301 is displayed. Otherwise, the tooltip pops at offsets specified by | 299 is displayed. Otherwise, the tooltip pops at offsets specified by |
302 `tooltip-x-offset' and `tooltip-y-offset' from the current mouse | 300 `tooltip-x-offset' and `tooltip-y-offset' from the current mouse |
303 position." | 301 position. |
304 (if tooltip-use-echo-area | 302 |
303 GUD-TIP is t if the tooltip is from a GUD session and nil otherwise." | |
304 (if (and gud-tip tooltip-gud-echo-area) | |
305 (message "%s" text) | 305 (message "%s" text) |
306 (condition-case error | 306 (condition-case error |
307 (let ((params (copy-sequence tooltip-frame-parameters)) | 307 (let ((params (copy-sequence tooltip-frame-parameters)) |
308 (fg (face-attribute 'tooltip :foreground)) | 308 (fg (face-attribute 'tooltip :foreground)) |
309 (bg (face-attribute 'tooltip :background))) | 309 (bg (face-attribute 'tooltip :background))) |
415 ; it may be difficult to do better. gdba in gdb-ui.el | 415 ; it may be difficult to do better. gdba in gdb-ui.el |
416 ; gets round this problem. | 416 ; gets round this problem. |
417 (defun tooltip-gud-process-output (process output) | 417 (defun tooltip-gud-process-output (process output) |
418 "Process debugger output and show it in a tooltip window." | 418 "Process debugger output and show it in a tooltip window." |
419 (set-process-filter process tooltip-gud-original-filter) | 419 (set-process-filter process tooltip-gud-original-filter) |
420 (tooltip-show (tooltip-strip-prompt process output))) | 420 (tooltip-show (tooltip-strip-prompt process output) t)) |
421 | 421 |
422 (defun tooltip-gud-print-command (expr) | 422 (defun tooltip-gud-print-command (expr) |
423 "Return a suitable command to print the expression EXPR. | 423 "Return a suitable command to print the expression EXPR. |
424 If TOOLTIP-GUD-DEREFERENCE is t, also prepend a `*' to EXPR." | 424 If TOOLTIP-GUD-DEREFERENCE is t, also prepend a `*' to EXPR." |
425 (when tooltip-gud-dereference | 425 (when tooltip-gud-dereference |
461 | 461 |
462 (defun gdb-tooltip-print () | 462 (defun gdb-tooltip-print () |
463 (tooltip-show | 463 (tooltip-show |
464 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) | 464 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) |
465 (let ((string (buffer-string))) | 465 (let ((string (buffer-string))) |
466 ;; remove newline for tooltip-use-echo-area | 466 ;; remove newline for tooltip-gud-echo-area |
467 (substring string 0 (- (length string) 1)))))) | 467 (substring string 0 (- (length string) 1)))) t)) |
468 | 468 |
469 | 469 |
470 ;;; Tooltip help. | 470 ;;; Tooltip help. |
471 | 471 |
472 (defvar tooltip-help-message nil | 472 (defvar tooltip-help-message nil |
495 "Hook function to display a help tooltip. | 495 "Hook function to display a help tooltip. |
496 This is installed on the hook `tooltip-hook', which is run when | 496 This is installed on the hook `tooltip-hook', which is run when |
497 the timer with ID `tooltip-timeout-id' fires. | 497 the timer with ID `tooltip-timeout-id' fires. |
498 Value is non-nil if this function handled the tip." | 498 Value is non-nil if this function handled the tip." |
499 (when (stringp tooltip-help-message) | 499 (when (stringp tooltip-help-message) |
500 (tooltip-show tooltip-help-message) | 500 (tooltip-show tooltip-help-message nil) |
501 t)) | 501 t)) |
502 | 502 |
503 (provide 'tooltip) | 503 (provide 'tooltip) |
504 | 504 |
505 ;; arch-tag: 3d61135e-4618-4a78-af28-183f6df5636f | 505 ;; arch-tag: 3d61135e-4618-4a78-af28-183f6df5636f |