help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't use tooltip of dictionary package in Emacs 23


From: Tassilo Horn
Subject: Re: Can't use tooltip of dictionary package in Emacs 23
Date: Mon, 19 Jun 2006 16:54:18 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

"pluskid" <pluskid.zju@gmail.com> writes:

Hi,

>    You mentioned you looked on how dictionary.el implemented it.  Can
> you explain how it implement?

Well, this is basically the code dictionary.el uses for tooltips on GNU
Emacs:

--8<---------------cut here---------------start------------->8---
(defun dictionary-display-tooltip (event)
  "Search the current word in the `dictionary-tooltip-dictionary'."
  (interactive "e")
  ;; Process event and show tooltip
  )

;;;###autoload
(defun dictionary-tooltip-mode (&optional arg)
  "Display tooltips for the current word"
  (interactive "P")
  ;; - snip -
    (add-hook 'tooltip-hook 'dictionary-display-tooltip)
    (make-local-variable 'track-mouse)
    (setq track-mouse on)))
--8<---------------cut here---------------end--------------->8---

By setting the `track-mouse' variable to a non-nil value, mouse motion
events should be generated. When it's time to display a tooltip each
function in `tooltip-hook' is called with an event which can be used to
extract the word under the mouse pointer, etc.

As a test case you could evaluate the following code in *scratch*.

--8<---------------cut here---------------start------------->8---
(progn
  (defun foo (event)
    (interactive "e")
    (message "Gotten Event")
    (tooltip-show "Huzzah!"))
  (add-hook 'tooltip-hook 'foo)
  (setq track-mouse t)
  (tooltip-mode 1))
--8<---------------cut here---------------end--------------->8---

On GNU Emacs 21 this should open tooltips with "Huzzah!" in it, and
"Gotten Event" should be printed in the echo area. (Can someone test it?
I don't have emacs 21 accessible right now.)

On GNU Emacs 22 nothing happens -- it's even worse. All tooltips which
appeared before, for example the modeline help, don't appear anymore
after setting `track-mouse' to non-nil.

Bye,
Tassilo
-- 
A child of five could understand this! Fetch me a child of five!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]