unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tassilo Horn <heimdall@uni-koblenz.de>
Subject: Re: Can't use tooltip of dictionary package in Emacs 23
Date: Mon, 19 Jun 2006 16:54:18 +0200	[thread overview]
Message-ID: <87odwp19id.fsf@baldur.nicundtas.de> (raw)
In-Reply-To: 1150689024.024155.181210@r2g2000cwb.googlegroups.com

"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	other threads:[~2006-06-19 14:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2992.1150617753.9609.help-gnu-emacs@gnu.org>
2006-06-18 12:08 ` Can't use tooltip of dictionary package in Emacs 23 Tassilo Horn
2006-06-19  3:50   ` pluskid
2006-06-19 14:54     ` Tassilo Horn [this message]
2006-06-25 11:51       ` Leon
     [not found]       ` <mailman.3302.1151236323.9609.help-gnu-emacs@gnu.org>
2006-06-25 12:34         ` pluskid
2006-06-29 20:56           ` Leon
     [not found]           ` <mailman.3533.1151614629.9609.help-gnu-emacs@gnu.org>
2006-06-29 21:25             ` Tassilo Horn
2006-06-30  0:58               ` Leon
     [not found]               ` <mailman.3544.1151629100.9609.help-gnu-emacs@gnu.org>
2006-06-30 11:31                 ` Tassilo Horn
2006-06-30 22:25                   ` Leon
2006-06-18  8:02 Chiyuan Zhang
2007-03-16  5:37 ` Xingang Zhang

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=87odwp19id.fsf@baldur.nicundtas.de \
    --to=heimdall@uni-koblenz.de \
    /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.
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).