From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Tooltips on w32 slow and strange Date: Mon, 14 Feb 2005 13:29:19 -0500 Message-ID: References: <016b01c51163$45e1d630$0200a8c0@sedrcw11488> <16186.217.194.34.123.1108368907.squirrel@wwws.franken.de> <4210762C.9030203@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1108407096 28677 80.91.229.2 (14 Feb 2005 18:51:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 14 Feb 2005 18:51:36 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 14 19:51:36 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D0lJV-0001fE-CR for ged-emacs-devel@m.gmane.org; Mon, 14 Feb 2005 19:51:17 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D0lZ5-0004ZB-SJ for ged-emacs-devel@m.gmane.org; Mon, 14 Feb 2005 14:07:23 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D0lK3-0005Yi-7f for emacs-devel@gnu.org; Mon, 14 Feb 2005 13:51:51 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D0lJo-0005Sh-H3 for emacs-devel@gnu.org; Mon, 14 Feb 2005 13:51:39 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D0lJn-0005NP-Ox for emacs-devel@gnu.org; Mon, 14 Feb 2005 13:51:35 -0500 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D0kyT-0006r2-IP for emacs-devel@gnu.org; Mon, 14 Feb 2005 13:29:33 -0500 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 42E7B8282C5; Mon, 14 Feb 2005 13:29:33 -0500 (EST) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 8853E2CC002; Mon, 14 Feb 2005 13:29:19 -0500 (EST) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id 5BD4C4BD5C; Mon, 14 Feb 2005 13:29:19 -0500 (EST) Original-To: emacs-devel@gnu.org In-Reply-To: (Reiner Steib's message of "Mon, 14 Feb 2005 18:39:23 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-4.795, requis 5, AWL 0.10, BAYES_00 -4.90) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: main.gmane.org gmane.emacs.devel:33408 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:33408 > 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)))) @@ -521,22 +521,6 @@ t)) -;;; 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