From: martin rudalics <rudalics@gmx.at>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Selecting tooltip frames considered harmful
Date: Sat, 24 Feb 2018 10:52:14 +0100 [thread overview]
Message-ID: <5A9135CE.3020802@gmx.at> (raw)
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
next reply other threads:[~2018-02-24 9:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-24 9:52 martin rudalics [this message]
2018-02-24 10:41 ` Selecting tooltip frames considered harmful Eli Zaretskii
2018-02-25 19:08 ` martin rudalics
2018-02-25 19:55 ` Eli Zaretskii
2018-02-26 9:05 ` martin rudalics
2018-02-26 15:50 ` Eli Zaretskii
2018-02-26 18:54 ` martin rudalics
2018-02-26 19:31 ` Eli Zaretskii
2018-02-27 2:57 ` Stefan Monnier
2018-02-25 13:33 ` Stefan Monnier
2018-02-25 19:08 ` martin rudalics
2018-02-26 3:02 ` Stefan Monnier
2018-02-26 9:06 ` martin rudalics
2018-02-26 13:21 ` Stefan Monnier
2018-02-26 18:54 ` martin rudalics
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5A9135CE.3020802@gmx.at \
--to=rudalics@gmx.at \
--cc=emacs-devel@gnu.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.