]> code.delx.au - gnu-emacs/blobdiff - lisp/tooltip.el
*** empty log message ***
[gnu-emacs] / lisp / tooltip.el
index ab21bf13dfd4f0b212dc61be656042803323f009..a7484dc7fd50e695976625b452c49246b7ce5513 100644 (file)
@@ -1,6 +1,6 @@
 ;;; tooltip.el --- Show tooltip windows
 
-;; Copyright (C) 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999 Free Software Foundation, Inc.
 
 ;; Author: Gerd Moellmann <gerd@acm.org>
 ;; Keywords: help c mouse tools
   :group 'c
   :group 'mouse
   :group 'tools
+  :version "21.1"
   :tag "Tool Tips")
 
+(defvar tooltip-mode)
 
 (defcustom tooltip-delay 1.0
   "Seconds to wait before displaying a tooltip the first time."
@@ -67,8 +69,8 @@
 
 
 (defcustom tooltip-recent-seconds 1
-  "Display tooltips after `tooltip-short-delay' if changing tip items
-within this many seconds."
+  "Display tooltips if changing tip items within this many seconds.
+Do so after `tooltip-short-delay'."
   :tag "Recent seconds"
   :type 'number
   :group 'tooltip)
@@ -88,7 +90,7 @@ within this many seconds."
 
 
 (defcustom tooltip-gud-tips-p nil
-  "Non-nil means show tooltips in GUD sessions."
+  "*Non-nil means show tooltips in GUD sessions."
   :type 'boolean
   :tag "GUD"
   :group 'tooltip)
@@ -100,7 +102,7 @@ within this many seconds."
   :tag "GUD modes"
   :group 'tooltip)
 
-  
+
 (defcustom tooltip-gud-display
   '((eq (tooltip-event-buffer tooltip-gud-event)
        (marker-buffer overlay-arrow-position)))
@@ -134,10 +136,6 @@ the last mouse movement event that occurred.")
   "Time when the last tooltip was hidden.")
 
 
-(defvar tooltip-mode nil
-  "Non-nil means tooltip mode is on.")
-
-
 (defvar tooltip-gud-debugger nil
   "The debugger for which we show tooltips.")
 
@@ -197,18 +195,10 @@ With ARG, turn tooltip mode on if and only if ARG is positive."
 \f
 ;;; Timeout for tooltip display
 
-(defun tooltip-float-time ()
-  "Return the values of `current-time' as a float."
-  (let ((now (current-time)))
-    (+ (* 65536.0 (nth 0 now))
-       (nth 1 now)
-       (/ (nth 2 now) 1000000.0))))
-
-
 (defun tooltip-delay ()
   "Return the delay in seconds for the next tooltip."
   (let ((delay tooltip-delay)
-       (now (tooltip-float-time)))
+       (now (float-time)))
     (when (and tooltip-hide-time
               (< (- now tooltip-hide-time) tooltip-recent-seconds))
       (setq delay tooltip-short-delay))
@@ -289,7 +279,7 @@ ACTIVATEP non-nil means activate mouse motion events."
 Value is non-nil if tooltip was open."
   (tooltip-disable-timeout)
   (when (x-hide-tip)
-    (setq tooltip-hide-time (tooltip-float-time))))
+    (setq tooltip-hide-time (float-time))))
 
 
 \f
@@ -375,7 +365,7 @@ This event can be examined by forms in TOOLTIP-GUD-DISPLAY.")
 
 
 (defun tooltip-gud-toggle-dereference ()
-  "Toggle whether tooltips should show `* exor' or `expr'."
+  "Toggle whether tooltips should show `* expr' or `expr'."
   (interactive)
   (setq tooltip-gud-dereference (not tooltip-gud-dereference))
   (when (interactive-p)
@@ -399,13 +389,13 @@ If TOOLTIP-GUD-DEREFERENCE is t, also prepend a `*' to EXPR."
     (xdb (concat "p " expr))
     (sdb (concat expr "/"))
     (perldb expr)))
-    
+
 
 (defun tooltip-gud-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 tooltip-gud-dereference is t, add a `*' in
-front of the printed expression.
+  "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 tooltip-gud-dereference is t,
+add a `*' in front of the printed expression.
 
 This function must return nil if it doesn't handle EVENT."
   (let (gud-buffer process)
@@ -462,13 +452,16 @@ Value is non-nil if this function handled the tip."
 ;;; Do this after all functions have been defined that are called
 ;;; from `tooltip-mode'.
 
-(defcustom tooltip-active nil
-  "*Non-nil means tooltips are active."
-  :tag "Activate tooltips"
+
+;;;###autoload
+(defcustom tooltip-mode nil
+  "Toggle tooltip-mode.
+Setting this variable directly does not take effect;
+use either \\[customize] or the function `tooltip-mode'."
+  :set (lambda (symbol value)
+        (tooltip-mode (or value 0)))
+  :initialize 'custom-initialize-default
   :type 'boolean
-  :set #'(lambda (symbol value)
-          (set-default symbol value)
-          (tooltip-mode (or value 0)))
   :require 'tooltip
   :group 'tooltip)