0

I experience some weird behavior with tooltips:

(progn
  (let* ((start (point))
         (end (progn (insert "test") (point)))
         (ov (make-overlay start end)))
    (overlay-put ov 'help-echo
                 (propertize "xxx" 'display '(image :type jpeg :file "~/foo.jpg"))))
  (display-buffer-other-frame (get-buffer-create "dummy")))

Evaluating this code and moving the mouse pointer over test I get a tooltip displaying the image file foo.jpg. The tooltip appears as a box with a light yellow background color with sharp corners.

But the moment I click into any frame/window the tooltip changes. Now the tooltip contains no image but the text xxx. Furthermore the tooltip appears as a transparent black box with rounded corners.

What's going on here? Are their two different tooltip mechanisms with different capabilities?

If I remove the code lines creating/displaying buffer dummy I never see the tooltip with the image (the first one); I see only the tooltip with the text xxx (the second one).

Edit: Here are screenshots of the two different tooltips.

enter image description here enter image description here

7
  • I don't see that behavior of seeing xxx after clicking in a window or frame. I'm using Emacs 26.3 on MS Windows.
    – Drew
    Commented Mar 17, 2020 at 21:42
  • BTW, why do you show the code for displaying a buffer named dummy? What does that have to do with your question? The overlay is not even in that buffer, etc. If it's irrelevant then please consider removing it. If it's relevant then maybe explain how so, etc.
    – Drew
    Commented Mar 17, 2020 at 21:43
  • Yes, this dummy buffer/frame is relevant as described in the last paragraph. I need this dummy frame to see the image tooltip, otherwise I only see the "xxx" tooltip. I've tested it with Emacs 25.2.2 and 28.0.50. Commented Mar 17, 2020 at 22:09
  • Then I don't understand - maybe someone else does. Displaying a buffer after you've already created an overlay in some other buffer should have no effect on that overlay. But you don't show all of the relevant code, I expect. Perhaps you need to say something about the buffer you are in when you evaluate the code.
    – Drew
    Commented Mar 17, 2020 at 22:52
  • It's emacs -Q foo.el and C-x C-e, no more. I do not evaluate any other code than the one I posted. Commented Mar 17, 2020 at 23:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.