AnswerBun.com

tooltip-functions not working?

Emacs Asked by toomas on August 15, 2020

Years ago, when Emacs was at 21.*, I had a function that displayed a tooltip when I hovered the mouse on certain words in the buffer. Now, in 26.3, I want to use that function again, but it does not work any more, apparently because Emacs is not passing mouse movement events to it.

Minimal example that worked fine in Emacs 21 but does nothing in Emacs 26:

(defun my-tooltip (event)
  (interactive "e")
  (tooltip-show "got mouse movement event")
  t)

(progn
  (tooltip-mode)
  (set (make-local-variable 'track-mouse) t)
  (setq tooltip-functions nil)
  (add-hook 'tooltip-functions 'my-tooltip))

One more thing: when I did M-x describe-key and moved the mouse, older Emacs versions used to tell me which command, if any, was bound to mouse-movement. In the same situation, Emacs 26 does nothing — it obviously does not see that I am moving the mouse, even when I set track-mouse to t globally.

Running Emacs with -Q does not change anything.

How should I catch mouse movement events in Emacs 26?

One Answer

Not exactly an answer, but a dirty workaround: give up using tooltip-functions and bind the function directly to mouse-movement, like this:

(defun my-tooltip (event)
  (interactive "e")
  (tooltip-show "got mouse movement event")
  t)
(tooltip-mode)
(set (make-local-variable 'track-mouse) t)
(local-set-key (kbd "<mouse-movement>") 'my-tooltip)

Answered by toomas on August 15, 2020

Add your own answers!

Related Questions

Blank menus with Athena / Lucid

1  Asked on December 31, 2020 by tastytea

   

How to clear the eshell

6  Asked on December 24, 2020 by startec

 

org-agenda not showing any todos

1  Asked on December 20, 2020 by stevenmurray

   

Configuring emacs gdb behavior

0  Asked on December 17, 2020 by onye

 

Where find good json formater and validation?

1  Asked on December 17, 2020 by a_subscriber

   

Enlarge pictures in image-dired

1  Asked on December 16, 2020 by calculus

 

Coloured active mode line only when many windows

1  Asked on December 14, 2020 by toothrot

   

Copy-text-to-clipboard-link

1  Asked on December 12, 2020 by jens-lange

   

How to get “:size” from font-spec

1  Asked on December 11, 2020 by enze-chi

 

Getting w3 to work

0  Asked on December 10, 2020 by 0x1a4

 

Wish to define specific defcustom entries

0  Asked on December 9, 2020 by jean-louis

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP