Subject: RE: [External] : bug#23341: x-show-tip does not respect the value of tooltip-hide-delay, and the default tooltip timeout isn't configurable

From: Drew Adams <[email-masked]>
Date: Mon, 2 May 2022 14:53:57 +0000

> > Lots of things can happen unpredictably with
> > frames, per different window managers.
> 
> Not if you use `tooltip-show', I think.

That's like saying "not if you use `forward-char'.
`tooltip-show' doesn't let you do what `x-show-tip'
does.  That's what this discussion is about (IMHO).

> > And invisible frames are used seldom - so
> > much so that Emacs has even (misguidedly)
> > toyed with the idea of getting rid of their
> > support.
> >
> > But pray, please do elaborate?  What's so
> > special about tooltips here?
> 
> Tooltips are made transient for the frame they are displayed in.
> Compositing managers look at the WM_TRANSIENT_FOR property on tooltip
> frames (which are a special kind of frame created without any widgets
> that are always override redirect) to determine how to display the
> tooltip.  Those frames are also displayed outside the usual redisplay
> machinery, and only once, inside `x-show-tip'.

If `tooltip-show' can use `x-show-tip' then so
can user code.  That's the point.  Whatever
guidance applies to _how_ `tooltip-show' uses
`x-show-tip' - whatever super-careful, wise,
limited use is deemed necessary or desirable,
can be made just as well by user code.

Make that guidance explicit, and please be sure
to make clear just what is really necessary and
what is extra, helpful, nice-to-know guidance.

That will add, not subtract, from Emacs.

> > Please consider documenting it, whatever
> > it is - especially the "dangerous" bit.
> >
> > And if this happens with tooltips then what
> > makes you think it's limited to the use of
> > `x-show-tip'?  Just what is `x-show-tip'-
> > specific?
> 
> That cannot happen with `tooltip-show'.

See above.  If that's the case then it means
that `tooltip-show' uses `x-show-tip' in a
particular way.  Document that guidance.
That's all that's needed (if really needed).

> > Some things?  In 'params'?  (PARMS maybe?)
> >
> > Any crash is an Emacs bug (in C code).  Needs to
> > be fixed, regardless of who's authorized to use
> > `x-show-tip'.
> 
> So crashing on some kinds of invalid bytecode is
> an Emacs bug, for that same reason?

Emacs has long held that _any_ crash is an
Emacs bug, yes.  If nothing else, Emacs should
catch the error and handle it more gracefully
than an out-and-out crash.

> > If there are problems/gotchas/bugs/mysteries wrt
> > PARMS, or anything else your vague response is
> > meant to intimate, please fix or document them.
> 
> `tool-bar-position' is one example of such a problematic frame
> parameter, and there are many others, but I never enumerated all of
> them.

Enumerate them.  Or not, if you can't.  That's
the proper approach.  What's good for the
`tooltip-show' goose's use of `x-show-tip' is
also good for user uses of `x-show-tip'.

> Lisp code should _never_ manipulate tooltip frames.
> They are special on
> the C level in that many assumptions (such as there being a GTK or Xt
> widget for each frame), or that the frame has at least one window that
> isn't a "pseudo window" do not hold.  This is also why we bend over
> backwards to not make tooltip frames visible to Lisp inside frame lists
> and probably the display-buffer stuff as well.

Again, whatever is sane for `tooltip-show's use
of `x-show-tip' is just as sane for user use of
it.  The same caveats and guidance, if any,
apply - equally.  There's nothing magical about
Lisp function `tooltip-show'.

> > There's no difference in this regard between what
> > "core Emacs developers" need (and need to know)
> > when using `x-show-tip' and what other Emacs
> > developers need (i.e., users who develop 3rd-party
> > libraries) need.
> >
> > Fix it or document it.  That's the proper response
> > for something useful that (you think) has problems.
> 
> It is documented.  The doc string says:
> 
>   This is an internal function; Lisp code should call `tooltip-show'.

That's misguided.  Let's not promulgate the old
user/developer divide from the 1960s.

That's not doc of how to use it.  If that's the
only thing you can say, then remove its use
from `tooltip-show' - the same considerations
apply.

If you have something useful to say, about how
`x-show-tip' should (let only must) be used,
then provide users with that guidance.  That's
what "fix it or document it" means.