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
Running Emacs with
-Q does not change anything.
How should I catch mouse movement events in Emacs 26?
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
1 Asked on January 1, 2021 by malvineous
1 Asked on January 1, 2021 by rl1
1 Asked on December 26, 2020
1 Asked on December 17, 2020 by a_subscriber
0 Asked on December 16, 2020 by roman-smirnov
1 Asked on December 14, 2020 by toothrot
1 Asked on December 12, 2020 by tom-dalziel
0 Asked on December 12, 2020 by rajkumar-natarajan
0 Asked on December 11, 2020 by eugene
1 Asked on December 11, 2020 by intel_chris
Get help from others!