unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: Tooltips on w32 slow and strange
Date: Mon, 14 Feb 2005 13:29:19 -0500	[thread overview]
Message-ID: <jwvoeengg8u.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <v9ll9rqbw4.fsf@marauder.physik.uni-ulm.de> (Reiner Steib's message of "Mon, 14 Feb 2005 18:39:23 +0100")

> I think this is the reason:

> ,----[ startup.el ]
> | (defun command-line ()
> | [...]
> |   (unless (or noninteractive
> | 	      emacs-quick-startup
> |               (not (display-graphic-p))
> |               (not (fboundp 'x-show-tip)))
> |     (setq-default tooltip-mode t)
> |     (tooltip-mode 1))
> `----

Yes I think this is wrong.
Instead, the defcustom of tooltip-mode should set the default value to

        (and (not noninteractive)
	     (not emacs-quick-startup)
	     (display-graphic-p)
	     (fboundp 'x-show-tip))

and then command-line should only do something like
(custom-reeval 'tooltip-mode) where custom-reeval is a new function that
re-sets the value of a custom var by re-evaluating the expression that
describes its default (or saved, or whatever) value,
i.e. something typically used when the value of the expression can change.


        Stefan


--- orig/lisp/tooltip.el
+++ mod/lisp/tooltip.el
@@ -187,25 +187,25 @@
 ;; would be accompanied by a full redisplay.
 
 ;;;###autoload
-(defun tooltip-mode (&optional arg)
+(define-minor-mode tooltip-mode
   "Mode for tooltip display.
 With ARG, turn tooltip mode on if and only if ARG is positive."
-  (interactive "P")
-  (unless (fboundp 'x-show-tip)
+  :init (and (not noninteractive)
+	     (not emacs-quick-startup)
+	     (display-graphic-p)
+	     (fboundp 'x-show-tip))
+  (unless (or (null tooltip-mode) (fboundp 'x-show-tip))
     (error "Sorry, tooltips are not yet available on this system"))
-  (let* ((on (if arg
-		 (> (prefix-numeric-value arg) 0)
-	       (not tooltip-mode)))
-	 (hook-fn (if on 'add-hook 'remove-hook)))
-    (setq tooltip-mode on)
+  (let ((hook-fn (if tooltip-mode 'add-hook 'remove-hook)))
     (funcall hook-fn 'change-major-mode-hook 'tooltip-change-major-mode)
     (tooltip-activate-mouse-motions-if-enabled)
     (funcall hook-fn 'pre-command-hook 'tooltip-hide)
     (funcall hook-fn 'tooltip-hook 'tooltip-gud-tips)
     (funcall hook-fn 'tooltip-hook 'tooltip-help-tips)
     (setq show-help-function (if on 'tooltip-show-help-function nil))
-    ;; `ignore' is the default binding for mouse movements.
+    ;; FIXME: why not use a minor mode map?
     (define-key global-map [mouse-movement]
+      ;; `ignore' is the default binding for mouse movements.
       (if on 'tooltip-mouse-motion 'ignore))))
 
 \f
@@ -521,22 +521,6 @@
     t))
 
 \f
-;;; Do this after all functions have been defined that are called from
-;;; `tooltip-mode'.  The actual default value of `tooltip-mode' is set
-;;; in startup.el.
-
-;;;###autoload
-(defcustom tooltip-mode nil
-  "Non-nil if Tooltip mode is enabled.
-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
-  :require 'tooltip
-  :group 'tooltip)
-
 (provide 'tooltip)
 
 ;; arch-tag: 3d61135e-4618-4a78-af28-183f6df5636f

  reply	other threads:[~2005-02-14 18:29 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-13  0:21 Tooltips on w32 slow and strange Lennart Borgman
2005-02-13 18:21 ` Stefan Daschek
2005-02-14  8:15 ` Stephan Stahl
2005-02-14  9:58   ` Jason Rumney
2005-02-14 10:13     ` Stephan Stahl
2005-02-14 10:27       ` Jason Rumney
2005-02-14 12:26     ` David Kastrup
2005-02-14 13:07       ` Jason Rumney
2005-02-14 14:41         ` Lennart Borgman
2005-02-14 15:19           ` Jason Rumney
2005-02-14 18:02             ` Lennart Borgman
2005-02-14 15:02       ` Miles Bader
2005-02-14 15:47         ` David Kastrup
2005-02-14 15:57           ` Ralf Angeli
2005-02-14 17:16             ` David Kastrup
2005-02-14 17:29               ` Jason Rumney
2005-02-14 17:39               ` Reiner Steib
2005-02-14 18:29                 ` Stefan Monnier [this message]
2005-02-14 17:56               ` Ralf Angeli
2005-02-14 18:55             ` Jan D.
2005-02-14 19:44               ` Ralf Angeli
2005-02-14 19:59                 ` Jan D.
2005-02-14 20:14                 ` David Kastrup
2005-02-15  8:15                   ` Ralf Angeli
2005-02-16  1:02         ` Oliver Scholz
2005-02-14 18:42       ` Jan D.
2005-02-14 18:50         ` David Kastrup
2005-02-14 19:02           ` Jan D.
2005-02-14 13:54     ` Lennart Borgman
2005-02-14 15:08       ` Miles Bader
2005-02-14 20:28         ` Eli Zaretskii
2005-02-14 23:48           ` Miles Bader
2005-02-14 23:58             ` Jason Rumney
2005-02-15  0:27               ` David Kastrup
2005-02-15  0:01             ` Lennart Borgman
2005-02-15  0:47             ` Kenichi Handa
2005-02-15  6:19               ` Jan D.
2005-02-15 16:29                 ` Stefan Monnier
2005-02-15  4:45             ` Eli Zaretskii
2005-02-15  8:53               ` Stephan Stahl
2005-02-15 10:02                 ` Jason Rumney
2005-02-15 10:11                   ` Stephan Stahl
2005-02-15 10:31                     ` Jason Rumney
2005-02-15 13:43                     ` Lennart Borgman
2005-02-15 14:19                       ` Jason Rumney
2005-02-15 15:31                         ` Lennart Borgman
2005-02-15 20:03                 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2005-03-08  9:07 Stephan Stahl
2005-03-08 10:40 ` Stephan Stahl
2005-03-08 12:43 ` Jason Rumney
2005-03-08 15:42 ` Lennart Borgman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvoeengg8u.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).