Mercurial > emacs
annotate lisp/tooltip.el @ 46770:06873cff56e8
(ibuffer-fontification-alist): Use `font-lock-constant-face' instead
of `font-lock-reference-face'.
author | Colin Walters <walters@gnu.org> |
---|---|
date | Thu, 01 Aug 2002 01:20:59 +0000 |
parents | ce0d438fe05e |
children | 2941d71711f3 |
rev | line source |
---|---|
45236 | 1 ;;; tooltip.el --- show tooltip windows |
25003 | 2 |
35069
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
3 ;; Copyright (C) 1997, 1999, 2000, 2001 Free Software Foundation, Inc. |
25003 | 4 |
5 ;; Author: Gerd Moellmann <gerd@acm.org> | |
6 ;; Keywords: help c mouse tools | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
24 | |
25 ;;; Commentary: | |
26 | |
27 ;;; Code: | |
28 | |
29 (eval-when-compile | |
30 (require 'cl) | |
31 (require 'comint) | |
32 (require 'gud)) | |
33 | |
34 (provide 'tooltip) | |
35 | |
36 | |
37 ;;; Customizable settings | |
38 | |
39 (defgroup tooltip nil | |
40 "Customization group for the `tooltip' package." | |
41 :group 'help | |
37755
cf803b8f08ad
(tooltip) <defgroup>: Put it in `gud' group instead
Gerd Moellmann <gerd@gnu.org>
parents:
35401
diff
changeset
|
42 :group 'gud |
25003 | 43 :group 'mouse |
44 :group 'tools | |
25332
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
45 :version "21.1" |
25003 | 46 :tag "Tool Tips") |
47 | |
25332
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
48 (defvar tooltip-mode) |
25003 | 49 |
40679
3c4df1ce9e4c
(tooltip-delay): Decrease to 0.7.
Eli Zaretskii <eliz@gnu.org>
parents:
40376
diff
changeset
|
50 (defcustom tooltip-delay 0.7 |
25003 | 51 "Seconds to wait before displaying a tooltip the first time." |
52 :tag "Delay" | |
53 :type 'number | |
54 :group 'tooltip) | |
55 | |
56 | |
57 (defcustom tooltip-short-delay 0.1 | |
58 "Seconds to wait between subsequent tooltips on different items." | |
59 :tag "Short delay" | |
60 :type 'number | |
61 :group 'tooltip) | |
62 | |
63 | |
64 (defcustom tooltip-recent-seconds 1 | |
25332
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
65 "Display tooltips if changing tip items within this many seconds. |
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
66 Do so after `tooltip-short-delay'." |
25003 | 67 :tag "Recent seconds" |
68 :type 'number | |
69 :group 'tooltip) | |
70 | |
71 | |
40679
3c4df1ce9e4c
(tooltip-delay): Decrease to 0.7.
Eli Zaretskii <eliz@gnu.org>
parents:
40376
diff
changeset
|
72 (defcustom tooltip-hide-delay 10 |
35401
c00e94a506a2
(tooltip-hide-delay): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
35069
diff
changeset
|
73 "Hide tooltips automatically after this many seconds." |
c00e94a506a2
(tooltip-hide-delay): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
35069
diff
changeset
|
74 :tag "Hide delay" |
c00e94a506a2
(tooltip-hide-delay): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
35069
diff
changeset
|
75 :type 'number |
c00e94a506a2
(tooltip-hide-delay): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
35069
diff
changeset
|
76 :group 'tooltip) |
c00e94a506a2
(tooltip-hide-delay): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
35069
diff
changeset
|
77 |
c00e94a506a2
(tooltip-hide-delay): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
35069
diff
changeset
|
78 |
33587
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
79 (defcustom tooltip-x-offset nil |
46025
ce0d438fe05e
(tooltip-x-offset, tooltip-y-offset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
45571
diff
changeset
|
80 "X offset, in pixels, for the display of tooltips. |
33587
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
81 The offset is relative to the position of the mouse. It must |
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
82 be chosen so that the tooltip window doesn't contain the mouse |
40173
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
83 when it pops up. If the value is nil, the default offset is 5 |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
84 pixels. |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
85 |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
86 If `tooltip-frame-parameters' includes the `left' parameter, |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
87 the value of `tooltip-x-offset' is ignored." |
33587
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
88 :tag "X offset" |
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
89 :type '(choice (const :tag "Default" nil) |
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
90 (integer :tag "Offset" :value 1)) |
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
91 :group 'tooltip) |
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
92 |
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
93 |
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
94 (defcustom tooltip-y-offset nil |
46025
ce0d438fe05e
(tooltip-x-offset, tooltip-y-offset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
45571
diff
changeset
|
95 "Y offset, in pixels, for the display of tooltips. |
33587
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
96 The offset is relative to the position of the mouse. It must |
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
97 be chosen so that the tooltip window doesn't contain the mouse |
40173
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
98 when it pops up. If the value is nil, the default offset is -10 |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
99 pixels. |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
100 |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
101 If `tooltip-frame-parameters' includes the `top' parameter, |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
102 the value of `tooltip-y-offset' is ignored." |
33587
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
103 :tag "Y offset" |
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
104 :type '(choice (const :tag "Default" nil) |
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
105 (integer :tag "Offset" :value 1)) |
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
106 :group 'tooltip) |
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
107 |
7d4c3fcd3421
(tooltip-x-offset, tooltip-y-offset): New user-options.
Gerd Moellmann <gerd@gnu.org>
parents:
33356
diff
changeset
|
108 |
25003 | 109 (defcustom tooltip-frame-parameters |
110 '((name . "tooltip") | |
111 (internal-border-width . 5) | |
112 (border-width . 1)) | |
40173
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
113 "Frame parameters used for tooltips. |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
114 |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
115 If `left' or `top' parameters are included, they specify the absolute |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
116 position to pop up the tooltip." |
25003 | 117 :type 'sexp |
118 :tag "Frame Parameters" | |
119 :group 'tooltip) | |
120 | |
121 | |
35043
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
122 (defface tooltip |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
123 '((((class color)) |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
124 (:background "lightyellow" :foreground "black")) |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
125 (t ())) |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
126 "Face for tooltips." |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
127 :group 'tooltip) |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
128 |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
129 |
25003 | 130 (defcustom tooltip-gud-tips-p nil |
27582
42b52d8b6703
(tooltip-gud-tips-p, tooltip-gud-toggle-dereference):
Dave Love <fx@gnu.org>
parents:
25332
diff
changeset
|
131 "*Non-nil means show tooltips in GUD sessions." |
25003 | 132 :type 'boolean |
133 :tag "GUD" | |
33140
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
134 :set #'(lambda (symbol on) |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
135 (setq tooltip-gud-tips-p on) |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
136 (if on (tooltip-gud-tips-setup))) |
25003 | 137 :group 'tooltip) |
138 | |
139 | |
140 (defcustom tooltip-gud-modes '(gud-mode c-mode c++-mode) | |
141 "List of modes for which to enable GUD tips." | |
142 :type 'sexp | |
143 :tag "GUD modes" | |
144 :group 'tooltip) | |
145 | |
30481 | 146 |
25003 | 147 (defcustom tooltip-gud-display |
148 '((eq (tooltip-event-buffer tooltip-gud-event) | |
149 (marker-buffer overlay-arrow-position))) | |
150 "List of forms determining where GUD tooltips are displayed. | |
151 | |
152 Forms in the list are combined with AND. The default is to display | |
153 only tooltips in the buffer containing the overlay arrow." | |
154 :type 'sexp | |
155 :tag "GUD buffers predicate" | |
156 :group 'tooltip) | |
157 | |
158 | |
32431
a35cc9700ff7
* tooltip.el (tooltip-use-echo-area): New user variable.
Sam Steingold <sds@gnu.org>
parents:
30481
diff
changeset
|
159 (defcustom tooltip-use-echo-area nil |
33923 | 160 "Use the echo area instead of tooltip frames. |
161 This is only relevant GUD display, since otherwise it is equivalent to | |
162 turning off Tooltip mode." | |
32431
a35cc9700ff7
* tooltip.el (tooltip-use-echo-area): New user variable.
Sam Steingold <sds@gnu.org>
parents:
30481
diff
changeset
|
163 :type 'boolean |
33925 | 164 :tag "Use echo area" |
32431
a35cc9700ff7
* tooltip.el (tooltip-use-echo-area): New user variable.
Sam Steingold <sds@gnu.org>
parents:
30481
diff
changeset
|
165 :group 'tooltip) |
a35cc9700ff7
* tooltip.el (tooltip-use-echo-area): New user variable.
Sam Steingold <sds@gnu.org>
parents:
30481
diff
changeset
|
166 |
25003 | 167 |
168 ;;; Variables that are not customizable. | |
169 | |
170 (defvar tooltip-hook nil | |
171 "Functions to call to display tooltips. | |
172 Each function is called with one argument EVENT which is a copy of | |
173 the last mouse movement event that occurred.") | |
174 | |
175 | |
176 (defvar tooltip-timeout-id nil | |
177 "The id of the timeout started when Emacs becomes idle.") | |
178 | |
179 | |
180 (defvar tooltip-last-mouse-motion-event nil | |
181 "A copy of the last mouse motion event seen.") | |
182 | |
183 | |
184 (defvar tooltip-hide-time nil | |
185 "Time when the last tooltip was hidden.") | |
186 | |
187 | |
188 (defvar tooltip-gud-debugger nil | |
189 "The debugger for which we show tooltips.") | |
190 | |
191 | |
192 | |
193 ;;; Event accessors | |
194 | |
195 (defun tooltip-event-buffer (event) | |
196 "Return the buffer over which event EVENT occurred. | |
197 This might return nil if the event did not occur over a buffer." | |
198 (let ((window (posn-window (event-end event)))) | |
199 (and window (window-buffer window)))) | |
200 | |
201 | |
202 | |
203 ;;; Switching tooltips on/off | |
204 | |
205 ;; We don't set track-mouse globally because this is a big redisplay | |
206 ;; problem in buffers having a pre-command-hook or such installed, | |
207 ;; which does a set-buffer, like the summary buffer of Gnus. Calling | |
208 ;; set-buffer prevents redisplay optimizations, so every mouse motion | |
209 ;; would be accompanied by a full redisplay. | |
210 | |
211 ;;;###autoload | |
212 (defun tooltip-mode (&optional arg) | |
213 "Mode for tooltip display. | |
214 With ARG, turn tooltip mode on if and only if ARG is positive." | |
215 (interactive "P") | |
34689
e045e0e60223
(tooltip-mode): Signal an error if x-show-tip
Gerd Moellmann <gerd@gnu.org>
parents:
34540
diff
changeset
|
216 (unless (fboundp 'x-show-tip) |
e045e0e60223
(tooltip-mode): Signal an error if x-show-tip
Gerd Moellmann <gerd@gnu.org>
parents:
34540
diff
changeset
|
217 (error "Sorry, tooltips are not yet available on this system")) |
25003 | 218 (let* ((on (if arg |
219 (> (prefix-numeric-value arg) 0) | |
220 (not tooltip-mode))) | |
221 (hook-fn (if on 'add-hook 'remove-hook))) | |
222 (setq tooltip-mode on) | |
223 (funcall hook-fn 'change-major-mode-hook 'tooltip-change-major-mode) | |
224 (tooltip-activate-mouse-motions-if-enabled) | |
225 (funcall hook-fn 'pre-command-hook 'tooltip-hide) | |
226 (funcall hook-fn 'tooltip-hook 'tooltip-gud-tips) | |
227 (funcall hook-fn 'tooltip-hook 'tooltip-help-tips) | |
228 (setq show-help-function (if on 'tooltip-show-help-function nil)) | |
229 ;; `ignore' is the default binding for mouse movements. | |
230 (define-key global-map [mouse-movement] | |
231 (if on 'tooltip-mouse-motion 'ignore)) | |
33140
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
232 (tooltip-gud-tips-setup))) |
25003 | 233 |
33140
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
234 (defun tooltip-gud-tips-setup () |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
235 "Setup debugger mode-hooks for tooltips." |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
236 (when (and tooltip-mode tooltip-gud-tips-p) |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
237 (global-set-key [S-mouse-3] 'tooltip-gud-toggle-dereference) |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
238 (add-hook 'gdb-mode-hook |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
239 #'(lambda () (setq tooltip-gud-debugger 'gdb))) |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
240 (add-hook 'sdb-mode-hook |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
241 #'(lambda () (setq tooltip-gud-debugger 'sdb))) |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
242 (add-hook 'dbx-mode-hook |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
243 #'(lambda () (setq tooltip-gud-debugger 'dbx))) |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
244 (add-hook 'xdb-mode-hook |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
245 #'(lambda () (setq tooltip-gud-debugger 'xdb))) |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
246 (add-hook 'perldb-mode-hook |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
247 #'(lambda () (setq tooltip-gud-debugger 'perldb))))) |
25003 | 248 |
249 ;;; Timeout for tooltip display | |
250 | |
251 (defun tooltip-delay () | |
252 "Return the delay in seconds for the next tooltip." | |
253 (let ((delay tooltip-delay) | |
30481 | 254 (now (float-time))) |
25003 | 255 (when (and tooltip-hide-time |
256 (< (- now tooltip-hide-time) tooltip-recent-seconds)) | |
257 (setq delay tooltip-short-delay)) | |
258 delay)) | |
259 | |
260 | |
35069
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
261 (defun tooltip-cancel-delayed-tip () |
25003 | 262 "Disable the tooltip timeout." |
263 (when tooltip-timeout-id | |
264 (disable-timeout tooltip-timeout-id) | |
265 (setq tooltip-timeout-id nil))) | |
266 | |
267 | |
35069
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
268 (defun tooltip-start-delayed-tip () |
25003 | 269 "Add a one-shot timeout to call function tooltip-timeout." |
270 (setq tooltip-timeout-id | |
271 (add-timeout (tooltip-delay) 'tooltip-timeout nil))) | |
272 | |
273 | |
274 (defun tooltip-timeout (object) | |
275 "Function called when timer with id tooltip-timeout-id fires." | |
276 (run-hook-with-args-until-success 'tooltip-hook | |
277 tooltip-last-mouse-motion-event)) | |
278 | |
279 | |
280 | |
281 ;;; Reacting on mouse movements | |
282 | |
283 (defun tooltip-change-major-mode () | |
284 "Function added to `change-major-mode-hook' when tooltip mode is on." | |
285 (add-hook 'post-command-hook 'tooltip-activate-mouse-motions-if-enabled)) | |
286 | |
287 | |
288 (defun tooltip-activate-mouse-motions-if-enabled () | |
289 "Reconsider for all buffers whether mouse motion events are desired." | |
290 (remove-hook 'post-command-hook 'tooltip-activate-mouse-motions-if-enabled) | |
291 (let ((buffers (buffer-list))) | |
292 (save-excursion | |
293 (while buffers | |
294 (set-buffer (car buffers)) | |
295 (if (and tooltip-mode | |
296 tooltip-gud-tips-p | |
297 (memq major-mode tooltip-gud-modes)) | |
298 (tooltip-activate-mouse-motions t) | |
299 (tooltip-activate-mouse-motions nil)) | |
300 (setq buffers (cdr buffers)))))) | |
301 | |
45571
04484b8dacdc
(tooltip-mouse-motions-active): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45236
diff
changeset
|
302 (defvar tooltip-mouse-motions-active nil |
04484b8dacdc
(tooltip-mouse-motions-active): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45236
diff
changeset
|
303 "Locally t in a buffer if tooltip processing of mouse motion is enabled.") |
25003 | 304 |
305 (defun tooltip-activate-mouse-motions (activatep) | |
306 "Activate/deactivate mouse motion events for the current buffer. | |
307 ACTIVATEP non-nil means activate mouse motion events." | |
308 (if activatep | |
309 (progn | |
45571
04484b8dacdc
(tooltip-mouse-motions-active): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45236
diff
changeset
|
310 (make-local-variable 'tooltip-mouse-motions-active) |
04484b8dacdc
(tooltip-mouse-motions-active): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45236
diff
changeset
|
311 (setq tooltip-mouse-motions-active t) |
25003 | 312 (make-local-variable 'track-mouse) |
313 (setq track-mouse t)) | |
45571
04484b8dacdc
(tooltip-mouse-motions-active): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45236
diff
changeset
|
314 (when tooltip-mouse-motions-active |
04484b8dacdc
(tooltip-mouse-motions-active): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45236
diff
changeset
|
315 (kill-local-variable 'tooltip-mouse-motions-active) |
04484b8dacdc
(tooltip-mouse-motions-active): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45236
diff
changeset
|
316 (kill-local-variable 'track-mouse)))) |
25003 | 317 |
318 (defun tooltip-mouse-motion (event) | |
319 "Command handler for mouse movement events in `global-map'." | |
320 (interactive "e") | |
321 (tooltip-hide) | |
322 (when (car (mouse-pixel-position)) | |
323 (setq tooltip-last-mouse-motion-event (copy-sequence event)) | |
35069
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
324 (tooltip-start-delayed-tip))) |
25003 | 325 |
326 | |
327 | |
328 ;;; Displaying tips | |
329 | |
35043
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
330 (defun tooltip-set-param (alist key value) |
40178
1dab42ecd751
(tooltip-set-param): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
40173
diff
changeset
|
331 "Change the value of KEY in alist ALIST to VALUE. |
35043
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
332 If there's no association for KEY in ALIST, add one, otherwise |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
333 change the existing association. Value is the resulting alist." |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
334 (let ((param (assq key alist))) |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
335 (if (consp param) |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
336 (setcdr param value) |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
337 (push (cons key value) alist)) |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
338 alist)) |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
339 |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
340 |
25003 | 341 (defun tooltip-show (text) |
40173
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
342 "Show a tooltip window displaying TEXT. |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
343 |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
344 Text larger than `x-max-tooltip-size' (which see) is clipped. |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
345 |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
346 If the alist in `tooltip-frame-parameters' includes `left' and `top' |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
347 parameters, they determine the x and y position where the tooltip |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
348 is displayed. Otherwise, the tooltip pops at offsets specified by |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
349 `tooltip-x-offset' and `tooltip-y-offset' from the current mouse |
c4955867228d
(tooltip-x-offset, tooltip-y-offset): Mention in the
Eli Zaretskii <eliz@gnu.org>
parents:
37755
diff
changeset
|
350 position." |
32431
a35cc9700ff7
* tooltip.el (tooltip-use-echo-area): New user variable.
Sam Steingold <sds@gnu.org>
parents:
30481
diff
changeset
|
351 (if tooltip-use-echo-area |
a35cc9700ff7
* tooltip.el (tooltip-use-echo-area): New user variable.
Sam Steingold <sds@gnu.org>
parents:
30481
diff
changeset
|
352 (message "%s" text) |
34540
e1e4704de6ed
(tooltip-show): If an error is signaled in
Gerd Moellmann <gerd@gnu.org>
parents:
33925
diff
changeset
|
353 (condition-case error |
35043
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
354 (let ((params (copy-sequence tooltip-frame-parameters)) |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
355 (fg (face-attribute 'tooltip :foreground)) |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
356 (bg (face-attribute 'tooltip :background))) |
35069
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
357 (when (stringp fg) |
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
358 (setq params (tooltip-set-param params 'foreground-color fg)) |
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
359 (setq params (tooltip-set-param params 'border-color fg))) |
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
360 (when (stringp bg) |
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
361 (setq params (tooltip-set-param params 'background-color bg))) |
35043
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
362 (x-show-tip (propertize text 'face 'tooltip) |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
363 (selected-frame) |
35044 | 364 params |
35401
c00e94a506a2
(tooltip-hide-delay): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
35069
diff
changeset
|
365 tooltip-hide-delay |
35043
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
366 tooltip-x-offset |
f7ca93e40e16
(tooltip-frame-parameters): Remove colors.
Gerd Moellmann <gerd@gnu.org>
parents:
34689
diff
changeset
|
367 tooltip-y-offset)) |
34540
e1e4704de6ed
(tooltip-show): If an error is signaled in
Gerd Moellmann <gerd@gnu.org>
parents:
33925
diff
changeset
|
368 (error |
e1e4704de6ed
(tooltip-show): If an error is signaled in
Gerd Moellmann <gerd@gnu.org>
parents:
33925
diff
changeset
|
369 (message "Error while displaying tooltip: %s" error) |
e1e4704de6ed
(tooltip-show): If an error is signaled in
Gerd Moellmann <gerd@gnu.org>
parents:
33925
diff
changeset
|
370 (sit-for 1) |
e1e4704de6ed
(tooltip-show): If an error is signaled in
Gerd Moellmann <gerd@gnu.org>
parents:
33925
diff
changeset
|
371 (message "%s" text))))) |
e1e4704de6ed
(tooltip-show): If an error is signaled in
Gerd Moellmann <gerd@gnu.org>
parents:
33925
diff
changeset
|
372 |
25003 | 373 |
374 (defun tooltip-hide (&optional ignored-arg) | |
375 "Hide a tooltip, if one is displayed. | |
376 Value is non-nil if tooltip was open." | |
35069
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
377 (tooltip-cancel-delayed-tip) |
25003 | 378 (when (x-hide-tip) |
30481 | 379 (setq tooltip-hide-time (float-time)))) |
25003 | 380 |
381 | |
382 | |
383 ;;; Debugger-related functions | |
384 | |
385 (defun tooltip-identifier-from-point (point) | |
386 "Extract the identifier at POINT, if any. | |
387 Value is nil if no identifier exists at point. Identifier extraction | |
388 is based on the current syntax table." | |
389 (save-excursion | |
390 (goto-char point) | |
391 (let ((start (progn (skip-syntax-backward "w_") (point)))) | |
392 (unless (looking-at "[0-9]") | |
393 (skip-syntax-forward "w_") | |
394 (when (> (point) start) | |
395 (buffer-substring start (point))))))) | |
396 | |
397 | |
398 (defmacro tooltip-region-active-p () | |
399 "Value is non-nil if the region is currently active." | |
400 (if (string-match "^GNU" (emacs-version)) | |
401 `(and transient-mark-mode mark-active) | |
402 `(region-active-p))) | |
403 | |
404 | |
405 (defun tooltip-expr-to-print (event) | |
406 "Return an expression that should be printed for EVENT. | |
407 If a region is active and the mouse is inside the region, print | |
408 the region. Otherwise, figure out the identifier around the point | |
409 where the mouse is." | |
410 (save-excursion | |
411 (set-buffer (tooltip-event-buffer event)) | |
412 (let ((point (posn-point (event-end event)))) | |
413 (if (tooltip-region-active-p) | |
414 (when (and (<= (region-beginning) point) (<= point (region-end))) | |
415 (buffer-substring (region-beginning) (region-end))) | |
416 (tooltip-identifier-from-point point))))) | |
417 | |
418 | |
419 (defun tooltip-process-prompt-regexp (process) | |
420 "Return regexp matching the prompt of PROCESS at the end of a string. | |
421 The prompt is taken from the value of COMINT-PROMPT-REGEXP in the buffer | |
422 of PROCESS." | |
423 (let ((prompt-regexp (save-excursion | |
424 (set-buffer (process-buffer process)) | |
425 comint-prompt-regexp))) | |
426 ;; Most start with `^' but the one for `sdb' cannot be easily | |
427 ;; stripped. Code the prompt for `sdb' fixed here. | |
428 (if (= (aref prompt-regexp 0) ?^) | |
429 (setq prompt-regexp (substring prompt-regexp 1)) | |
430 (setq prompt-regexp "\\*")) | |
431 (concat "\n*" prompt-regexp "$"))) | |
432 | |
433 | |
434 (defun tooltip-strip-prompt (process output) | |
435 "Return OUTPUT with any prompt of PROCESS stripped from its end." | |
436 (let ((prompt-regexp (tooltip-process-prompt-regexp process))) | |
437 (save-match-data | |
438 (when (string-match prompt-regexp output) | |
439 (setq output (substring output 0 (match-beginning 0))))) | |
440 output)) | |
441 | |
442 | |
443 | |
444 ;;; Tips for `gud' | |
445 | |
446 (defvar tooltip-gud-original-filter nil | |
447 "Process filter to restore after GUD output has been received.") | |
448 | |
449 | |
450 (defvar tooltip-gud-dereference nil | |
451 "Non-nil means print expressions with a `*' in front of them. | |
452 For C this would dereference a pointer expression.") | |
453 | |
454 | |
455 (defvar tooltip-gud-event nil | |
456 "The mouse movement event that led to a tooltip display. | |
457 This event can be examined by forms in TOOLTIP-GUD-DISPLAY.") | |
458 | |
459 | |
460 (defvar tooltip-gud-debugger nil | |
461 "A symbol describing the debugger running under GUD.") | |
462 | |
463 | |
464 (defun tooltip-gud-toggle-dereference () | |
27582
42b52d8b6703
(tooltip-gud-tips-p, tooltip-gud-toggle-dereference):
Dave Love <fx@gnu.org>
parents:
25332
diff
changeset
|
465 "Toggle whether tooltips should show `* expr' or `expr'." |
25003 | 466 (interactive) |
467 (setq tooltip-gud-dereference (not tooltip-gud-dereference)) | |
468 (when (interactive-p) | |
469 (message "Dereferencing is now %s." | |
470 (if tooltip-gud-dereference "on" "off")))) | |
471 | |
472 | |
473 (defun tooltip-gud-process-output (process output) | |
474 "Process debugger output and show it in a tooltip window." | |
475 (set-process-filter process tooltip-gud-original-filter) | |
476 (tooltip-show (tooltip-strip-prompt process output))) | |
477 | |
478 | |
479 (defun tooltip-gud-print-command (expr) | |
480 "Return a suitable command to print the expression EXPR. | |
481 If TOOLTIP-GUD-DEREFERENCE is t, also prepend a `*' to EXPR." | |
482 (when tooltip-gud-dereference | |
483 (setq expr (concat "*" expr))) | |
484 (case tooltip-gud-debugger | |
485 ((gdb dbx) (concat "print " expr)) | |
486 (xdb (concat "p " expr)) | |
487 (sdb (concat expr "/")) | |
488 (perldb expr))) | |
30481 | 489 |
25003 | 490 |
491 (defun tooltip-gud-tips (event) | |
25332
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
492 "Show tip for identifier or selection under the mouse. |
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
493 The mouse must either point at an identifier or inside a selected |
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
494 region for the tip window to be shown. If tooltip-gud-dereference is t, |
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
495 add a `*' in front of the printed expression. |
25003 | 496 |
497 This function must return nil if it doesn't handle EVENT." | |
498 (let (gud-buffer process) | |
499 (when (and (eventp event) | |
500 tooltip-gud-tips-p | |
501 (boundp 'gud-comint-buffer) | |
502 (setq gud-buffer gud-comint-buffer) | |
503 (setq process (get-buffer-process gud-buffer)) | |
504 (posn-point (event-end event)) | |
505 (progn (setq tooltip-gud-event event) | |
506 (eval (cons 'and tooltip-gud-display)))) | |
507 (let ((expr (tooltip-expr-to-print event))) | |
508 (when expr | |
33140
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
509 (let ((cmd (tooltip-gud-print-command expr))) |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
510 (unless (null cmd) ; CMD can be nil if unknown debugger |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
511 (setq tooltip-gud-original-filter (process-filter process)) |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
512 (set-process-filter process 'tooltip-gud-process-output) |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
513 (gud-basic-call cmd) |
61f4c87b845c
(tooltip-gud-tips-setup): New function.
Miles Bader <miles@gnu.org>
parents:
32431
diff
changeset
|
514 expr))))))) |
25003 | 515 |
516 | |
517 ;;; Tooltip help. | |
518 | |
519 (defvar tooltip-help-message nil | |
520 "The last help message received via `tooltip-show-help-function'.") | |
521 | |
522 | |
523 (defun tooltip-show-help-function (msg) | |
524 "Function installed as `show-help-function'. | |
525 MSG is either a help string to display, or nil to cancel the display." | |
526 (let ((previous-help tooltip-help-message)) | |
527 (setq tooltip-help-message msg) | |
528 (cond ((null msg) | |
35069
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
529 ;; Cancel display. This also cancels a delayed tip, if |
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
530 ;; there is one. |
25003 | 531 (tooltip-hide)) |
35069
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
532 ((equal previous-help msg) |
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
533 ;; Same help as before (but possibly the mouse has moved). |
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
534 ;; Keep what we have. |
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
535 ) |
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
536 (t |
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
537 ;; A different help. Remove a previous tooltip, and |
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
538 ;; display a new one, with some delay. |
25003 | 539 (tooltip-hide) |
35069
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
540 (tooltip-start-delayed-tip))))) |
25003 | 541 |
542 | |
543 (defun tooltip-help-tips (event) | |
544 "Hook function to display a help tooltip. | |
35069
d19eadb47c76
(tooltip-cancel-delayed-tip)
Gerd Moellmann <gerd@gnu.org>
parents:
35044
diff
changeset
|
545 This is installed on the hook `tooltip-hook', which is run when |
42706 | 546 the timer with ID `tooltip-timeout-id' fires. |
25003 | 547 Value is non-nil if this function handled the tip." |
548 (when (stringp tooltip-help-message) | |
549 (tooltip-show tooltip-help-message) | |
550 t)) | |
551 | |
552 | |
553 | |
33356
73a360d50e18
(tooltip-mode): Add a comment about startup.el
Gerd Moellmann <gerd@gnu.org>
parents:
33140
diff
changeset
|
554 ;;; Do this after all functions have been defined that are called from |
73a360d50e18
(tooltip-mode): Add a comment about startup.el
Gerd Moellmann <gerd@gnu.org>
parents:
33140
diff
changeset
|
555 ;;; `tooltip-mode'. The actual default value of `tooltip-mode' is set |
73a360d50e18
(tooltip-mode): Add a comment about startup.el
Gerd Moellmann <gerd@gnu.org>
parents:
33140
diff
changeset
|
556 ;;; in startup.el. |
25332
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
557 |
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
558 ;;;###autoload |
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
559 (defcustom tooltip-mode nil |
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
560 "Toggle tooltip-mode. |
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
561 Setting this variable directly does not take effect; |
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
562 use either \\[customize] or the function `tooltip-mode'." |
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
563 :set (lambda (symbol value) |
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
564 (tooltip-mode (or value 0))) |
c09e05be2f4b
(tooltip-mode): Customize this, per convention.
Dave Love <fx@gnu.org>
parents:
25003
diff
changeset
|
565 :initialize 'custom-initialize-default |
25003 | 566 :type 'boolean |
567 :require 'tooltip | |
568 :group 'tooltip) | |
569 | |
570 | |
571 ;;; tooltip.el ends here |