[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Selecting tooltip frames considered harmful
From: |
martin rudalics |
Subject: |
Selecting tooltip frames considered harmful |
Date: |
Sat, 24 Feb 2018 10:52:14 +0100 |
Emacs tooltip frames are not "first-class" frames. They don't have
minibuffer windows which means that calling 'message' when a tooltip
frame is selected will crash Emacs. For example, with emacs -Q run
the following function and move the mouse cursor over the mode line
until a tooltip pops up:
(defun foo ()
(interactive)
(track-mouse
(while (progn
(setq event (read-key))
(or (mouse-movement-p event)
(memq (car event) '(select-window switch-frame))))
(dolist (frame (visible-frame-list))
(when (frame-parameter frame 'tooltip)
(select-frame frame)
(message "..."))))))
Note also the following excerpt from choose_minibuf_frame
/* I don't think that any frames may validly have a null minibuffer
window anymore. */
if (NILP (sf->minibuffer_window))
emacs_abort ();
so the following function will crash us in a similar way:
(defun bar ()
(interactive)
(track-mouse
(while (progn
(setq event (read-key))
(or (mouse-movement-p event)
(memq (car event) '(select-window switch-frame))))
(dolist (frame (visible-frame-list))
(when (frame-parameter frame 'tooltip)
(select-frame frame)
(read-from-minibuffer "..."))))))
You won't observe these crashes with GTK+ tooltips since these are not
Emacs frames. Customize 'x-gtk-use-system-tooltips' to nil in order
to see them with GTK builds.
There seem to be various ways to fix this. For the 'message' case we
could:
(1) Ignore the message in message3_nolog (the ideal solution but maybe
too simplistic).
(2) Send the message to stderr instead (confusing for plain messages
and hardly suited for 'read-from-minibuffer').
(3) Give tooltip frames a minibuffer window of some other frame (with
the usual consequences when trying to delete that frame).
(4) Try to find a frame with a minibuffer and put the message there
(it might be tricky to find the most suited minibuffer here).
(5) Avoid that a tooltip frame gets selected (hardly feasible).
A similar solution should be found when reading from the minibuffer.
Suggestions welcome, martin
- Selecting tooltip frames considered harmful,
martin rudalics <=
- Re: Selecting tooltip frames considered harmful, Eli Zaretskii, 2018/02/24
- Re: Selecting tooltip frames considered harmful, martin rudalics, 2018/02/25
- Re: Selecting tooltip frames considered harmful, Eli Zaretskii, 2018/02/25
- Re: Selecting tooltip frames considered harmful, martin rudalics, 2018/02/26
- Re: Selecting tooltip frames considered harmful, Eli Zaretskii, 2018/02/26
- Re: Selecting tooltip frames considered harmful, martin rudalics, 2018/02/26
- Re: Selecting tooltip frames considered harmful, Eli Zaretskii, 2018/02/26
- Re: Selecting tooltip frames considered harmful, Stefan Monnier, 2018/02/26
Re: Selecting tooltip frames considered harmful, Stefan Monnier, 2018/02/25