aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGerd Moellmann2001-01-04 14:07:37 +0000
committerGerd Moellmann2001-01-04 14:07:37 +0000
commit2621f5a96f7a359fc4a9ab827138fe4fc1d6f189 (patch)
treec08d0c55ac5e6ff8a63e5fc8cfb92778ee2baf95 /lisp
parent035d5114ffdb959de67adb63add1af1b9520a268 (diff)
downloademacs-2621f5a96f7a359fc4a9ab827138fe4fc1d6f189.tar.gz
emacs-2621f5a96f7a359fc4a9ab827138fe4fc1d6f189.zip
(tooltip-frame-parameters): Remove colors.
(tooltip): New face (tooltip-set-param): New function. (tooltip-show): Set up color frame parameters from face `tooltip'. Display the tooltip text in face `tooltip'.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/tooltip.el42
1 files changed, 33 insertions, 9 deletions
diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index e02eec71884..408943f0048 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -100,10 +100,7 @@ when it pops up."
100 100
101(defcustom tooltip-frame-parameters 101(defcustom tooltip-frame-parameters
102 '((name . "tooltip") 102 '((name . "tooltip")
103 (foreground-color . "black")
104 (background-color . "lightyellow")
105 (internal-border-width . 5) 103 (internal-border-width . 5)
106 (border-color . "lightyellow")
107 (border-width . 1)) 104 (border-width . 1))
108 "Frame parameters used for tooltips." 105 "Frame parameters used for tooltips."
109 :type 'sexp 106 :type 'sexp
@@ -111,6 +108,14 @@ when it pops up."
111 :group 'tooltip) 108 :group 'tooltip)
112 109
113 110
111(defface tooltip
112 '((((class color))
113 (:background "lightyellow" :foreground "black"))
114 (t ()))
115 "Face for tooltips."
116 :group 'tooltip)
117
118
114(defcustom tooltip-gud-tips-p nil 119(defcustom tooltip-gud-tips-p nil
115 "*Non-nil means show tooltips in GUD sessions." 120 "*Non-nil means show tooltips in GUD sessions."
116 :type 'boolean 121 :type 'boolean
@@ -306,17 +311,36 @@ ACTIVATEP non-nil means activate mouse motion events."
306 311
307;;; Displaying tips 312;;; Displaying tips
308 313
314(defun tooltip-set-param (alist key value)
315 "Change the value of KEY in alist ALIAS to VALUE.
316If there's no association for KEY in ALIST, add one, otherwise
317change the existing association. Value is the resulting alist."
318 (let ((param (assq key alist)))
319 (if (consp param)
320 (setcdr param value)
321 (push (cons key value) alist))
322 alist))
323
324
309(defun tooltip-show (text) 325(defun tooltip-show (text)
310 "Show a tooltip window at the current mouse position displaying TEXT." 326 "Show a tooltip window at the current mouse position displaying TEXT."
311 (if tooltip-use-echo-area 327 (if tooltip-use-echo-area
312 (message "%s" text) 328 (message "%s" text)
313 (condition-case error 329 (condition-case error
314 (x-show-tip text 330 (let ((params (copy-sequence tooltip-frame-parameters))
315 (selected-frame) 331 (fg (face-attribute 'tooltip :foreground))
316 tooltip-frame-parameters 332 (bg (face-attribute 'tooltip :background)))
317 nil 333 (unless (eq 'unspecified fg)
318 tooltip-x-offset 334 (tooltip-set-param params 'foreground-color fg))
319 tooltip-y-offset) 335 (unless (eq 'unspecified bg)
336 (tooltip-set-param params 'background-color bg)
337 (tooltip-set-param params 'border-color bg))
338 (x-show-tip (propertize text 'face 'tooltip)
339 (selected-frame)
340 tooltip-frame-parameters
341 nil
342 tooltip-x-offset
343 tooltip-y-offset))
320 (error 344 (error
321 (message "Error while displaying tooltip: %s" error) 345 (message "Error while displaying tooltip: %s" error)
322 (sit-for 1) 346 (sit-for 1)