Function: tooltip-show

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

Signature

(tooltip-show TEXT &optional USE-ECHO-AREA)

Documentation

Show a tooltip window displaying TEXT.

Text larger than x-max-tooltip-size is clipped.

If the alist in tooltip-frame-parameters includes left and top parameters, they determine the x and y position where the tooltip is displayed. Otherwise, the tooltip pops at offsets specified by tooltip-x-offset and tooltip-y-offset from the current mouse position.

Optional second arg USE-ECHO-AREA non-nil means to show tooltip in echo area.

Source Code

;; Defined in /usr/src/emacs/lisp/tooltip.el.gz
(defun tooltip-show (text &optional use-echo-area)
  "Show a tooltip window displaying TEXT.

Text larger than `x-max-tooltip-size' is clipped.

If the alist in `tooltip-frame-parameters' includes `left' and `top'
parameters, they determine the x and y position where the tooltip
is displayed.  Otherwise, the tooltip pops at offsets specified by
`tooltip-x-offset' and `tooltip-y-offset' from the current mouse
position.

Optional second arg USE-ECHO-AREA non-nil means to show tooltip
in echo area."
  (if use-echo-area
      (tooltip-show-help-non-mode text)
    (condition-case error
	(let ((params (copy-sequence tooltip-frame-parameters))
	      (fg (face-attribute 'tooltip :foreground))
	      (bg (face-attribute 'tooltip :background)))
	  (when (stringp fg)
	    (setf (alist-get 'foreground-color params) fg)
	    (setf (alist-get 'border-color params) fg))
	  (when (stringp bg)
	    (setf (alist-get 'background-color params) bg))
          ;; Use non-nil APPEND argument below to avoid overriding any
          ;; faces used in our TEXT.  Among other things, this allows
          ;; tooltips to use the `help-key-binding' face used in
          ;; `substitute-command-keys' substitutions.
          (add-face-text-property 0 (length text) 'tooltip t text)
          (x-show-tip text
		      (selected-frame)
		      params
		      tooltip-hide-delay
		      tooltip-x-offset
		      tooltip-y-offset))
      (error
       (message "Error while displaying tooltip: %s" error)
       (sit-for 1)
       (message "%s" text)))))